[PATCH 1/5] erofs-utils: lib: use round_up() to avoid division
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Jan 3 20:03:34 AEDT 2025
A hotspot identified by profiling.
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/cache.c b/lib/cache.c
index 5b2cc45..f9aa6eb 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -76,11 +76,12 @@ static int __erofs_battach(struct erofs_buffer_block *bb,
struct erofs_sb_info *sbi = bmgr->sbi;
const unsigned int blkmask = erofs_blksiz(sbi) - 1;
erofs_off_t boff = bb->buffers.off;
- const erofs_off_t alignedoffset = roundup(boff, alignsize);
+ const erofs_off_t alignedoffset = round_up(boff, alignsize);
bool tailupdate = false;
erofs_blk_t blkaddr;
int oob;
+ DBG_BUGON(alignsize & (alignsize - 1));
/* inline data must never span block boundaries */
if (erofs_blkoff(sbi, alignedoffset + incr + blkmask)
+ inline_ext > blkmask)
--
2.43.5
More information about the Linux-erofs
mailing list