[13/16] btrfs: lift make_bad_inode() into btrfs_iget()
diff mbox series

Message ID 20180729220453.13431-13-viro@ZenIV.linux.org.uk
State New
Headers show
Series
  • [01/16] nfs_instantiate(): prevent multiple aliases for directory inode
Related show

Commit Message

Al Viro July 29, 2018, 10:04 p.m. UTC
From: Al Viro <viro@zeniv.linux.org.uk>

we don't need to check is_bad_inode() after the call of
btrfs_read_locked_inode() - it's exactly the same as checking
return value for being non-zero.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/btrfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nikolay Borisov July 30, 2018, 8:15 a.m. UTC | #1
On 30.07.2018 01:04, Al Viro wrote:
> From: Al Viro <viro@zeniv.linux.org.uk>
> 
> we don't need to check is_bad_inode() after the call of
> btrfs_read_locked_inode() - it's exactly the same as checking
> return value for being non-zero.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 9382e0881900..8f0b2592feb0 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -3777,7 +3777,6 @@ static int btrfs_read_locked_inode(struct inode *inode)
>  
>  make_bad:
>  	btrfs_free_path(path);
> -	make_bad_inode(inode);
>  	return ret;
>  }
>  
> @@ -5708,12 +5707,13 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
>  		int ret;
>  
>  		ret = btrfs_read_locked_inode(inode);
> -		if (!is_bad_inode(inode)) {
> +		if (!ret) {
>  			inode_tree_add(inode);
>  			unlock_new_inode(inode);
>  			if (new)
>  				*new = 1;
>  		} else {
> +			make_bad_inode(inode);
>  			unlock_new_inode(inode);
>  			iput(inode);
>  			ASSERT(ret < 0);
>

Patch
diff mbox series

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9382e0881900..8f0b2592feb0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3777,7 +3777,6 @@  static int btrfs_read_locked_inode(struct inode *inode)
 
 make_bad:
 	btrfs_free_path(path);
-	make_bad_inode(inode);
 	return ret;
 }
 
@@ -5708,12 +5707,13 @@  struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
 		int ret;
 
 		ret = btrfs_read_locked_inode(inode);
-		if (!is_bad_inode(inode)) {
+		if (!ret) {
 			inode_tree_add(inode);
 			unlock_new_inode(inode);
 			if (new)
 				*new = 1;
 		} else {
+			make_bad_inode(inode);
 			unlock_new_inode(inode);
 			iput(inode);
 			ASSERT(ret < 0);