From 00d098822fe215a2f4fd32f244a9055b0b043bfe Mon Sep 17 00:00:00 2001 From: Tao Ma Date: Mon, 9 May 2011 10:26:41 -0400 Subject: [PATCH] ext4: use s_inodes_per_block directly in __ext4_get_inode_loc In __ext4_get_inode_loc, we calculate inodes_per_block every time by EXT4_BLOCK_SIZE(sb) / EXT4_INODE_SIZE(sb). AFAICS, this function is a hot path for ext4, so we'd better use s_inodes_per_block directly instead of calculating every time. Signed-off-by: Tao Ma Signed-off-by: "Theodore Ts'o" --- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f2fa5e8a582c..3424e82392ad 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4617,7 +4617,7 @@ static int __ext4_get_inode_loc(struct inode *inode, /* * Figure out the offset within the block group inode table */ - inodes_per_block = (EXT4_BLOCK_SIZE(sb) / EXT4_INODE_SIZE(sb)); + inodes_per_block = EXT4_SB(sb)->s_inodes_per_block; inode_offset = ((inode->i_ino - 1) % EXT4_INODES_PER_GROUP(sb)); block = ext4_inode_table(sb, gdp) + (inode_offset / inodes_per_block); -- 2.20.1