[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140223200115.cd49762996b6bac6cbdd47bc@skynet.be>
Date: Sun, 23 Feb 2014 20:01:15 +0100
From: Fabian Frederick <fabf@...net.be>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: akpm <akpm@...ux-foundation.org>, Tytso <tytso@....edu>
Subject: [PATCH 1/1] fs/ext4/inode.c: Add unlikely() to ext4_iget
Isolate no memory and bad inode cases in ext4_iget.
Signed-off-by: Fabian Frederick <fabf@...net.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists