aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorWang Shilong <wangsl-fnst@cn.fujitsu.com>2013-01-12 04:36:17 -0500
committerJan Kara <jack@suse.cz>2013-01-21 05:19:57 -0500
commit1b7d76e9b1106f2be062f915b05d47658dd4fc63 (patch)
tree986543d21d3b870c54bd9e3280c7ec85fc4384db /fs/ext3
parent2b0542a4a0d9b8cb98e64fc87c5e31d130029a92 (diff)
Ext3: 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 check it. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/inode.c6
-rw-r--r--fs/ext3/resize.c6
-rw-r--r--fs/ext3/xattr.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 6e4f8a529fbc..d7df06839f6a 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1082,7 +1082,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode,
1082 if (!err && buffer_mapped(&dummy)) { 1082 if (!err && buffer_mapped(&dummy)) {
1083 struct buffer_head *bh; 1083 struct buffer_head *bh;
1084 bh = sb_getblk(inode->i_sb, dummy.b_blocknr); 1084 bh = sb_getblk(inode->i_sb, dummy.b_blocknr);
1085 if (!bh) { 1085 if (unlikely(!bh)) {
1086 *errp = -EIO; 1086 *errp = -EIO;
1087 goto err; 1087 goto err;
1088 } 1088 }
@@ -2733,7 +2733,7 @@ static int __ext3_get_inode_loc(struct inode *inode,
2733 return -EIO; 2733 return -EIO;
2734 2734
2735 bh = sb_getblk(inode->i_sb, block); 2735 bh = sb_getblk(inode->i_sb, block);
2736 if (!bh) { 2736 if (unlikely(!bh)) {
2737 ext3_error (inode->i_sb, "ext3_get_inode_loc", 2737 ext3_error (inode->i_sb, "ext3_get_inode_loc",
2738 "unable to read inode block - " 2738 "unable to read inode block - "
2739 "inode=%lu, block="E3FSBLK, 2739 "inode=%lu, block="E3FSBLK,
@@ -2787,7 +2787,7 @@ static int __ext3_get_inode_loc(struct inode *inode,
2787 2787
2788 bitmap_bh = sb_getblk(inode->i_sb, 2788 bitmap_bh = sb_getblk(inode->i_sb,
2789 le32_to_cpu(desc->bg_inode_bitmap)); 2789 le32_to_cpu(desc->bg_inode_bitmap));
2790 if (!bitmap_bh) 2790 if (unlikely(!bitmap_bh))
2791 goto make_io; 2791 goto make_io;
2792 2792
2793 /* 2793 /*
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 0f814f3450de..704e8ce7d782 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -116,7 +116,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
116 int err; 116 int err;
117 117
118 bh = sb_getblk(sb, blk); 118 bh = sb_getblk(sb, blk);
119 if (!bh) 119 if (unlikely(!bh))
120 return ERR_PTR(-EIO); 120 return ERR_PTR(-EIO);
121 if ((err = ext3_journal_get_write_access(handle, bh))) { 121 if ((err = ext3_journal_get_write_access(handle, bh))) {
122 brelse(bh); 122 brelse(bh);
@@ -234,7 +234,7 @@ static int setup_new_group_blocks(struct super_block *sb,
234 goto exit_bh; 234 goto exit_bh;
235 235
236 gdb = sb_getblk(sb, block); 236 gdb = sb_getblk(sb, block);
237 if (!gdb) { 237 if (unlikely(!gdb)) {
238 err = -EIO; 238 err = -EIO;
239 goto exit_bh; 239 goto exit_bh;
240 } 240 }
@@ -722,7 +722,7 @@ static void update_backups(struct super_block *sb,
722 break; 722 break;
723 723
724 bh = sb_getblk(sb, group * bpg + blk_off); 724 bh = sb_getblk(sb, group * bpg + blk_off);
725 if (!bh) { 725 if (unlikely(!bh)) {
726 err = -EIO; 726 err = -EIO;
727 break; 727 break;
728 } 728 }
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index d22ebb7a4f55..9f57470b1727 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -813,7 +813,7 @@ inserted:
813 ea_idebug(inode, "creating block %d", block); 813 ea_idebug(inode, "creating block %d", block);
814 814
815 new_bh = sb_getblk(sb, block); 815 new_bh = sb_getblk(sb, block);
816 if (!new_bh) { 816 if (unlikely(!new_bh)) {
817getblk_failed: 817getblk_failed:
818 ext3_free_blocks(handle, inode, block, 1); 818 ext3_free_blocks(handle, inode, block, 1);
819 error = -EIO; 819 error = -EIO;