All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Qu Wenruo <wqu@suse.com>
Subject: [PATCH 02/10] btrfs/140: use common read repair helpers
Date: Fri, 27 May 2022 10:19:07 +0200	[thread overview]
Message-ID: <20220527081915.2024853-3-hch@lst.de> (raw)
In-Reply-To: <20220527081915.2024853-1-hch@lst.de>

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
---
 tests/btrfs/140 | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/tests/btrfs/140 b/tests/btrfs/140
index c680fe0a..fdff6eb2 100755
--- a/tests/btrfs/140
+++ b/tests/btrfs/140
@@ -24,7 +24,6 @@ _supported_fs btrfs
 _require_scratch_dev_pool 2
 
 _require_btrfs_command inspect-internal dump-tree
-_require_command "$FILEFRAG_PROG" filefrag
 _require_odirect
 # Overwriting data is forbidden on a zoned block device
 _require_non_zoned_device "${SCRATCH_DEV}"
@@ -71,7 +70,7 @@ $XFS_IO_PROG -f -d -c "pwrite -S 0xaa -b 128K 0 128K" "$SCRATCH_MNT/foobar" |\
 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`
+logical_in_btrfs=$(_btrfs_get_first_logical $SCRATCH_MNT/foobar)
 physical=$(get_physical ${logical_in_btrfs} 1)
 devid=$(get_devid ${logical_in_btrfs} 1)
 devpath=$(get_device_path ${devid})
@@ -87,15 +86,7 @@ _scratch_mount
 # 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
-while true; do
-	$XFS_IO_PROG -d -c "pread -b 128K 0 128K" "$SCRATCH_MNT/foobar" > /dev/null &
-	pid=$!
-	wait
-	[ $((pid % 2)) == 1 ] && break
-done
+_btrfs_direct_read_on_mirror 1 2 "$SCRATCH_MNT/foobar" 0 128K
 
 _scratch_unmount
 
-- 
2.30.2


  parent reply	other threads:[~2022-05-27  8:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  8:19 btrfs read repair: new tests and cleanups Christoph Hellwig
2022-05-27  8:19 ` [PATCH 01/10] btrfs: add a helpers for read repair testing Christoph Hellwig
2022-05-27 14:54   ` Zorro Lang
2022-05-27 15:03     ` Christoph Hellwig
2022-05-28  3:34       ` Zorro Lang
2022-05-28  4:56         ` Christoph Hellwig
2022-05-30  0:23   ` Anand Jain
2022-05-30  1:20     ` Qu Wenruo
2022-05-30  4:36       ` Zorro Lang
2022-05-30  5:34         ` Christoph Hellwig
2022-05-27  8:19 ` Christoph Hellwig [this message]
2022-05-30  0:35   ` [PATCH 02/10] btrfs/140: use common read repair helpers Anand Jain
2022-05-27  8:19 ` [PATCH 03/10] btrfs/141: " Christoph Hellwig
2022-05-30  0:36   ` Anand Jain
2022-05-27  8:19 ` [PATCH 04/10] btrfs/142: " Christoph Hellwig
2022-05-30  0:41   ` Anand Jain
2022-05-27  8:19 ` [PATCH 05/10] btrfs/143: " Christoph Hellwig
2022-05-30  0:43   ` Anand Jain
2022-05-27  8:19 ` [PATCH 06/10] btrfs/157: use _btrfs_get_first_logical Christoph Hellwig
2022-05-30  0:44   ` Anand Jain
2022-05-27  8:19 ` [PATCH 07/10] btrfs/215: " Christoph Hellwig
2022-05-30  0:44   ` Anand Jain
2022-05-27  8:19 ` [PATCH 08/10] btrfs: test repair with sectors corrupted in multiple mirrors Christoph Hellwig
2022-05-30  0:50   ` Anand Jain
2022-05-27  8:19 ` [PATCH 09/10] btrfs: test buffered I/O read repair with interleaved corrupted sectors Christoph Hellwig
2022-05-30  2:02   ` Anand Jain
2022-05-27  8:19 ` [PATCH 10/10] btrfs: test direct " Christoph Hellwig
2022-05-27 10:23   ` Qu Wenruo
2022-05-27 13:37     ` Christoph Hellwig
2022-05-30  2:03   ` Anand Jain
2022-05-30  2:07 ` btrfs read repair: new tests and cleanups Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527081915.2024853-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.