[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <B7093938-9D67-4987-8B6B-B05890147580@smartx.com>
Date: Mon, 21 Aug 2023 13:22:48 +0800
From: Li Feng <fengli@...rtx.com>
To: Jens Axboe <axboe@...nel.dk>,
"open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] block: fix unexpected split in bio_discard_limit
Ping…
Thanks,
Li
> 2023年8月17日 下午3:55,Li Feng <fengli@...rtx.com> 写道:
>
> bio_discard_limit() enforces discard boundaries within the range of 32-bit
> unsigned integers, resulting in unexpected discard cut boundaries.
>
> For example, max discard size = 1MiB, discard_granularity = 512B, then the
> discard lengths sent in the range [0,4G) are 1MiB, 1MiB... (1MiB-512).
> The next discard offset from 4G is [4G-512, 4G-512+1MiB).
> The discard of the 4G offset boundary does not comply with the optimal 1MiB
> size.
>
> Signed-off-by: Li Feng <fengli@...rtx.com>
> ---
> block/blk-lib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index e59c3069e835..ec95508c3593 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -32,7 +32,7 @@ static sector_t bio_discard_limit(struct block_device *bdev, sector_t sector)
> * Align the bio size to the discard granularity to make splitting the bio
> * at discard granularity boundaries easier in the driver if needed.
> */
> - return round_down(UINT_MAX, discard_granularity) >> SECTOR_SHIFT;
> + return round_down(ULONG_MAX, discard_granularity) >> SECTOR_SHIFT;
> }
>
> int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
> --
> 2.41.0
>
Powered by blists - more mailing lists