From: Chuck Lever III <chuck.lever@oracle.com>
To: ChenXiaoSong <chenxiaosong2@huawei.com>
Cc: Jeff Layton <jlayton@kernel.org>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"yi.zhang@huawei.com" <yi.zhang@huawei.com>,
"zhangxiaoxu5@huawei.com" <zhangxiaoxu5@huawei.com>
Subject: Re: [PATCH 3/5] nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
Date: Thu, 22 Sep 2022 17:08:41 +0000 [thread overview]
Message-ID: <0376BA94-9B04-47FF-986E-8DD1D3FF1EE5@oracle.com> (raw)
In-Reply-To: <20220922163156.2027440-4-chenxiaosong2@huawei.com>
> On Sep 22, 2022, at 12:31 PM, ChenXiaoSong <chenxiaosong2@huawei.com> wrote:
>
> Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.
>
> inode is converted from seq_file->file instead of seq_file->private in
> client_info_show().
Generally speaking, the patch description should explain why
a change is being made. We can already see that @inode is
converted by looking at the diff below, so the above comment
doesn't add value. Same remark applies to 4/5.
What might work better: "The underlying inode needed by
client_info_show() is already available via struct seq_file.
Thus it is safe to replace client_info_open() with the open
function implicitly defined by DEFINE_SHOW_ATTRIBUTE()."
I'll apply these as-is to nfsd for-next to get them into the
testing pipeline. Thanks!
> Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
> ---
> fs/nfsd/nfs4state.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index c5d199d7e6b4..4017721a04c7 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -2478,7 +2478,7 @@ static const char *cb_state2str(int state)
>
> static int client_info_show(struct seq_file *m, void *v)
> {
> - struct inode *inode = m->private;
> + struct inode *inode = file_inode(m->file);
> struct nfs4_client *clp;
> u64 clid;
>
> @@ -2518,17 +2518,7 @@ static int client_info_show(struct seq_file *m, void *v)
> return 0;
> }
>
> -static int client_info_open(struct inode *inode, struct file *file)
> -{
> - return single_open(file, client_info_show, inode);
> -}
> -
> -static const struct file_operations client_info_fops = {
> - .open = client_info_open,
> - .read = seq_read,
> - .llseek = seq_lseek,
> - .release = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(client_info);
>
> static void *states_start(struct seq_file *s, loff_t *pos)
> __acquires(&clp->cl_lock)
> --
> 2.31.1
>
--
Chuck Lever
next prev parent reply other threads:[~2022-09-22 17:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 16:31 [PATCH 0/5] nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE/DEFINE_SHOW_ATTRIBUTE to simplify the code ChenXiaoSong
2022-09-22 16:31 ` [PATCH 1/5] nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops ChenXiaoSong
2022-09-22 16:31 ` [PATCH 2/5] nfsd: use DEFINE_SHOW_ATTRIBUTE to define export_features_fops and supported_enctypes_fops ChenXiaoSong
2022-09-22 16:31 ` [PATCH 3/5] nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops ChenXiaoSong
2022-09-22 17:08 ` Chuck Lever III [this message]
2022-09-22 16:31 ` [PATCH 4/5] nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_reply_cache_stats_fops ChenXiaoSong
2022-09-22 16:31 ` [PATCH 5/5] nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_file_cache_stats_fops ChenXiaoSong
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=0376BA94-9B04-47FF-986E-8DD1D3FF1EE5@oracle.com \
--to=chuck.lever@oracle.com \
--cc=chenxiaosong2@huawei.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/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
all inboxes | Powered by JetHome®