diff mbox series

[v2] fstest: btrfs/142 fix match the device and stripe id

Message ID 1576047733-31132-1-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series [v2] fstest: btrfs/142 fix match the device and stripe id | expand

Commit Message

Anand Jain Dec. 11, 2019, 7:02 a.m. UTC
We re-aliened the device allocation order to the device id oder, if the
available space on the device is all same. So for this reason the test
cases which is hard coded with the device and the stripe id fails. Fix
it with the new expected device and stripe id.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: Update the comment which referred to the bad stripe and good stripe.

 tests/btrfs/142 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Anand Jain Dec. 11, 2019, 7:22 a.m. UTC | #1
Discard this patch. Qu is fixing with a helper function to find
device for the given stripe id dynamically.

Thanks, Anand

On 12/11/19 3:02 PM, Anand Jain wrote:
> We re-aliened the device allocation order to the device id oder, if the
> available space on the device is all same. So for this reason the test
> cases which is hard coded with the device and the stripe id fails. Fix
> it with the new expected device and stripe id.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v2: Update the comment which referred to the bad stripe and good stripe.
> 
>   tests/btrfs/142 | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/btrfs/142 b/tests/btrfs/142
> index a23fe1bf4b75..06811a23e662 100755
> --- a/tests/btrfs/142
> +++ b/tests/btrfs/142
> @@ -89,12 +89,13 @@ $XFS_IO_PROG -f -d -c "pwrite -S 0xaa -b 128K 0 128K" "$SCRATCH_MNT/foobar" |\
>   
>   # step 2, corrupt the first 64k of one copy (on SCRATCH_DEV which is the first
>   # one in $SCRATCH_DEV_POOL
> -echo "step 2......corrupt file extent" >>$seqres.full
>   
>   ${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar >> $seqres.full
>   logical_in_btrfs=`${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar | _filter_filefrag | cut -d '#' -f 1`
>   physical_on_scratch=`get_physical ${logical_in_btrfs}`
>   
> +echo "step 2......corrupt file extent on device $SCRATCH_DEV logic $logical_in_btrfs physical $physical_on_scratch" >>$seqres.full
> +
>   _scratch_unmount
>   $XFS_IO_PROG -d -c "pwrite -S 0xbb -b 64K $physical_on_scratch 64K" $SCRATCH_DEV |\
>   	_filter_xfs_io_offset
> @@ -104,15 +105,15 @@ _scratch_mount -o nospace_cache
>   # step 3, 128k dio read (this read can repair bad copy)
>   echo "step 3......repair the bad copy" >>$seqres.full
>   
> -# since raid1 consists of two copies, and the bad copy was put on stripe #1
> -# while the good copy lies on stripe #0, the bad copy only gets access when the
> -# reader's pid % 2 == 1 is true
> +# since raid1 consists of two copies, and the bad copy was put on stripe #0
> +# while the good copy lies on stripe #1, the bad copy only gets access when the
> +# reader's pid % 2 == 0 is true
>   start_fail
>   while [[ -z ${result} ]]; do
>   	# enable task-filter only fails the following dio read so the repair is
>   	# supposed to work.
>   	result=$(bash -c "
> -	if [[ \$((\$\$ % 2)) -eq 1 ]]; then
> +	if [[ \$((\$\$ % 2)) -eq 0 ]]; then
>   		echo 1 > /proc/\$\$/make-it-fail
>   		exec $XFS_IO_PROG -d -c \"pread -b 128K 0 128K\" \"$SCRATCH_MNT/foobar\"
>   	fi");
>
diff mbox series

Patch

diff --git a/tests/btrfs/142 b/tests/btrfs/142
index a23fe1bf4b75..06811a23e662 100755
--- a/tests/btrfs/142
+++ b/tests/btrfs/142
@@ -89,12 +89,13 @@  $XFS_IO_PROG -f -d -c "pwrite -S 0xaa -b 128K 0 128K" "$SCRATCH_MNT/foobar" |\
 
 # step 2, corrupt the first 64k of one copy (on SCRATCH_DEV which is the first
 # one in $SCRATCH_DEV_POOL
-echo "step 2......corrupt file extent" >>$seqres.full
 
 ${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar >> $seqres.full
 logical_in_btrfs=`${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar | _filter_filefrag | cut -d '#' -f 1`
 physical_on_scratch=`get_physical ${logical_in_btrfs}`
 
+echo "step 2......corrupt file extent on device $SCRATCH_DEV logic $logical_in_btrfs physical $physical_on_scratch" >>$seqres.full
+
 _scratch_unmount
 $XFS_IO_PROG -d -c "pwrite -S 0xbb -b 64K $physical_on_scratch 64K" $SCRATCH_DEV |\
 	_filter_xfs_io_offset
@@ -104,15 +105,15 @@  _scratch_mount -o nospace_cache
 # step 3, 128k dio read (this read can repair bad copy)
 echo "step 3......repair the bad copy" >>$seqres.full
 
-# since raid1 consists of two copies, and the bad copy was put on stripe #1
-# while the good copy lies on stripe #0, the bad copy only gets access when the
-# reader's pid % 2 == 1 is true
+# since raid1 consists of two copies, and the bad copy was put on stripe #0
+# while the good copy lies on stripe #1, the bad copy only gets access when the
+# reader's pid % 2 == 0 is true
 start_fail
 while [[ -z ${result} ]]; do
 	# enable task-filter only fails the following dio read so the repair is
 	# supposed to work.
 	result=$(bash -c "
-	if [[ \$((\$\$ % 2)) -eq 1 ]]; then
+	if [[ \$((\$\$ % 2)) -eq 0 ]]; then
 		echo 1 > /proc/\$\$/make-it-fail
 		exec $XFS_IO_PROG -d -c \"pread -b 128K 0 128K\" \"$SCRATCH_MNT/foobar\"
 	fi");