mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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>
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user