Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Ext2: use unlikely to improve the efficiency of the kernel

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>

authored by

Wang Shilong and committed by
Jan Kara
2b0542a4 61f43e68

+2 -2
+1 -1
fs/ext2/super.c
··· 1500 1500 bh = sb_bread(sb, tmp_bh.b_blocknr); 1501 1501 else 1502 1502 bh = sb_getblk(sb, tmp_bh.b_blocknr); 1503 - if (!bh) { 1503 + if (unlikely(!bh)) { 1504 1504 err = -EIO; 1505 1505 goto out; 1506 1506 }
+1 -1
fs/ext2/xattr.c
··· 662 662 ea_idebug(inode, "creating block %d", block); 663 663 664 664 new_bh = sb_getblk(sb, block); 665 - if (!new_bh) { 665 + if (unlikely(!new_bh)) { 666 666 ext2_free_blocks(inode, block, 1); 667 667 mark_inode_dirty(inode); 668 668 error = -EIO;