diff mbox series

[3/3] btrfs: use btrfs_path::reada for scrub extent tree readahead

Message ID 20211213131054.102526-4-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: use btrfs_path::reada to replace the | expand

Commit Message

Qu Wenruo Dec. 13, 2021, 1:10 p.m. UTC
For scrub, we trigger two readahead for two trees, extent tree to get
where to scrub, and csum tree to get the data checksum.

For csum tree we already trigger readahead in
btrfs_lookup_csums_range(), by setting path->reada.
But for extent tree we don't have any path based readahead.

This patch will add the readahead for extent tree.

With path based readahead only, on SSDs the scrub speed is the same as
previous btrfs_reada_add() mechanism.
While on HDDs, the scrub speed get degraded by at most 5%, although not
the best case, it's still pretty acceptable, especially considering how
many bugs there are in the old btrfs_reada_add() mechanism recently.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/scrub.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index e1c8e8812793..aca80a12a930 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -3242,6 +3242,7 @@  static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 	 */
 	path->search_commit_root = 1;
 	path->skip_locking = 1;
+	path->reada = READA_FORWARD;
 
 	logical = base + offset;
 	physical_end = physical + nstripes * map->stripe_len;