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

Yu Kuai posted 3 patches 2 days, 22 hours ago
drivers/md/raid5.c | 74 +++++++++++++++++++++++++++++++---------------
drivers/md/raid5.h |  1 +
2 files changed, 51 insertions(+), 24 deletions(-)
[PATCH v2 0/3] md/raid5: discard accounting and llbitmap support
Posted by Yu Kuai 2 days, 22 hours ago
From: Yu Kuai <yukuai@fygo.io>

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
-- 
2.51.0