All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: reduce the duplicated reads during P/Q scrub
@ 2023-04-13  5:57 Qu Wenruo
  2023-04-13  5:57 ` [PATCH 1/2] btrfs: scrub: try harder to mark RAID56 block groups read-only Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qu Wenruo @ 2023-04-13  5:57 UTC (permalink / raw)
  To: linux-btrfs

[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(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-17 22:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-13  5:57 [PATCH 0/2] btrfs: reduce the duplicated reads during P/Q scrub Qu Wenruo
2023-04-13  5:57 ` [PATCH 1/2] btrfs: scrub: try harder to mark RAID56 block groups read-only Qu Wenruo
2023-04-13  5:57 ` [PATCH 2/2] btrfs: scrub: use recovered data stripes as cache to avoid unnecessary read Qu Wenruo
2023-04-17 22:51 ` [PATCH 0/2] btrfs: reduce the duplicated reads during P/Q scrub David Sterba

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.