Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00d09882 authored by Tao Ma's avatar Tao Ma Committed by Theodore Ts'o
Browse files

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: default avatarTao Ma <boyu.mt@taobao.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent e8bbe8c4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);