All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 07/14] NFSv4.1: Rename the pnfs_put_lseg_common to pnfs_layout_remove_lseg
Date: Thu, 20 Sep 2012 21:35:50 -0400	[thread overview]
Message-ID: <1348191357-44503-7-git-send-email-Trond.Myklebust@netapp.com> (raw)
In-Reply-To: <1348191357-44503-6-git-send-email-Trond.Myklebust@netapp.com>

The latter name is more descriptive of the actual function.
Also rename pnfs_insert_layout to pnfs_layout_insert_lseg.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
 fs/nfs/pnfs.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 8633b78..142d0f4 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -294,21 +294,22 @@ static void free_lseg(struct pnfs_layout_segment *lseg)
 	struct inode *ino = lseg->pls_layout->plh_inode;
 
 	NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
-	/* Matched by pnfs_get_layout_hdr in pnfs_insert_layout */
+	/* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */
 	pnfs_put_layout_hdr(NFS_I(ino)->layout);
 }
 
 static void
-pnfs_put_lseg_common(struct pnfs_layout_segment *lseg)
+pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
+		struct pnfs_layout_segment *lseg)
 {
-	struct inode *inode = lseg->pls_layout->plh_inode;
+	struct inode *inode = lo->plh_inode;
 
 	WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
 	list_del_init(&lseg->pls_list);
-	if (list_empty(&lseg->pls_layout->plh_segs)) {
-		set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags);
+	if (list_empty(&lo->plh_segs)) {
+		set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
 		/* Matched by initial refcount set in alloc_init_layout_hdr */
-		pnfs_put_layout_hdr_locked(lseg->pls_layout);
+		pnfs_put_layout_hdr_locked(lo);
 	}
 	rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
 }
@@ -316,6 +317,7 @@ pnfs_put_lseg_common(struct pnfs_layout_segment *lseg)
 void
 pnfs_put_lseg(struct pnfs_layout_segment *lseg)
 {
+	struct pnfs_layout_hdr *lo;
 	struct inode *inode;
 
 	if (!lseg)
@@ -324,13 +326,14 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg)
 	dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg,
 		atomic_read(&lseg->pls_refcount),
 		test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
-	inode = lseg->pls_layout->plh_inode;
+	lo = lseg->pls_layout;
+	inode = lo->plh_inode;
 	if (atomic_dec_and_lock(&lseg->pls_refcount, &inode->i_lock)) {
 		LIST_HEAD(free_me);
 
-		pnfs_put_lseg_common(lseg);
-		list_add(&lseg->pls_list, &free_me);
+		pnfs_layout_remove_lseg(lo, lseg);
 		spin_unlock(&inode->i_lock);
+		list_add(&lseg->pls_list, &free_me);
 		pnfs_free_lseg_list(&free_me);
 	}
 }
@@ -418,7 +421,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg,
 		dprintk("%s: lseg %p ref %d\n", __func__, lseg,
 			atomic_read(&lseg->pls_refcount));
 		if (atomic_dec_and_test(&lseg->pls_refcount)) {
-			pnfs_put_lseg_common(lseg);
+			pnfs_layout_remove_lseg(lseg->pls_layout, lseg);
 			list_add(&lseg->pls_list, tmp_list);
 			rv = 1;
 		}
@@ -831,7 +834,7 @@ cmp_layout(struct pnfs_layout_range *l1,
 }
 
 static void
-pnfs_insert_layout(struct pnfs_layout_hdr *lo,
+pnfs_layout_insert_lseg(struct pnfs_layout_hdr *lo,
 		   struct pnfs_layout_segment *lseg)
 {
 	struct pnfs_layout_segment *lp;
@@ -1178,7 +1181,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
 	init_lseg(lo, lseg);
 	lseg->pls_range = res->range;
 	pnfs_get_lseg(lseg);
-	pnfs_insert_layout(lo, lseg);
+	pnfs_layout_insert_lseg(lo, lseg);
 
 	if (res->return_on_close) {
 		set_bit(NFS_LSEG_ROC, &lseg->pls_flags);
-- 
1.7.11.4


  reply	other threads:[~2012-09-21  1:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21  1:35 [PATCH 01/14] NFSv4.1: Fix a reference leak in pnfs_update_layout Trond Myklebust
2012-09-21  1:35 ` [PATCH 02/14] NFSv4.1: pnfs_layout_io_test_failed must clear invalid lsegs before a retry Trond Myklebust
2012-09-21  1:35   ` [PATCH 03/14] NFSv4.1: Fix a race in the pNFS return-on-close code Trond Myklebust
2012-09-21  1:35     ` [PATCH 04/14] NFSv4.1: Simplify " Trond Myklebust
2012-09-21  1:35       ` [PATCH 05/14] NFSv4.1: Get rid of pNFS layout state "NFS_LAYOUT_INVALID" Trond Myklebust
2012-09-21  1:35         ` [PATCH 06/14] NFSv4.1: reset the inode MDS threshold counters on layout destruction Trond Myklebust
2012-09-21  1:35           ` Trond Myklebust [this message]
2012-09-21  1:35             ` [PATCH 08/14] NFSv4.1: Remove redundant reference to the pnfs_layout_hdr Trond Myklebust
2012-09-21  1:35               ` [PATCH 09/14] NFSv4.1: Free the pnfs_layout_hdr outside the inode->i_lock Trond Myklebust
2012-09-21  1:35                 ` [PATCH 10/14] NFSv4.1: Clean up the removal of pnfs_layout_hdr from the server list Trond Myklebust
2012-09-21  1:35                   ` [PATCH 11/14] NFSv4.1: Clean up pnfs_put_lseg() Trond Myklebust
2012-09-21  1:35                     ` [PATCH 12/14] NFSv4.1: Balance pnfs_layout_hdr refcount in pnfs_layout_(insert|remove)_lseg Trond Myklebust
2012-09-21  1:35                       ` [PATCH 13/14] NFSv4.1: Get rid of pNFS spin lock debugging asserts Trond Myklebust
2012-09-21  1:35                         ` [PATCH 14/14] NFSv4.1: Remove unused 'default allocation' for pnfs_alloc_layout_hdr() Trond Myklebust

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=1348191357-44503-7-git-send-email-Trond.Myklebust@netapp.com \
    --to=trond.myklebust@netapp.com \
    --cc=linux-nfs@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.