From: Wang shilong <wangshilong1991@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org,
Wang shilong <wangshilong1991@gmail.com>,
Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Subject: [PATCH] Ext4: use 'unlikely' to improve the efficiency of the kernel
Date: Wed, 12 Jan 2011 18:39:50 +0800 [thread overview]
Message-ID: <1294828790-3455-1-git-send-email-wangshilong1991@gmail.com> (raw)
From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Since 'sb_getblk' seldomly return NULL,it will be better
to use 'unlikely' to check it.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
fs/ext4/resize.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 7ea6cbb..2ef10e1 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -309,7 +309,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(-EIO);
if ((err = ext4_journal_get_write_access(handle, bh))) {
brelse(bh);
@@ -386,7 +386,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 -EIO;
err = ext4_journal_get_write_access(handle, bh);
@@ -461,7 +461,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 = -EIO;
goto out;
}
@@ -983,7 +983,7 @@ static void update_backups(struct super_block *sb,
break;
bh = sb_getblk(sb, group * bpg + blk_off);
- if (!bh) {
+ if (unlikely(!bh)) {
err = -EIO;
break;
}
@@ -1074,7 +1074,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 (bitmap_uptodate(bh))
--
1.7.11.7
next reply other threads:[~2013-01-12 3:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 10:39 Wang shilong [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-01-12 9:57 [PATCH] Ext4: use unlikely to improve the efficiency of the kernel shilong wang
2013-01-12 21:30 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1294828790-3455-1-git-send-email-wangshilong1991@gmail.com \
--to=wangshilong1991@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wangsl-fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).