[01/15] bfs_lookup(): use d_splice_alias()
diff mbox

Message ID 20180513213017.31269-1-viro@ZenIV.linux.org.uk
State New
Headers show

Commit Message

Al Viro May 13, 2018, 9:30 p.m. UTC
From: Al Viro <viro@zeniv.linux.org.uk>

code is actually simpler that way.

Cc: "Tigran A. Aivazian" <aivazian.tigran@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/bfs/dir.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Tigran Aivazian May 16, 2018, 9:45 a.m. UTC | #1
Hi Al,

Thank you. This feels a bit like a "time machine", i.e. being
instantly transferred to the almost forgotten distant past for the joy
of seeing familiar faces. Well, past, present or future --- Al Viro is
always right (especially as far as filesystems' code is concerned) and
I safely defer to you --- if you say it is better, then it most
certainly is, dear friend. And to me it looks better too.

Kind regards,
Tigran

On 13 May 2018 at 22:30, Al Viro <viro@zeniv.linux.org.uk> wrote:
> From: Al Viro <viro@zeniv.linux.org.uk>
>
> code is actually simpler that way.
>
> Cc: "Tigran A. Aivazian" <aivazian.tigran@gmail.com>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
>  fs/bfs/dir.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
> index ee832ca5f734..facf9614a381 100644
> --- a/fs/bfs/dir.c
> +++ b/fs/bfs/dir.c
> @@ -141,14 +141,9 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
>                 unsigned long ino = (unsigned long)le16_to_cpu(de->ino);
>                 brelse(bh);
>                 inode = bfs_iget(dir->i_sb, ino);
> -               if (IS_ERR(inode)) {
> -                       mutex_unlock(&info->bfs_lock);
> -                       return ERR_CAST(inode);
> -               }
>         }
>         mutex_unlock(&info->bfs_lock);
> -       d_add(dentry, inode);
> -       return NULL;
> +       return d_splice_alias(inode, dentry);
>  }
>
>  static int bfs_link(struct dentry *old, struct inode *dir,
> --
> 2.11.0
>

Patch
diff mbox

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index ee832ca5f734..facf9614a381 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -141,14 +141,9 @@  static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
 		unsigned long ino = (unsigned long)le16_to_cpu(de->ino);
 		brelse(bh);
 		inode = bfs_iget(dir->i_sb, ino);
-		if (IS_ERR(inode)) {
-			mutex_unlock(&info->bfs_lock);
-			return ERR_CAST(inode);
-		}
 	}
 	mutex_unlock(&info->bfs_lock);
-	d_add(dentry, inode);
-	return NULL;
+	return d_splice_alias(inode, dentry);
 }
 
 static int bfs_link(struct dentry *old, struct inode *dir,