Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Christoph Hellwig <hch@lst.de>, Trond Myklebust <trondmy@kernel.org>
Cc: Anna Schumaker <anna@kernel.org>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/4] NFS: cleanup nfs_inode_reclaim_delegation
Date: Mon, 14 Jul 2025 09:06:06 -0400	[thread overview]
Message-ID: <32e83baf09b27ef9ea0def88f8031dfdc0cc5b78.camel@kernel.org> (raw)
In-Reply-To: <20250714111651.1565055-2-hch@lst.de>

On Mon, 2025-07-14 at 13:16 +0200, Christoph Hellwig wrote:
> Reduce a level of indentation for most of the code in this function.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/nfs/delegation.c | 48 ++++++++++++++++++++++-----------------------
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
> index 519bdc91112c..56bb2a7e1793 100644
> --- a/fs/nfs/delegation.c
> +++ b/fs/nfs/delegation.c
> @@ -237,34 +237,34 @@ void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred,
>  
>  	rcu_read_lock();
>  	delegation = rcu_dereference(NFS_I(inode)->delegation);
> -	if (delegation != NULL) {
> -		spin_lock(&delegation->lock);
> -		nfs4_stateid_copy(&delegation->stateid, stateid);
> -		delegation->type = type;
> -		delegation->pagemod_limit = pagemod_limit;
> -		oldcred = delegation->cred;
> -		delegation->cred = get_cred(cred);
> -		switch (deleg_type) {
> -		case NFS4_OPEN_DELEGATE_READ_ATTRS_DELEG:
> -		case NFS4_OPEN_DELEGATE_WRITE_ATTRS_DELEG:
> -			set_bit(NFS_DELEGATION_DELEGTIME, &delegation->flags);
> -			break;
> -		default:
> -			clear_bit(NFS_DELEGATION_DELEGTIME, &delegation->flags);
> -		}
> -		clear_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags);
> -		if (test_and_clear_bit(NFS_DELEGATION_REVOKED,
> -				       &delegation->flags))
> -			atomic_long_inc(&nfs_active_delegations);
> -		spin_unlock(&delegation->lock);
> -		rcu_read_unlock();
> -		put_cred(oldcred);
> -		trace_nfs4_reclaim_delegation(inode, type);
> -	} else {
> +	if (!delegation) {
>  		rcu_read_unlock();
>  		nfs_inode_set_delegation(inode, cred, type, stateid,
>  					 pagemod_limit, deleg_type);
> +		return;
> +	}
> +
> +	spin_lock(&delegation->lock);
> +	nfs4_stateid_copy(&delegation->stateid, stateid);
> +	delegation->type = type;
> +	delegation->pagemod_limit = pagemod_limit;
> +	oldcred = delegation->cred;
> +	delegation->cred = get_cred(cred);
> +	switch (deleg_type) {
> +	case NFS4_OPEN_DELEGATE_READ_ATTRS_DELEG:
> +	case NFS4_OPEN_DELEGATE_WRITE_ATTRS_DELEG:
> +		set_bit(NFS_DELEGATION_DELEGTIME, &delegation->flags);
> +		break;
> +	default:
> +		clear_bit(NFS_DELEGATION_DELEGTIME, &delegation->flags);
>  	}
> +	clear_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags);
> +	if (test_and_clear_bit(NFS_DELEGATION_REVOKED, &delegation->flags))
> +		atomic_long_inc(&nfs_active_delegations);
> +	spin_unlock(&delegation->lock);
> +	rcu_read_unlock();
> +	put_cred(oldcred);
> +	trace_nfs4_reclaim_delegation(inode, type);
>  }
>  
>  static int nfs_do_return_delegation(struct inode *inode,

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2025-07-14 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 11:16 use a hash for looking up delegation Christoph Hellwig
2025-07-14 11:16 ` [PATCH 1/4] NFS: cleanup nfs_inode_reclaim_delegation Christoph Hellwig
2025-07-14 13:06   ` Jeff Layton [this message]
2025-07-14 11:16 ` [PATCH 2/4] NFS: move the delegation_watermark module parameter Christoph Hellwig
2025-07-14 13:06   ` Jeff Layton
2025-07-15  8:03     ` Christoph Hellwig
2025-07-15 11:15       ` Jeff Layton
2025-07-14 11:16 ` [PATCH 3/4] NFS: track active delegations per-server Christoph Hellwig
2025-07-14 13:07   ` Jeff Layton
2025-07-14 11:16 ` [PATCH 4/4] NFS: use a hash table for delegation lookup Christoph Hellwig
2025-07-14 13:14   ` Jeff Layton
2025-07-14 13:18     ` Christoph Hellwig
2025-07-15  8:58     ` Christoph Hellwig
2025-07-15 11:19       ` Jeff Layton
  -- strict thread matches above, loose matches on Subject: below --
2025-07-16 13:26 use a hash for looking up delegation v2 Christoph Hellwig
2025-07-16 13:26 ` [PATCH 1/4] NFS: cleanup nfs_inode_reclaim_delegation Christoph Hellwig

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=32e83baf09b27ef9ea0def88f8031dfdc0cc5b78.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=anna@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@kernel.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