[RFC 11/11] nfsd: refactor unhash_delegation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



and use in expire_client

Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
---
 fs/nfsd/nfs4state.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 053fd2b..01d79cb 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -233,14 +233,20 @@ nfs4_put_delegation(struct nfs4_delegation *dp)
 	}
 }
 
-/* Called under the state lock. */
-static void
-unhash_delegation(struct nfs4_delegation *dp)
+static inline void
+__unhash_delegation_locked(struct nfs4_delegation *dp)
 {
-	spin_lock(&deleg_lock);
 	list_del_init(&dp->dl_perfile);
 	list_del_init(&dp->dl_perclnt);
 	list_del_init(&dp->dl_recall_lru);
+}
+
+/* Called under the state lock. */
+static inline void
+unhash_delegation(struct nfs4_delegation *dp)
+{
+	spin_lock(&deleg_lock);
+	__unhash_delegation_locked(dp);
 	spin_unlock(&deleg_lock);
 	nfs4_put_delegation(dp);
 }
@@ -769,14 +775,14 @@ expire_client(struct nfs4_client *clp)
 		dp = list_entry(clp->cl_delegations.next, struct nfs4_delegation, dl_perclnt);
 		dprintk("NFSD: expire client. dp %p, fp %p\n", dp,
 				dp->dl_flock);
-		list_del_init(&dp->dl_perclnt);
-		list_move(&dp->dl_recall_lru, &reaplist);
+		__unhash_delegation_locked(dp);
+		list_add(&dp->dl_recall_lru, &reaplist);
 	}
 	spin_unlock(&deleg_lock);
 	while (!list_empty(&reaplist)) {
 		dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
 		list_del_init(&dp->dl_recall_lru);
-		unhash_delegation(dp);
+		nfs4_put_delegation(dp);
 	}
 	list_del(&clp->cl_idhash);
 	list_del(&clp->cl_strhash);
-- 
1.6.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux