public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] btrfs: scrub: use a more reader friendly code to implement scrub_simple_mirror()
@ 2023-01-16  7:04 Qu Wenruo
  2023-01-16  7:04 ` [PATCH 01/11] btrfs: remove unused @path inside scrub_stripe() Qu Wenruo
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Qu Wenruo @ 2023-01-16  7:04 UTC (permalink / raw)
  To: linux-btrfs

This is the formal version of the previous PoC patchset "btrfs: scrub:
rework to get rid of the complex bio formshaping"

The idea is pretty straight-forward for scrub:

- Fetch the extent info and csum for the whole BTRFS_STRIPE_LEN range

- Read the full BTRFS_STRIPE_LEN range

- Verify the contents using the extent info and csum at endio time

- Wait for above BTRFS_STRIPE_LEN range read to finish.

- If we have failed sectors, read extra mirrors to repair them.

- If we have failed sectors, writeback the repaired ones.

- If we're doing dev-replace, writeback all good sectors to the target
  device.

Although the workflow is still mostly the same as the old scrub
infrastructure, the implementation goes submit-and-wait method.

Thus it provides a very straight-forward code basis:

		scrub_reset_stripe(stripe);
		ret = scrub_find_fill_first_stripe(extent_root, csum_root, bg,
				cur_logical, logical_end - cur_logical, stripe);
		stripe->physical = physical + stripe->logical - logical_start;
		scrub_throttle_dev_io(sctx, device, BTRFS_STRIPE_LEN);
		scrub_submit_read_one_stripe(stripe);
		wait_scrub_stripe(stripe);
		scrub_repair_one_stripe(stripe);
		scrub_write_repaired_sectors(sctx, stripe);
		scrub_report_stripe_errors(sctx, stripe);
		if (sctx->is_dev_replace)
			scrub_write_replace_sectors(sctx, stripe);
		cur_logical = stripe->logical + BTRFS_STRIPE_LEN;

Thus it covers all the core logic in one function.

By contrast the old code goes various workqueue, endio function jumps,
and extra bio formshaping.

Currently the patchset only covers profiles other than RAID56 parity
stripes.
Thus old infrastructure is still kept for RAID56 parity scrub usage.

But still the patchset is already large enough for review.

The current patchset can already pass all scrub and replace tests.

[BENCHMARK]

However there is a cost.
Since our block size is limited to 64K, it's much smaller block size
compared to the original one.

Thus for the worst case scenario (all data are continuous, and the
profiles is RAID0 for extra splits), the scrub performance got a 20%
drop:

Old:
 
 Duration:         0:00:19
 Total to scrub:   10.52GiB
 Rate:             449.50MiB/s

New:

 Duration:         0:00:24
 Total to scrub:   10.52GiB
 Rate:             355.86MiB/s

The benchmark is using an SATA SSD directly attached to the VM.

[NEED FEEDBACK]

Is 20% drop perf acceptable?

I have seen some customers asking for ways to slow down scrub,
but not to speed it up.
Thus I'm not sure if a native performance drop is a curse or a bless.

Any if needed, I can enlarge the block size by submitting multiple
stripes instead.
But in that case, we will need some extra code to do multiple stripe
scrub.

Qu Wenruo (11):
  btrfs: remove unused @path inside scrub_stripe()
  btrfs: remove @root and @csum_root arguments from
    scrub_simple_mirror()
  btrfs: scrub: use dedicated super block verification function to scrub
    one super block
  btrfs: scrub: introduce the structure for new BTRFS_STRIPE_LEN based
    interface
  btrfs: scrub: introduce a helper to find and fill the sector info for
    a scrub_stripe
  btrfs: scrub: introduce a helper to verify one metadata
  btrfs: scrub: introduce a helper to verify one scrub_stripe
  btrfs: scrub: introduce the repair functionality for scrub_stripe
  btrfs: scrub: introduce a writeback helper for scrub_stripe
  btrfs: scrub: introduce error reporting functionality for scrub_stripe
  btrfs: scrub: switch scrub_simple_mirror() to scrub_stripe
    infrastructure

 fs/btrfs/file-item.c |    9 +-
 fs/btrfs/file-item.h |    3 +-
 fs/btrfs/raid56.c    |    2 +-
 fs/btrfs/scrub.c     | 1521 ++++++++++++++++++++++++++++++------------
 fs/btrfs/volumes.c   |   10 +-
 fs/btrfs/volumes.h   |    2 +
 6 files changed, 1111 insertions(+), 436 deletions(-)

-- 
2.39.0


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

end of thread, other threads:[~2023-03-01 20:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-16  7:04 [PATCH 00/11] btrfs: scrub: use a more reader friendly code to implement scrub_simple_mirror() Qu Wenruo
2023-01-16  7:04 ` [PATCH 01/11] btrfs: remove unused @path inside scrub_stripe() Qu Wenruo
2023-03-01 20:25   ` David Sterba
2023-01-16  7:04 ` [PATCH 02/11] btrfs: remove @root and @csum_root arguments from scrub_simple_mirror() Qu Wenruo
2023-03-01 20:29   ` David Sterba
2023-01-16  7:04 ` [PATCH 03/11] btrfs: scrub: use dedicated super block verification function to scrub one super block Qu Wenruo
2023-01-19  4:46   ` li zhang
2023-01-19  6:57     ` Qu Wenruo
2023-01-16  7:04 ` [PATCH 04/11] btrfs: scrub: introduce the structure for new BTRFS_STRIPE_LEN based interface Qu Wenruo
2023-01-16  7:04 ` [PATCH 05/11] btrfs: scrub: introduce a helper to find and fill the sector info for a scrub_stripe Qu Wenruo
2023-01-16  7:04 ` [PATCH 06/11] btrfs: scrub: introduce a helper to verify one metadata Qu Wenruo
2023-01-16  7:04 ` [PATCH 07/11] btrfs: scrub: introduce a helper to verify one scrub_stripe Qu Wenruo
2023-01-16  7:04 ` [PATCH 08/11] btrfs: scrub: introduce the repair functionality for scrub_stripe Qu Wenruo
2023-01-16  7:04 ` [PATCH 09/11] btrfs: scrub: introduce a writeback helper " Qu Wenruo
2023-01-16  7:04 ` [PATCH 10/11] btrfs: scrub: introduce error reporting functionality " Qu Wenruo
2023-01-16  7:04 ` [PATCH 11/11] btrfs: scrub: switch scrub_simple_mirror() to scrub_stripe infrastructure Qu Wenruo
2023-01-18 20:01 ` [PATCH 00/11] btrfs: scrub: use a more reader friendly code to implement scrub_simple_mirror() David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox