brd: fix aligned_sector from brd_do_discard()

The calculation is just wrong, fix it by round_up().

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-3-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
pull/1250/head
Yu Kuai 2025-05-06 14:17:55 +08:00 committed by Jens Axboe
parent 0e8acffc1b
commit d4099f8893
1 changed files with 1 additions and 1 deletions

View File

@ -166,7 +166,7 @@ static void brd_free_one_page(struct rcu_head *head)
static void brd_do_discard(struct brd_device *brd, sector_t sector, u32 size)
{
sector_t aligned_sector = (sector + PAGE_SECTORS) & ~PAGE_SECTORS;
sector_t aligned_sector = round_up(sector, PAGE_SECTORS);
struct page *page;
size -= (aligned_sector - sector) * SECTOR_SIZE;