All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fstest: btrfs/142 fix match the device and stripe id
@ 2019-12-11  6:53 Anand Jain
  2019-12-11  7:02 ` [PATCH v2] " Anand Jain
  0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2019-12-11  6:53 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, fdmanana, wqu

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>
---
 tests/btrfs/142 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/btrfs/142 b/tests/btrfs/142
index a23fe1bf4b75..95caddfd770a 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
@@ -106,13 +107,13 @@ 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
+# 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");
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] fstest: btrfs/142 fix match the device and stripe id
  2019-12-11  6:53 [PATCH] fstest: btrfs/142 fix match the device and stripe id Anand Jain
@ 2019-12-11  7:02 ` Anand Jain
  2019-12-11  7:22   ` Anand Jain
  0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2019-12-11  7:02 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, fdmanana, wqu

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");
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fstest: btrfs/142 fix match the device and stripe id
  2019-12-11  7:02 ` [PATCH v2] " Anand Jain
@ 2019-12-11  7:22   ` Anand Jain
  0 siblings, 0 replies; 3+ messages in thread
From: Anand Jain @ 2019-12-11  7:22 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, fdmanana, wqu

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");
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-11  7:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  6:53 [PATCH] fstest: btrfs/142 fix match the device and stripe id Anand Jain
2019-12-11  7:02 ` [PATCH v2] " Anand Jain
2019-12-11  7:22   ` Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.