ext4: 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: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index d42a8c4..391e53a 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -956,7 +956,7 @@
goto cleanup;
}
bh = sb_getblk(inode->i_sb, newblock);
- if (!bh) {
+ if (unlikely(!bh)) {
err = -ENOMEM;
goto cleanup;
}
@@ -1029,7 +1029,7 @@
oldblock = newblock;
newblock = ablocks[--a];
bh = sb_getblk(inode->i_sb, newblock);
- if (!bh) {
+ if (unlikely(!bh)) {
err = -ENOMEM;
goto cleanup;
}
@@ -1142,7 +1142,7 @@
return err;
bh = sb_getblk(inode->i_sb, newblock);
- if (!bh)
+ if (unlikely(!bh))
return -ENOMEM;
lock_buffer(bh);