All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: scrub: reduce memory usage for each scrub_stripe
@ 2025-05-05 11:01 Qu Wenruo
  2025-05-05 11:01 ` [PATCH 1/2] btrfs: scrub: fix a wrong error type when metadata bytenr mismatches Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-05-05 11:01 UTC (permalink / raw)
  To: linux-btrfs

The first patch fixes a scrub error reporting bug that metadata bytenr
mismatch is reported as csum error, not a metadata error.

The second patch reduces the memory usage of each scrub_stripe by 24
bytes (on systems with 64 bits LONG), this is done by aggregating all
the small bitmaps (at most 16 bits, as we can have at most STRIPE_LEN /
blocksize blocks per stripe) into a larger bitmap.
Just like what we do with subpage helpers.

This will introduce a lot of small helpers:

- Set/clear bitmap range
- Set/clear/test single bit
- Bitmap weight
- Bitmap empty check
- Bitmap read
  The last one allows us to read out a unsigned long and use it for
  various bitmap operations directly.
  In fact the above weight/empty are just a wrapper around the read
  helper.

Those helpers are small enough thus can be inlined, this will slightly
increase the overhead but saves 24 bytes per scrub_stripe, and we have
128 scrub_stripes for one device, saving around 3KB for scrub/dev-replace
per device.

Qu Wenruo (2):
  btrfs: scrub: fix a wrong error type when metadata bytenr mismatches
  btrfs: scrub: aggregate small bitmaps into a larger one

 fs/btrfs/scrub.c | 287 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 196 insertions(+), 91 deletions(-)

-- 
2.49.0


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

end of thread, other threads:[~2025-05-05 17:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-05 11:01 [PATCH 0/2] btrfs: scrub: reduce memory usage for each scrub_stripe Qu Wenruo
2025-05-05 11:01 ` [PATCH 1/2] btrfs: scrub: fix a wrong error type when metadata bytenr mismatches Qu Wenruo
2025-05-05 11:01 ` [PATCH 2/2] btrfs: scrub: aggregate small bitmaps into a larger one Qu Wenruo
2025-05-05 17:42   ` David Sterba
2025-05-05 17:44 ` [PATCH 0/2] btrfs: scrub: reduce memory usage for each scrub_stripe 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.