linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Ext2: use unlikely to improve the efficiency of the kernel
@ 2013-01-12  9:34 shilong wang
  2013-01-14 14:21 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: shilong wang @ 2013-01-12  9:34 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, linux-ext4

From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

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>
---
 fs/ext2/super.c |    2 +-
 fs/ext2/xattr.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index af74d9e..c0f4fc6 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1495,7 +1495,7 @@ static ssize_t ext2_quota_write(struct
super_block *sb, int type,
 			bh = sb_bread(sb, tmp_bh.b_blocknr);
 		else
 			bh = sb_getblk(sb, tmp_bh.b_blocknr);
-		if (!bh) {
+		if (unlikely(!bh)) {
 			err = -EIO;
 			goto out;
 		}
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index b6754db..06209ec 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -662,7 +662,7 @@ ext2_xattr_set2(struct inode *inode, struct
buffer_head *old_bh,
 			ea_idebug(inode, "creating block %d", block);

 			new_bh = sb_getblk(sb, block);
-			if (!new_bh) {
+			if (unlikely(!new_bh)) {
 				ext2_free_blocks(inode, block, 1);
 				mark_inode_dirty(inode);
 				error = -EIO;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] Ext2: use unlikely to improve the efficiency of the kernel
  2013-01-12  9:34 [PATCH 1/2] Ext2: use unlikely to improve the efficiency of the kernel shilong wang
@ 2013-01-14 14:21 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2013-01-14 14:21 UTC (permalink / raw)
  To: shilong wang; +Cc: Jan Kara, linux-fsdevel, linux-ext4

On Sat 12-01-13 01:34:50, shilong wang wrote:
> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> Because the function 'sb_getblk' seldomly fails to return
> NULL value. It will be better to use unlikely to optimize it.
  Thanks, I've merged the patch. But your mailer has apparently wrapped
lines in the patch so I had to fix it up. Please either use mailer that
doesn't wrap lines or send patches as text/plain attachments. Thanks!

								Honza
> 
> Signed-off-by: Wang shilong <wangsl-fnst@cn.fujitsu.com>
> ---
>  fs/ext2/super.c |    2 +-
>  fs/ext2/xattr.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index af74d9e..c0f4fc6 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -1495,7 +1495,7 @@ static ssize_t ext2_quota_write(struct
> super_block *sb, int type,
>  			bh = sb_bread(sb, tmp_bh.b_blocknr);
>  		else
>  			bh = sb_getblk(sb, tmp_bh.b_blocknr);
> -		if (!bh) {
> +		if (unlikely(!bh)) {
>  			err = -EIO;
>  			goto out;
>  		}
> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> index b6754db..06209ec 100644
> --- a/fs/ext2/xattr.c
> +++ b/fs/ext2/xattr.c
> @@ -662,7 +662,7 @@ ext2_xattr_set2(struct inode *inode, struct
> buffer_head *old_bh,
>  			ea_idebug(inode, "creating block %d", block);
> 
>  			new_bh = sb_getblk(sb, block);
> -			if (!new_bh) {
> +			if (unlikely(!new_bh)) {
>  				ext2_free_blocks(inode, block, 1);
>  				mark_inode_dirty(inode);
>  				error = -EIO;
> -- 
> 1.7.7.6
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-14 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-12  9:34 [PATCH 1/2] Ext2: use unlikely to improve the efficiency of the kernel shilong wang
2013-01-14 14:21 ` Jan Kara

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).