diff options
author | Wang Shilong <wangsl-fnst@cn.fujitsu.com> | 2013-01-12 16:28:47 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-01-12 16:28:47 -0500 |
commit | aebf02430d25b6bd2b8542126fdcdb90e75a24b8 (patch) | |
tree | 7f884e64b000d9bed3a59dd557b3075a2da4405d /fs/ext4/resize.c | |
parent | 860d21e2c585f7ee8a4ecc06f474fdc33c9474f4 (diff) | |
download | linux-aebf02430d25b6bd2b8542126fdcdb90e75a24b8.tar.bz2 |
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/resize.c')
-rw-r--r-- | fs/ext4/resize.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 02824dc2ff3b..05f8d4502d42 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -333,7 +333,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, int err; bh = sb_getblk(sb, blk); - if (!bh) + if (unlikely(!bh)) return ERR_PTR(-ENOMEM); if ((err = ext4_journal_get_write_access(handle, bh))) { brelse(bh); @@ -410,7 +410,7 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, return err; bh = sb_getblk(sb, flex_gd->groups[group].block_bitmap); - if (!bh) + if (unlikely(!bh)) return -ENOMEM; err = ext4_journal_get_write_access(handle, bh); @@ -500,7 +500,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb, goto out; gdb = sb_getblk(sb, block); - if (!gdb) { + if (unlikely(!gdb)) { err = -ENOMEM; goto out; } @@ -1064,7 +1064,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, ext4_bg_has_super(sb, group)); bh = sb_getblk(sb, backup_block); - if (!bh) { + if (unlikely(!bh)) { err = -ENOMEM; break; } @@ -1168,7 +1168,7 @@ static int ext4_add_new_descs(handle_t *handle, struct super_block *sb, static struct buffer_head *ext4_get_bitmap(struct super_block *sb, __u64 block) { struct buffer_head *bh = sb_getblk(sb, block); - if (!bh) + if (unlikely(!bh)) return NULL; if (!bh_uptodate_or_lock(bh)) { if (bh_submit_read(bh) < 0) { |