erofs-utils: lib: use round_up() to avoid division
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 3 Jan 2025 09:03:34 +0000 (17:03 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Sat, 5 Apr 2025 16:25:21 +0000 (00:25 +0800)
A hotspot identified by profiling.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250103090338.740593-1-hsiangkao@linux.alibaba.com
lib/cache.c

index 5b2cc452bacfc6482756066fddd4e322f5cb59fe..f9aa6eb9114fed0044a7447a93dfe9990274c654 100644 (file)
@@ -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)