From: Tao Ma <tm@tao.ma>
To: linux-ext4@vger.kernel.org
Subject: [PATCH] ext4: Use s_inodes_per_block directly in __ext4_get_inode_loc.
Date: Mon, 28 Mar 2011 23:41:13 +0800 [thread overview]
Message-ID: <1301326873-9551-2-git-send-email-tm@tao.ma> (raw)
In-Reply-To: <1301326873-9551-1-git-send-email-tm@tao.ma>
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>
---
fs/ext4/inode.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
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);
--
1.7.4
next prev parent reply other threads:[~2011-03-28 15:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 15:41 [PATCH] ext4: Use EXT4FS_DEBUG instead of EXT4_DEBUG in fsync.c Tao Ma
2011-03-28 15:41 ` Tao Ma [this message]
2011-05-09 1:56 ` [PATCH] ext4: Use s_inodes_per_block directly in __ext4_get_inode_loc Ted Ts'o
2011-05-09 1:55 ` [PATCH] ext4: Use EXT4FS_DEBUG instead of EXT4_DEBUG in fsync.c Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301326873-9551-2-git-send-email-tm@tao.ma \
--to=tm@tao.ma \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).