Patchwork [1/3] Ext2: remove the overhead check about sb in the function ext2_new_blocks

login
register
mail settings
Submitter Wang shilong
Date Feb. 6, 2013, 6:14 a.m.
Message ID <1360131268-1615-1-git-send-email-wangshilong1991@gmail.com>
Download mbox | patch
Permalink /patch/218489/
State New
Headers show

Comments

Wang shilong - Feb. 6, 2013, 6:14 a.m.
From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

It can be guranteed that inode->i_sb should not be null in vfs.
So here the check about it is overhead.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
 fs/ext2/balloc.c | 4 ----
 1 file changed, 4 deletions(-)
Jan Kara - Feb. 6, 2013, 12:46 p.m.
On Wed 06-02-13 14:14:26, Wang shilong wrote:
> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> It can be guranteed that inode->i_sb should not be null in vfs.
> So here the check about it is overhead.
  This patch looks good. I've added it to my tree.

								Honza
> 
> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> ---
>  fs/ext2/balloc.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
> index 1c36139..22993a0 100644
> --- a/fs/ext2/balloc.c
> +++ b/fs/ext2/balloc.c
> @@ -1239,10 +1239,6 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
>  
>  	*errp = -ENOSPC;
>  	sb = inode->i_sb;
> -	if (!sb) {
> -		printk("ext2_new_blocks: nonexistent device");
> -		return 0;
> -	}
>  
>  	/*
>  	 * Check quota for allocation of this block.
> -- 
> 1.7.11.7
>

Patch

diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 1c36139..22993a0 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -1239,10 +1239,6 @@  ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
 
 	*errp = -ENOSPC;
 	sb = inode->i_sb;
-	if (!sb) {
-		printk("ext2_new_blocks: nonexistent device");
-		return 0;
-	}
 
 	/*
 	 * Check quota for allocation of this block.