All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] btrfs: simplify the stripe buffer handling
@ 2026-06-29  9:25 Qu Wenruo
  2026-06-29  9:25 ` [PATCH v3 1/2] btrfs: remove SCRUB_MAX_SECTORS_PER_BLOCK Qu Wenruo
  2026-06-29  9:25 ` [PATCH v3 2/2] btrfs: use kvmalloc() for stripe buffer of scrub_stripe Qu Wenruo
  0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2026-06-29  9:25 UTC (permalink / raw)
  To: linux-btrfs

[CHANGELOG]
v3:
- Add a patch to remove a unused macro

- Add new ASSERT()s to make sure the kvmallocated memory is page aligned
  The size is 64K, which is page aligned and power of 2, thus the
  resulted memory should at least be page aligned.

  Furthermore, we have several call sites using (BTRFS_STRIPE_LEN /
  PAGE_SIZE) or (BTRFS_STRIPE_LEN >> PAGE_SHIFT), add an build time
  assert to make sure our PAGE_SIZE is not larger than BTRFS_STRIPE_LEN.

v2:
- Fix a potential double-free during release_scrub_stripe()
  Reported by sashiko.

- Enlarge the scrub bbio to be able to contain the full buffer
  Since the buffer is allocated by kvmalloc(), it's possible that not
  all pages are physically contiguous.

  In that case we have to enlarge the bbio to contain
  (BTRFS_STRIPE_LEN >> PAGE_SHIFT) bvecs.

This is to use kvmalloc() to allocate a buffer for scrub, so that we do
not need to bother page-switching, and simplify the scrub progress.

Qu Wenruo (2):
  btrfs: remove SCRUB_MAX_SECTORS_PER_BLOCK
  btrfs: use kvmalloc() for stripe buffer of scrub_stripe

 fs/btrfs/raid56.c |  18 +----
 fs/btrfs/raid56.h |   2 +-
 fs/btrfs/scrub.c  | 183 ++++++++++++++++++++--------------------------
 3 files changed, 85 insertions(+), 118 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-06-29  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29  9:25 [PATCH v3 0/2] btrfs: simplify the stripe buffer handling Qu Wenruo
2026-06-29  9:25 ` [PATCH v3 1/2] btrfs: remove SCRUB_MAX_SECTORS_PER_BLOCK Qu Wenruo
2026-06-29  9:25 ` [PATCH v3 2/2] btrfs: use kvmalloc() for stripe buffer of scrub_stripe Qu Wenruo

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.