[PATCH] erofs-utils: lib: fix insufficient fragment cache bitmap

Gao Xiang hsiangkao at linux.alibaba.com
Sun Mar 9 04:35:23 AEDT 2025


.. should round up to the nearest byte instead of down.

Fixes: f511cfbbc0da ("erofs-utils: introduce fragment cache")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/fragments.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fragments.c b/lib/fragments.c
index 05bbf0d..d300439 100644
--- a/lib/fragments.c
+++ b/lib/fragments.c
@@ -402,7 +402,7 @@ int erofs_packedfile_init(struct erofs_sb_info *sbi, bool fragments_mkfs)
 			err = -errno;
 			goto err_out;
 		}
-		epi->uptodate_size = BLK_ROUND_UP(sbi, ei.i_size) / 8;
+		epi->uptodate_size = DIV_ROUND_UP(BLK_ROUND_UP(sbi, ei.i_size), 8);
 		epi->uptodate = calloc(1, epi->uptodate_size);
 		if (!epi->uptodate) {
 			err = -ENOMEM;
-- 
2.43.5



More information about the Linux-erofs mailing list