Isolate no memory and bad inode cases in ext4_iget.

Signed-off-by: Fabian Frederick <[email protected]>
---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to