The chain below covers all three signs of device_id, so the initializer
that runs before it is always overwritten.  For device_id > 0 it also
resolves to the metadata zone instead of the device.

The call is not elided either: erofs_metadata_bmgr() sits in another
translation unit, so erofs_allocate_inode_bh_data() calls it twice.
Dropping the initializer removes one call and 10 of the function's 101
instructions on x86-64 with gcc 13.

Signed-off-by: Zhan Xusheng <[email protected]>
---
Requested here:
https://lore.kernel.org/linux-erofs/[email protected]/

 lib/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index 24be613..d71a9d1 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -201,8 +201,7 @@ int erofs_allocate_inode_bh_data(struct erofs_inode *inode, 
erofs_blk_t nblocks,
                                 int device_id)
 {
        struct erofs_sb_info *sbi = inode->sbi;
-       struct erofs_bufmgr *bmgr = device_id ?
-               erofs_metadata_bmgr(sbi, false) : sbi->bmgr;
+       struct erofs_bufmgr *bmgr;
        struct erofs_buffer_head *bh;
        int ret, type;
 

base-commit: 0beeaae8e8ccc907fd2a49ee054aa882c76b40d4
-- 
2.43.0


Reply via email to