summaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorWang Shilong2013-01-12 22:28:47 +0100
committerTheodore Ts'o2013-01-12 22:28:47 +0100
commitaebf02430d25b6bd2b8542126fdcdb90e75a24b8 (patch)
tree7f884e64b000d9bed3a59dd557b3075a2da4405d /fs/ext4/extents.c
parentext4: return ENOMEM if sb_getblk() fails (diff)
downloadkernel-qcow2-linux-aebf02430d25b6bd2b8542126fdcdb90e75a24b8.tar.gz
kernel-qcow2-linux-aebf02430d25b6bd2b8542126fdcdb90e75a24b8.tar.xz
kernel-qcow2-linux-aebf02430d25b6bd2b8542126fdcdb90e75a24b8.zip
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>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index d42a8c49ad69..391e53a52e58 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -956,7 +956,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
goto cleanup;
}
bh = sb_getblk(inode->i_sb, newblock);
- if (!bh) {
+ if (unlikely(!bh)) {
err = -ENOMEM;
goto cleanup;
}
@@ -1029,7 +1029,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
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 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
return err;
bh = sb_getblk(inode->i_sb, newblock);
- if (!bh)
+ if (unlikely(!bh))
return -ENOMEM;
lock_buffer(bh);