Files
linux/drivers/block
Yu Kuai 24c9cb53e6 brd: fix discard end sector
[ Upstream commit a26a339a65 ]

brd_do_discard() just aligned start sector to page, this can only work
if the discard size if at least one page. For example:

blkdiscard /dev/ram0 -o 5120 -l 1024

In this case, size = (1024 - (8192 - 5120)), which is a huge value.

Fix the problem by round_down() the end sector.

Fixes: 9ead7efc6f ("brd: implement discard support")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250506061756.2970934-4-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-19 15:39:20 +02:00
..
2025-03-16 22:06:37 -07:00
2025-06-19 15:39:20 +02:00
2025-03-10 15:12:17 +01:00
2024-12-23 08:17:23 -07:00
2024-12-23 08:17:23 -07:00