[Devel] [PATCH VZ9] fs/fuse kio: fix incorrect size calculation
Liu Kui
kui.liu at virtuozzo.com
Mon Aug 4 18:18:27 MSK 2025
-Replaced bit-shift calculation with DIV_ROUND_UP macro
-Use the correct type for sizeof()
fix the commit "fs/fuse kio: Refactor pcs_mr to avoid large contiguous
memory allocation"
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_mr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_mr.c b/fs/fuse/kio/pcs/pcs_mr.c
index 8e1dbc1121ce..78601d4b8079 100644
--- a/fs/fuse/kio/pcs/pcs_mr.c
+++ b/fs/fuse/kio/pcs/pcs_mr.c
@@ -40,7 +40,7 @@ struct pcs_umem *pcs_umem_get(u64 start, u64 len)
fp_va = start & PAGE_MASK;
npages = PAGE_ALIGN(start + len - fp_va) >> PAGE_SHIFT;
- nchunks = (npages >> PCS_PAGE_CHUNK_SHIFT) + 1;
+ nchunks = DIV_ROUND_UP(npages, PCS_PAGES_PER_CHUNK);
umem = kzalloc(sizeof(*umem), GFP_KERNEL);
if (!umem)
@@ -54,7 +54,7 @@ struct pcs_umem *pcs_umem_get(u64 start, u64 len)
mmap_read_lock(mm_s);
umem->fp_addr = fp_va;
- umem->page_chunk = kcalloc(nchunks, sizeof(struct pcs_page_chunk *), GFP_KERNEL);
+ umem->page_chunk = kcalloc(nchunks, sizeof(struct pcs_page_chunk), GFP_KERNEL);
if (!umem->page_chunk) {
ret = -ENOMEM;
goto out_err;
--
2.39.5 (Apple Git-154)
More information about the Devel
mailing list