projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e8b8344
)
brd: decrease the number of allocated pages which discarded
author
Zhang Xianwei
<zhang.xianwei8@zte.com.cn>
Thu, 28 Nov 2024 09:00:56 +0000
(17:00 +0800)
committer
Jens Axboe
<axboe@kernel.dk>
Fri, 29 Nov 2024 15:43:52 +0000
(08:43 -0700)
The number of allocated pages which discarded will not decrease.
Fix it.
Fixes:
9ead7efc6f3f
("brd: implement discard support")
Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link:
https://lore.kernel.org/r/20241128170056565nPKSz2vsP8K8X2uk2iaDG@zte.com.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/brd.c
patch
|
blob
|
history
diff --git
a/drivers/block/brd.c
b/drivers/block/brd.c
index
5a95671
..
292f127
100644
(file)
--- a/
drivers/block/brd.c
+++ b/
drivers/block/brd.c
@@
-231,8
+231,10
@@
static void brd_do_discard(struct brd_device *brd, sector_t sector, u32 size)
xa_lock(&brd->brd_pages);
while (size >= PAGE_SIZE && aligned_sector < rd_size * 2) {
page = __xa_erase(&brd->brd_pages, aligned_sector >> PAGE_SECTORS_SHIFT);
- if (page)
+ if (page)
{
__free_page(page);
+ brd->brd_nr_pages--;
+ }
aligned_sector += PAGE_SECTORS;
size -= PAGE_SIZE;
}