All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/3] btrfs: use btrfs_path::reada for scrub extent tree readahead
Date: Mon, 13 Dec 2021 21:10:54 +0800	[thread overview]
Message-ID: <20211213131054.102526-4-wqu@suse.com> (raw)
In-Reply-To: <20211213131054.102526-1-wqu@suse.com>

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 --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;
-- 
2.34.1


  parent reply	other threads:[~2021-12-13 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 13:10 [PATCH 0/3] btrfs: use btrfs_path::reada to replace the Qu Wenruo
2021-12-13 13:10 ` [PATCH 1/3] btrfs: remove the unnecessary path parameter for scrub_raid56_parity() Qu Wenruo
2021-12-14 12:44   ` Qu Wenruo
2021-12-13 13:10 ` [PATCH 2/3] btrfs: remove reada mechanism Qu Wenruo
2021-12-13 13:10 ` Qu Wenruo [this message]
2021-12-14 12:41 ` [PATCH 0/3] btrfs: use btrfs_path::reada to replace the David Sterba
2021-12-14 12:45   ` Qu Wenruo

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=20211213131054.102526-4-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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.