Linux NFS development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chuck Lever <cel@kernel.org>
Cc: Dai Ngo <dai.ngo@oracle.com>,
	Chuck Lever <chuck.lever@oracle.com>,
	Jeff Layton <jlayton@kernel.org>,
	neilb@ownmail.net, Olga Kornievskaia <okorniev@redhat.com>,
	Tom Talpey <tom@talpey.com>, Christoph Hellwig <hch@lst.de>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/3] NFSD: Move clientid_hashval and same_clid to header files
Date: Thu, 18 Dec 2025 10:25:30 +0100	[thread overview]
Message-ID: <20251218092530.GA9235@lst.de> (raw)
In-Reply-To: <f8b4865f-044c-4a5c-b4a6-6e1ea9e756e4@app.fastmail.com>

On Mon, Dec 15, 2025 at 01:58:49PM -0500, Chuck Lever wrote:
> >  	return bmval_is_subset(bmval, nfsd_suppattrs[minorversion]);
> >  }
> > 
> > +static inline unsigned int clientid_hashval(u32 id)
> > +{
> > +	return id & CLIENT_HASH_MASK;
> > +}
> > +
> 
> I can't comment on the overall purpose of this series yet, but
> there are one or two mechanical issues that I see already.
> 
> Let's not add NFSv4- or pNFS-specific functions to fs/nfsd/nfsd.h.
> Same comment applies to the function declarations this series moves
> in a subsequent patch.
> 
> Why can't clientid_hashval() go into fs/nfsd/state.h instead?

Or why do we need it at all?  It's completly trivial, and there is
no inherent advantage in sharing an arbiteary masking for hasheѕ.

> Also, when a function becomes accessible outside of one source
> file (like a "static inline" function or a callback function),
> it needs to get a kdoc comment that documents its API contract.

And a nfsd_ prefix would also be useful.  All good arguments for
just duplicating this bit.

> > +static inline int same_clid(clientid_t *cl1, clientid_t *cl2)
> > +{
> > +	return (cl1->cl_boot == cl2->cl_boot) && (cl1->cl_id == cl2->cl_id);
> > +}

Now this might have some more reason to be shared as we need two
values to establish the client identify.  Ńo need for the braces
here even wen they are copied from the existing code.

Also I wonder why clientid_t is a typedef instead of a struct?  And
if we want to treat it as opaque, why we're comparing the fields instead
of a memcmp?


  parent reply	other threads:[~2025-12-18  9:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 18:13 [PATCH 0/3] NFSD: Prevent dupplicate SCSI fencing operation Dai Ngo
2025-12-15 18:13 ` [PATCH 1/3] NFSD: Move clientid_hashval and same_clid to header files Dai Ngo
2025-12-15 18:58   ` Chuck Lever
2025-12-15 20:50     ` Dai Ngo
2025-12-18  9:25     ` Christoph Hellwig [this message]
2025-12-18 19:40       ` Dai Ngo
2025-12-15 18:13 ` [PATCH 2/3] NFSD: Add infrastructure for tracking persistent SCSI registration keys Dai Ngo
2025-12-18  9:34   ` Christoph Hellwig
2025-12-18 16:00     ` Chuck Lever
2025-12-18 19:44       ` Dai Ngo
2025-12-19  5:24       ` Christoph Hellwig
2025-12-19 13:40         ` Chuck Lever
2025-12-18 19:40     ` Dai Ngo
2025-12-15 18:13 ` [PATCH 3/3] NFSD: Prevent redundant SCSI fencing operations Dai Ngo
2025-12-18  9:34   ` Christoph Hellwig
2025-12-18 19:41     ` Dai Ngo

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=20251218092530.GA9235@lst.de \
    --to=hch@lst.de \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@ownmail.net \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.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