Linux-NFS Archive on lore.kernel.org
 help / color / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Qinglang Miao <miaoqinglang@huawei.com>,
	Bruce Fields <bfields@fieldses.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] nfsd: use DEFINE_SPINLOCK() for spinlock
Date: Fri, 31 Jul 2020 08:30:52 -0400
Message-ID: <161A0175-C77B-4252-9D1E-22FEC7EEADE9@oracle.com> (raw)
In-Reply-To: <20200725085642.98356-1-miaoqinglang@huawei.com>

Hello-

> On Jul 25, 2020, at 4:56 AM, Qinglang Miao <miaoqinglang@huawei.com> wrote:
> 
> nfsd_drc_lock can be initialized automatically with
> DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init().
> 
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>

Thanks for your patch.

I am quite honestly on the fence about this one. It doesn't
seem to make a difference behaviorally or in terms of code
legibility.

A broader clean-up that moves set_max_drc and those global
variables into nfs4state.c might be better, but again, there
isn't much to justify such a change.

Bruce, any thoughts?


> ---
> fs/nfsd/nfssvc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index b603dfcdd..20f0a27fe 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -88,7 +88,7 @@ DEFINE_MUTEX(nfsd_mutex);
>  * version 4.1 DRC caches.
>  * nfsd_drc_pages_used tracks the current version 4.1 DRC memory usage.
>  */
> -spinlock_t	nfsd_drc_lock;
> +DEFINE_SPINLOCK(nfsd_drc_lock);
> unsigned long	nfsd_drc_max_mem;
> unsigned long	nfsd_drc_mem_used;
> 
> @@ -568,7 +568,6 @@ static void set_max_drc(void)
> 	nfsd_drc_max_mem = (nr_free_buffer_pages()
> 					>> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE;
> 	nfsd_drc_mem_used = 0;
> -	spin_lock_init(&nfsd_drc_lock);
> 	dprintk("%s nfsd_drc_max_mem %lu \n", __func__, nfsd_drc_max_mem);
> }
> 
> -- 
> 2.25.1
> 

--
Chuck Lever




      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-25  8:56 Qinglang Miao
2020-07-31 12:30 ` Chuck Lever [this message]

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=161A0175-C77B-4252-9D1E-22FEC7EEADE9@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=miaoqinglang@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

Linux-NFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nfs/0 linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ https://lore.kernel.org/linux-nfs \
		linux-nfs@vger.kernel.org
	public-inbox-index linux-nfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-nfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git