Ext2: use unlikely to improve the efficiency of the kernel
authorWang Shilong <wangsl-fnst@cn.fujitsu.com>
Sat, 12 Jan 2013 09:34:50 +0000 (01:34 -0800)
committerJan Kara <jack@suse.cz>
Mon, 21 Jan 2013 10:19:56 +0000 (11:19 +0100)
Because the function 'sb_getblk' seldomly fails to return
NULL value. It will be better to use unlikely to optimize it.

Signed-off-by: Wang shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext2/super.c
fs/ext2/xattr.c

index fa04d023177e71dcd8376adfbc097d2ddb4ee3ae..7f68c8114026a7521ca1808775a89cc1e3765542 100644 (file)
@@ -1500,7 +1500,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
                        bh = sb_bread(sb, tmp_bh.b_blocknr);
                else
                        bh = sb_getblk(sb, tmp_bh.b_blocknr);
-               if (!bh) {
+               if (unlikely(!bh)) {
                        err = -EIO;
                        goto out;
                }
index b6754dbbce3c5e4942d8f46273d24c1236f0588b..06209ec46152715628766b471e1dd1d4997218d0 100644 (file)
@@ -662,7 +662,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                        ea_idebug(inode, "creating block %d", block);
 
                        new_bh = sb_getblk(sb, block);
-                       if (!new_bh) {
+                       if (unlikely(!new_bh)) {
                                ext2_free_blocks(inode, block, 1);
                                mark_inode_dirty(inode);
                                error = -EIO;