* [PATCH] clean erofs_lookup()
@ 2018-10-10 19:01 Al Viro
2018-10-10 23:09 ` Gao Xiang
2018-10-16 11:11 ` [PATCH] " Chao Yu
0 siblings, 2 replies; 5+ messages in thread
From: Al Viro @ 2018-10-10 19:01 UTC (permalink / raw)
To: linux-erofs; +Cc: linux-fsdevel
d_splice_alias() does the right thing when given
ERR_PTR(-E...) for inode. No need for gotos, multiple
returns, etc. in there.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c
index 546a47156101..8cf0617d4ea0 100644
--- a/drivers/staging/erofs/namei.c
+++ b/drivers/staging/erofs/namei.c
@@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir,
if (err == -ENOENT) {
/* negative dentry */
inode = NULL;
- goto negative_out;
- } else if (unlikely(err))
- return ERR_PTR(err);
-
- debugln("%s, %s (nid %llu) found, d_type %u", __func__,
- dentry->d_name.name, nid, d_type);
-
- inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
- if (IS_ERR(inode))
- return ERR_CAST(inode);
-
-negative_out:
+ } else if (unlikely(err)) {
+ inode = ERR_PTR(err);
+ } else {
+ debugln("%s, %s (nid %llu) found, d_type %u", __func__,
+ dentry->d_name.name, nid, d_type);
+ inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
+ }
return d_splice_alias(inode, dentry);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] clean erofs_lookup()
2018-10-10 19:01 [PATCH] clean erofs_lookup() Al Viro
@ 2018-10-10 23:09 ` Gao Xiang
2018-10-12 17:59 ` [PATCH RESEND] staging: erofs: " Gao Xiang
2018-10-16 11:11 ` [PATCH] " Chao Yu
1 sibling, 1 reply; 5+ messages in thread
From: Gao Xiang @ 2018-10-10 23:09 UTC (permalink / raw)
To: Al Viro, linux-fsdevel; +Cc: linux-erofs, Greg Kroah-Hartman
Hi Alexander,
On 2018/10/11 3:01, Al Viro wrote:
> d_splice_alias() does the right thing when given
> ERR_PTR(-E...) for inode. No need for gotos, multiple
> returns, etc. in there.
That is correct :) Thanks for your patch and attention.
Once in the first version we used "d_add" rather than "d_splice_alias"
because I think no need to support disconnect dentries / export in the near future.
But We changed into "d_splice_alias" later, however it seems more redundant logics there...
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Thanks,
Gao Xiang
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c
> index 546a47156101..8cf0617d4ea0 100644
> --- a/drivers/staging/erofs/namei.c
> +++ b/drivers/staging/erofs/namei.c
> @@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir,
> if (err == -ENOENT) {
> /* negative dentry */
> inode = NULL;
> - goto negative_out;
> - } else if (unlikely(err))
> - return ERR_PTR(err);
> -
> - debugln("%s, %s (nid %llu) found, d_type %u", __func__,
> - dentry->d_name.name, nid, d_type);
> -
> - inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
> - if (IS_ERR(inode))
> - return ERR_CAST(inode);
> -
> -negative_out:
> + } else if (unlikely(err)) {
> + inode = ERR_PTR(err);
> + } else {
> + debugln("%s, %s (nid %llu) found, d_type %u", __func__,
> + dentry->d_name.name, nid, d_type);
> + inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
> + }
> return d_splice_alias(inode, dentry);
> }
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH RESEND] staging: erofs: clean erofs_lookup()
2018-10-10 23:09 ` Gao Xiang
@ 2018-10-12 17:59 ` Gao Xiang
2018-10-13 16:37 ` Gao Xiang
0 siblings, 1 reply; 5+ messages in thread
From: Gao Xiang @ 2018-10-12 17:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel
Cc: LKML, linux-fsdevel, linux-erofs, Chao Yu, Chao Yu, Miao Xie, Al Viro
From: Al Viro <viro@ZenIV.linux.org.uk>
d_splice_alias() does the right thing when given
ERR_PTR(-E...) for inode. No need for gotos, multiple
returns, etc. in there.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
Hi,
Frankly, I think it is a straight-forward cleanup by Al enough
to be submitted to Linux 4.20 in constant to other pending fixes
found in the process of EROFS productization these days, which
I need more time to think over and fix formally to the community.
p.s. I have no idea whether this patch has been already queued up
in Al's fs tree for 4.20... :'( +Cc Greg / the staging mailing
list as well. Or please ignore this email...
Thanks,
Gao Xiang
drivers/staging/erofs/namei.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c
index 0039b76..5596c52 100644
--- a/drivers/staging/erofs/namei.c
+++ b/drivers/staging/erofs/namei.c
@@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir,
if (err == -ENOENT) {
/* negative dentry */
inode = NULL;
- goto negative_out;
- } else if (unlikely(err))
- return ERR_PTR(err);
-
- debugln("%s, %s (nid %llu) found, d_type %u", __func__,
- dentry->d_name.name, nid, d_type);
-
- inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
- if (IS_ERR(inode))
- return ERR_CAST(inode);
-
-negative_out:
+ } else if (unlikely(err)) {
+ inode = ERR_PTR(err);
+ } else {
+ debugln("%s, %s (nid %llu) found, d_type %u", __func__,
+ dentry->d_name.name, nid, d_type);
+ inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
+ }
return d_splice_alias(inode, dentry);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] staging: erofs: clean erofs_lookup()
2018-10-12 17:59 ` [PATCH RESEND] staging: erofs: " Gao Xiang
@ 2018-10-13 16:37 ` Gao Xiang
0 siblings, 0 replies; 5+ messages in thread
From: Gao Xiang @ 2018-10-13 16:37 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel
Cc: linux-erofs, LKML, Al Viro, linux-fsdevel, Miao Xie
Hi,
Please ignore this patch, it has been queued by Al for 4.20 in
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next&id=8300807f9e2dffb6552514763ad60e005c12eb94
Sorry for bothering...
Thanks,
Gao Xiang
On 2018/10/13 1:59, Gao Xiang via Linux-erofs wrote:
> From: Al Viro <viro@ZenIV.linux.org.uk>
>
> d_splice_alias() does the right thing when given
> ERR_PTR(-E...) for inode. No need for gotos, multiple
> returns, etc. in there.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> ---
> Hi,
>
> Frankly, I think it is a straight-forward cleanup by Al enough
> to be submitted to Linux 4.20 in constant to other pending fixes
> found in the process of EROFS productization these days, which
> I need more time to think over and fix formally to the community.
>
> p.s. I have no idea whether this patch has been already queued up
> in Al's fs tree for 4.20... :'( +Cc Greg / the staging mailing
> list as well. Or please ignore this email...
>
> Thanks,
> Gao Xiang
>
> drivers/staging/erofs/namei.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c
> index 0039b76..5596c52 100644
> --- a/drivers/staging/erofs/namei.c
> +++ b/drivers/staging/erofs/namei.c
> @@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir,
> if (err == -ENOENT) {
> /* negative dentry */
> inode = NULL;
> - goto negative_out;
> - } else if (unlikely(err))
> - return ERR_PTR(err);
> -
> - debugln("%s, %s (nid %llu) found, d_type %u", __func__,
> - dentry->d_name.name, nid, d_type);
> -
> - inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
> - if (IS_ERR(inode))
> - return ERR_CAST(inode);
> -
> -negative_out:
> + } else if (unlikely(err)) {
> + inode = ERR_PTR(err);
> + } else {
> + debugln("%s, %s (nid %llu) found, d_type %u", __func__,
> + dentry->d_name.name, nid, d_type);
> + inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR);
> + }
> return d_splice_alias(inode, dentry);
> }
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clean erofs_lookup()
2018-10-10 19:01 [PATCH] clean erofs_lookup() Al Viro
2018-10-10 23:09 ` Gao Xiang
@ 2018-10-16 11:11 ` Chao Yu
1 sibling, 0 replies; 5+ messages in thread
From: Chao Yu @ 2018-10-16 11:11 UTC (permalink / raw)
To: Al Viro, linux-erofs; +Cc: linux-fsdevel
On 2018/10/11 3:01, Al Viro wrote:
> d_splice_alias() does the right thing when given
> ERR_PTR(-E...) for inode. No need for gotos, multiple
> returns, etc. in there.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-16 19:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 19:01 [PATCH] clean erofs_lookup() Al Viro
2018-10-10 23:09 ` Gao Xiang
2018-10-12 17:59 ` [PATCH RESEND] staging: erofs: " Gao Xiang
2018-10-13 16:37 ` Gao Xiang
2018-10-16 11:11 ` [PATCH] " Chao Yu
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).