| Submitter | Tao Ma |
|---|---|
| Date | March 28, 2011, 3:41 p.m. |
| Message ID | <1301326873-9551-2-git-send-email-tm@tao.ma> |
| Download | mbox | patch |
| Permalink | /patch/88622/ |
| State | Accepted |
| Headers | show |
Comments
On Mon, Mar 28, 2011 at 11:41:13PM +0800, Tao Ma wrote: > From: Tao Ma <boyu.mt@taobao.com> > > 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 really 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 <boyu.mt@taobao.com> Added to the ext4 tree, thanks. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1a86282..326efd9 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4605,7 +4605,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);