Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, michel.palleau@gmail.com
Subject: [PATCH 0/2] btrfs: scrub: update last_physical more frequently
Date: Fri,  8 Mar 2024 13:40:29 +1030	[thread overview]
Message-ID: <cover.1709867186.git.wqu@suse.com> (raw)

There is a report in the mailling list that scrub only updates its
@last_physical at the end of a chunk.
In fact, it can be worse if there is a used stripe (aka, some extents
exist in the stripe) at the chunk boundary.
As it would skip the @last_physical for that chunk at all.

With @last_physical not update for a long time, if we cancel the scrub
halfway and resume, the resumed one scrub would only start at
@last_physical, meaning a lot of scrubbed extents would be re-scrubbed,
wasting quite some IO and CPU.

This patchset would fix it by updateing @last_physical for each finished
stripe (including both P/Q stripe of RAID56, and all data stripes for
all profiles), so that even if the scrub is cancelled, we at most
re-scrub one stripe.

Qu Wenruo (2):
  btrfs: extract the stripe length calculation into a helper
  btrfs: scrub: update last_physical after scrubing one stripe

 fs/btrfs/scrub.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

-- 
2.44.0


WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, michel.palleau@gmail.com
Subject: [PATCH 0/2] btrfs: scrub: update last_physical more frequently
Date: Fri,  8 Mar 2024 13:55:58 +1030	[thread overview]
Message-ID: <cover.1709867186.git.wqu@suse.com> (raw)
Message-ID: <20240308032558.uieoIEPEZznCuYDmoo8334mAHqwAPAeM7-sS3I9LA-w@z> (raw)

There is a report in the mailling list that scrub only updates its
@last_physical at the end of a chunk.
In fact, it can be worse if there is a used stripe (aka, some extents
exist in the stripe) at the chunk boundary.
As it would skip the @last_physical for that chunk at all.

With @last_physical not update for a long time, if we cancel the scrub
halfway and resume, the resumed one scrub would only start at
@last_physical, meaning a lot of scrubbed extents would be re-scrubbed,
wasting quite some IO and CPU.

This patchset would fix it by updateing @last_physical for each finished
stripe (including both P/Q stripe of RAID56, and all data stripes for
all profiles), so that even if the scrub is cancelled, we at most
re-scrub one stripe.

Qu Wenruo (2):
  btrfs: extract the stripe length calculation into a helper
  btrfs: scrub: update last_physical after scrubing one stripe

 fs/btrfs/scrub.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

-- 
2.44.0


             reply	other threads:[~2024-03-08  4:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  3:10 Qu Wenruo [this message]
2024-03-08  3:25 ` [PATCH 0/2] btrfs: scrub: update last_physical more frequently Qu Wenruo
2024-03-08  3:25 ` [PATCH 1/2] btrfs: extract the stripe length calculation into a helper Qu Wenruo
2024-03-08  3:10   ` Qu Wenruo
2024-03-08 11:37   ` Johannes Thumshirn
2024-03-08  3:26 ` [PATCH 2/2] btrfs: scrub: update last_physical after scrubing one stripe Qu Wenruo
2024-03-08  3:10   ` Qu Wenruo
2024-04-07 21:36 ` [PATCH 0/2] btrfs: scrub: update last_physical more frequently 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=cover.1709867186.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=michel.palleau@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox