Skip to content

md/raid5: discard accounting and llbitmap support

Yu Kuai linux-raid lkml 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesNew
  2. v11 patch 0 repliesSuperseded

Changes in v2 from the cover letter

- Account the exact full-stripe range handled by raid5 before converting llbitmap bits.
- Always advertise raid5 discard limits and move lower-device support validation to the request path.
- Cache unsupported lower discard state in r5conf as raid5_discard_unsupported.
- Keep llbitmap discard useful even when lower member devices cannot safely handle discard.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3md/raid5: account discard IOdrivers/md/raid5.c+23 -100 replies
2/3md/raid5: validate discard support at request timedrivers/md/raid5.c drivers/md/raid5.h+20 -150 replies
3/3md/raid5: always convert llbitmap bits for discarddrivers/md/raid5.c+9 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/3] md/raid5: discard accounting and llbitmap support

From: Yu Kuai <[email protected]>

Hi,

This series fixes raid5 discard IO accounting and lets llbitmap arrays use discard to convert llbitmap bits even when lower member devices do not support discard.

Patch 1 accounts the full-stripe range that raid5 handles before discard is split.

Patch 2 advertises a UINT_MAX discard limit from raid5. Lower discard support is cached in r5conf when raid5 sets queue limits, and unsupported discard bios are rejected before stripe work is queued.

Patch 3 lets llbitmap discard bypass the lower-device support check. If lower discard is not supported, raid5 completes the accounted clone after md_account_bio(), so llbitmap conversion callbacks run without issuing member discard bios.

Changes since v1:
- Account the exact full-stripe range handled by raid5 before converting llbitmap bits.
- Always advertise raid5 discard limits and move lower-device support validation to the request path.
- Cache unsupported lower discard state in r5conf as raid5_discard_unsupported.
- Keep llbitmap discard useful even when lower member devices cannot safely handle discard.

Validation:
- QEMU RAID5 discard test with devices_handle_discard_safely=N:
llbitmap bit conversion matched full-stripe aligned and unaligned discard ranges, md discard iostat advanced for handled llbitmap discards, lower member discard counters stayed at zero, and normal RAID5 discarded no IO when lower discard was unsupported.

Thanks,
Kuai

Yu Kuai (3):
md/raid5: account discard IO
md/raid5: validate discard support at request time md/raid5: always convert llbitmap bits for discard

 drivers/md/raid5.c | 74 +++++++++++++++++++++++++++++++---------------
 drivers/md/raid5.h |  1 +
 2 files changed, 51 insertions(+), 24 deletions(-)

base-commit: 717359a168bb66ac95f6161715d17e491ee86ca7

Signature · 1 line
2.51.0