Re: [PATCH v4] block: fix discard alignment for non-power-of-two granularities
From: Jens Axboe
Date: Fri Nov 27 2026 - 21:47:25 EST
On Fri, 20 Nov 2026 10:17:58 +0000, Hungyu Lin wrote:
> bio_discard_limit() uses round_up() and round_down(), which require a
> power-of-two alignment. However, discard_granularity need not be a power
> of two. For example, dm-thin supports data block sizes that are arbitrary
> multiples of 64 KiB and advertises the block size as its granularity.
>
> With a 192 KiB granularity, discarding one complete block at offset
> 384 KiB is split into 128 KiB and 64 KiB bios. Neither covers a complete
> thin block, so dm-thin ignores both and the mapping remains allocated.
>
> [...]
Applied, thanks!
[1/1] block: fix discard alignment for non-power-of-two granularities
commit: f6ce3d09d6480b56e357336ac080952f9525eab0
Best regards,
--
Jens Axboe