From: Gao Xiang <hsiangkao@redhat.com>
To: cgxu <cgxu519@mykernel.net>
Cc: linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs: code cleanup by removing ifdef macro surrounding
Date: Tue, 26 May 2020 18:35:23 +0800 [thread overview]
Message-ID: <20200526103522.GC8107@hsiangkao-HP-ZHAN-66-Pro-G1> (raw)
In-Reply-To: <4c4a7f7d-c3b7-9093-ae76-32ad258e29a6@mykernel.net>
On Tue, May 26, 2020 at 06:29:00PM +0800, cgxu wrote:
> On 5/26/20 5:49 PM, Gao Xiang wrote:
> > Hi Chengguang,
> >
> > On Tue, May 26, 2020 at 05:03:43PM +0800, Chengguang Xu wrote:
> > > Define erofs_listxattr and erofs_xattr_handlers to NULL when
> > > CONFIG_EROFS_FS_XATTR is not enabled, then we can remove many
> > > ugly ifdef macros in the code.
> > >
> > > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> > > ---
> > > Only compile tested.
> > >
> > > fs/erofs/inode.c | 6 ------
> > > fs/erofs/namei.c | 2 --
> > > fs/erofs/super.c | 4 +---
> > > fs/erofs/xattr.h | 7 ++-----
> > > 4 files changed, 3 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> > > index 3350ab65d892..7dd4bbe9674f 100644
> > > --- a/fs/erofs/inode.c
> > > +++ b/fs/erofs/inode.c
> > > @@ -311,27 +311,21 @@ int erofs_getattr(const struct path *path, struct kstat *stat,
> > > const struct inode_operations erofs_generic_iops = {
> > > .getattr = erofs_getattr,
> > > -#ifdef CONFIG_EROFS_FS_XATTR
> > > .listxattr = erofs_listxattr,
> > > -#endif
> >
> > It seems equivalent. And it seems ext2 and f2fs behave in the same way...
>
> I posted similar patch for ext2 and Jack merged to
> his tree the other day, though that series also
> included a real bugfix. I also posted similar patch
> to f2fs, so if erofs and f2fs merge these patches
> then all three will behave in the same way, ;-)
>
> You may refer below link for the detail.
>
> https://lore.kernel.org/linux-ext4/20200522044035.24190-2-cgxu519@mykernel.net/
Thanks for your link...
>
>
> > But I'm not sure whether we'd return 0 (if I didn't see fs/xattr.c by mistake)
> > or -EOPNOTSUPP here... Some thoughts about this? >
> > Anyway, I'm fine with that if return 0 is okay here, but I'd like to know your
> > and Chao's thoughts about this... I will play with it later as well.
>
> Originally, we set erofs_listxattr to ->listxattr only
> when the config macro CONFIG_EROFS_FS_XATTR is enabled,
> it means that erofs_listxattr() never returns -EOPNOTSUPP
> in any case, so actually there is no logic change here,
> right?
Yeah, I agree there is no logic change, so I'm fine with the patch.
But I'm little worry about if return 0 is actually wrong here...
see the return value at:
http://man7.org/linux/man-pages/man2/listxattr.2.html
Thanks,
Gao Xiang
>
>
> Thanks,
> cgxu
>
next prev parent reply other threads:[~2020-05-26 10:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 9:03 [PATCH] erofs: code cleanup by removing ifdef macro surrounding Chengguang Xu
2020-05-26 9:49 ` Gao Xiang
2020-05-26 10:29 ` cgxu
2020-05-26 10:35 ` Gao Xiang [this message]
2020-05-27 1:55 ` Chao Yu
2020-05-27 2:16 ` Gao Xiang
2020-05-27 2:24 ` cgxu
2020-05-27 2:35 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200526103522.GC8107@hsiangkao-HP-ZHAN-66-Pro-G1 \
--to=hsiangkao@redhat.com \
--cc=cgxu519@mykernel.net \
--cc=linux-erofs@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).