Re: [PATCH 19/79] block: rust: mq: add max_hw_discard_sectors support to GenDiskBuilder

Alice Ryhl
2026-03-16T10:50:22Z

On Mon, Feb 16, 2026 at 12:35:06AM +0100, Andreas Hindborg wrote:
> Add support for configuring the maximum hardware discard sectors
> through GenDiskBuilder. This allows block devices to specify their
> discard/trim capabilities.
>
> Setting this value to 0 (the default) indicates that discard is not
> supported by the device. Non-zero values specify the maximum number
> of sectors that can be discarded in a single operation.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

If 0 is a special value, then it could be slightly cleaner to use
Option<NonNullU32> or even a custom enum

enum MaxHwDiscardSectors {
Unsupported,
Supported { max: NonNullU32, }
}

But I'm also ok with current design, so:

Reviewed-by: Alice Ryhl <aliceryhl@google.com>