From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: akpm <akpm@linux-foundation.org>, Tytso <tytso@mit.edu>
Subject: [PATCH 1/1] fs/ext4/inode.c: Add unlikely() to ext4_iget
Date: Sun, 23 Feb 2014 20:01:15 +0100 [thread overview]
Message-ID: <20140223200115.cd49762996b6bac6cbdd47bc@skynet.be> (raw)
Isolate no memory and bad inode cases in ext4_iget.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/ext4/inode.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 6e39895..e11c30b9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4009,7 +4009,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
gid_t i_gid;
inode = iget_locked(sb, ino);
- if (!inode)
+ if (unlikely(!inode))
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
return inode;
@@ -4018,14 +4018,14 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
iloc.bh = NULL;
ret = __ext4_get_inode_loc(inode, &iloc, 0);
- if (ret < 0)
+ if (unlikely(ret < 0))
goto bad_inode;
raw_inode = ext4_raw_inode(&iloc);
if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
- if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
- EXT4_INODE_SIZE(inode->i_sb)) {
+ if (unlikely(EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
+ EXT4_INODE_SIZE(inode->i_sb))) {
EXT4_ERROR_INODE(inode, "bad extra_isize (%u != %u)",
EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize,
EXT4_INODE_SIZE(inode->i_sb));
@@ -4048,7 +4048,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
sizeof(gen));
}
- if (!ext4_inode_csum_verify(inode, raw_inode, ei)) {
+ if (unlikely(!ext4_inode_csum_verify(inode, raw_inode, ei))) {
EXT4_ERROR_INODE(inode, "checksum invalid");
ret = -EIO;
goto bad_inode;
--
1.8.1.4
next reply other threads:[~2014-02-23 19:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-23 19:01 Fabian Frederick [this message]
2014-02-23 22:15 ` Theodore 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=20140223200115.cd49762996b6bac6cbdd47bc@skynet.be \
--to=fabf@skynet.be \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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
all inboxes | Powered by JetHome®