Skip to content

btrfs: reduce the duplicated reads during P/Q scrub

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: scrub: try harder to mark RAID56 block groups read-onlyfs/btrfs/block-group.c fs/btrfs/scrub.c+22 -30 replies
2/2btrfs: scrub: use recovered data stripes as cache to avoid unnecessary readfs/btrfs/raid56.c fs/btrfs/raid56.h fs/btrfs/scrub.c+56 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] btrfs: reduce the duplicated reads during P/Q scrub

[PROBLEM]
It's a known problem that btrfs scrub for RAID56 is pretty slow.

[CAUSE]
One of the causes is that we read the same data stripes at least twice during P/Q stripes scrub.

This means, during a full fs scrub (one scrub process for each device), there will be quite some extra seeks just because of this.

[FIX]
The truth is, scrub stripes have a much better view of the data stripes. As btrfs would firstly verify all data stripes, and only continue scrubing the P/Q stripes if all the data stripes is fine after needed repair.

So this means, as long as there is no new RMW writes into the RAID56 block group, we can re-use the scrub cache for P/Q verification.

This patchset would fix it by:

- Ensure the RAID56 block groups are marked read-only for scrub This is to avoid RMW in to the block group, or scrub cache is no longer reliable.

- Introduce a new interface to pass cached pages to RAID56 cache The only disadvantage is here we still need to do page copy, due to the uncertain lifespan of an rbio.

Qu Wenruo (2):
btrfs: scrub: try harder to mark RAID56 block groups read-only
btrfs: scrub: use recovered data stripes as cache to avoid unnecessary
read

 fs/btrfs/block-group.c | 16 +++++++++++++--
 fs/btrfs/raid56.c      | 46 ++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/raid56.h      |  3 +++
 fs/btrfs/scrub.c       | 16 ++++++++++++++-
 4 files changed, 78 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.2