Skip to content

btrfs: scrub: update last_physical more frequently

Qu Wenruo linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Rebased to the latest for-next branch
No conflict at all

- Rewording the second patch
There are two problems, one is serious (no last_physical update at all for almost full data chunks), the other one is just inconvenient (slow update on "btrfs scrub status").

- Add the missing spinlock
It's mentioned in the commit messages but not in the code

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: extract the stripe length calculation into a helperfs/btrfs/scrub.c+11 -60 replies
2/2btrfs: scrub: update last_physical after scrubing one stripefs/btrfs/scrub.c+10 -01 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchReviewed-by: Johannes ThumshirnDavid Sterba
SeriesR-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: scrub: update last_physical more frequently

[CHANGELOG]
v2:
- Rebased to the latest for-next branch
No conflict at all

- Rewording the second patch
There are two problems, one is serious (no last_physical update at all for almost full data chunks), the other one is just inconvenient (slow update on "btrfs scrub status").

- Add the missing spinlock
It's mentioned in the commit messages but not in the code

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. And for large fses, there are ensured to be several almost full data

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 | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)
Signature · 1 line
2.45.2