Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Benjamin Coddington <bcodding@redhat.com>,
	Kunwu Chan <chentao@kylinos.cn>
Cc: chuck.lever@oracle.com, neilb@suse.de, kolga@netapp.com,
	Dai.Ngo@oracle.com,  tom@talpey.com, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_drc_slab_create
Date: Fri, 02 Feb 2024 09:24:33 -0500	[thread overview]
Message-ID: <2a9a533ad2341096ef4ffd3533a652ad8fdae2fe.camel@kernel.org> (raw)
In-Reply-To: <94F7DA15-6D4C-4205-9A23-E4593A4A2312@redhat.com>

On Fri, 2024-02-02 at 09:13 -0500, Benjamin Coddington wrote:
> On 1 Feb 2024, at 3:19, Kunwu Chan wrote:
> 
> > Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
> > to simplify the creation of SLAB caches.
> > Make the code cleaner and more readable.
> > 
> > Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> > ---
> >  fs/nfsd/nfscache.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
> > index 5c1a4a0aa605..64ce0cc22197 100644
> > --- a/fs/nfsd/nfscache.c
> > +++ b/fs/nfsd/nfscache.c
> > @@ -166,8 +166,7 @@ nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct nfsd_cacherep *rp,
> > 
> >  int nfsd_drc_slab_create(void)
> >  {
> > -	drc_slab = kmem_cache_create("nfsd_drc",
> > -				sizeof(struct nfsd_cacherep), 0, 0, NULL);
> > +	drc_slab = KMEM_CACHE(nfsd_cacherep, 0);
> >  	return drc_slab ? 0: -ENOMEM;
> >  }
> > 
> > -- 
> > 2.39.2
> 
> I don't agree that the code is cleaner or more readable like this.  I really
> dislike having to parse through the extra "simplification" to see what's
> actually being called and sent.
> 
> Just my .02 worth.
> 
> Ben
> 

This will also result in a behavioral change. The "nfsd_drc" string is
lost with the above macro and (I think) the new name will be
"nfsd_cacherep". I'm not necessarily opposed to that, as I don't think
anything depends on the old name, but it should at least be noted in the
changelog.

-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2024-02-02 14:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01  8:19 [PATCH] nfsd: Simplify the allocation of slab caches in nfsd_drc_slab_create Kunwu Chan
2024-02-02 14:13 ` Benjamin Coddington
2024-02-02 14:24   ` Jeff Layton [this message]
2024-02-04  3:19     ` Kunwu Chan
2024-02-03  0:35   ` NeilBrown

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=2a9a533ad2341096ef4ffd3533a652ad8fdae2fe.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=bcodding@redhat.com \
    --cc=chentao@kylinos.cn \
    --cc=chuck.lever@oracle.com \
    --cc=kolga@netapp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --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