summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.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/inode.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/inode.c')
-rw-r--r--fs/ext4/inode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9ccc140b82d2..93a7e8453a68 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -713,7 +713,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
return NULL;
bh = sb_getblk(inode->i_sb, map.m_pblk);
- if (!bh) {
+ if (unlikely(!bh)) {
*errp = -ENOMEM;
return NULL;
}
@@ -3660,7 +3660,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
iloc->offset = (inode_offset % inodes_per_block) * EXT4_INODE_SIZE(sb);
bh = sb_getblk(sb, block);
- if (!bh)
+ if (unlikely(!bh))
return -ENOMEM;
if (!buffer_uptodate(bh)) {
lock_buffer(bh);
@@ -3693,7 +3693,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
/* Is the inode bitmap in cache? */
bitmap_bh = sb_getblk(sb, ext4_inode_bitmap(sb, gdp));
- if (!bitmap_bh)
+ if (unlikely(!bitmap_bh))
goto make_io;
/*