linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 18/22] pnfs-submit: wave2: change lseg->valid from bool to a bit flag
Date: Thu,  9 Dec 2010 20:22:53 -0500	[thread overview]
Message-ID: <1291944177-7819-19-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1291944177-7819-1-git-send-email-iisaman@netapp.com>

This makes way for adding roc bit to lseg

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/pnfs.c |   18 ++++++++++--------
 fs/nfs/pnfs.h |    6 +++++-
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 27a1973..69f5e7b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -276,7 +276,7 @@ init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)
 	INIT_LIST_HEAD(&lseg->fi_list);
 	atomic_set(&lseg->pls_refcount, 1);
 	smp_mb();
-	lseg->valid = true;
+	set_bit(NFS_LSEG_VALID, &lseg->pls_flags);
 	lseg->layout = lo;
 	lseg->pls_notify_count = 0;
 }
@@ -286,7 +286,7 @@ _put_lseg_common(struct pnfs_layout_segment *lseg)
 {
 	struct inode *ino = lseg->layout->inode;
 
-	BUG_ON(lseg->valid == true);
+	BUG_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
 	list_del(&lseg->fi_list);
 	if (list_empty(&lseg->layout->segs)) {
 		struct nfs_client *clp;
@@ -309,7 +309,8 @@ put_lseg_locked(struct pnfs_layout_segment *lseg,
 		struct list_head *tmp_list)
 {
 	dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg,
-		atomic_read(&lseg->pls_refcount), lseg->valid);
+		atomic_read(&lseg->pls_refcount),
+		test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
 	if (atomic_dec_and_test(&lseg->pls_refcount)) {
 		_put_lseg_common(lseg);
 		list_add(&lseg->fi_list, tmp_list);
@@ -325,7 +326,8 @@ put_lseg(struct pnfs_layout_segment *lseg)
 		return;
 
 	dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg,
-		atomic_read(&lseg->pls_refcount), lseg->valid);
+		atomic_read(&lseg->pls_refcount),
+		test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
 	ino = lseg->layout->inode;
 	if (atomic_dec_and_lock(&lseg->pls_refcount, &ino->i_lock)) {
 		int count = lseg->pls_notify_count;
@@ -363,8 +365,7 @@ static void mark_lseg_invalid(struct pnfs_layout_segment *lseg,
 			      struct list_head *tmp_list)
 {
 	assert_spin_locked(&lseg->layout->inode->i_lock);
-	if (lseg->valid) {
-		lseg->valid = false;
+	if (test_and_clear_bit(NFS_LSEG_VALID, &lseg->pls_flags)) {
 		/* Remove the reference keeping the lseg in the
 		 * list.  It will now be removed when all
 		 * outstanding io is finished.
@@ -809,7 +810,8 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
 
 	assert_spin_locked(&lo->inode->i_lock);
 	list_for_each_entry(lseg, &lo->segs, fi_list) {
-		if (lseg->valid && is_matching_lseg(lseg, range)) {
+		if (test_bit(NFS_LSEG_VALID, &lseg->pls_flags) &&
+		    is_matching_lseg(lseg, range)) {
 			get_lseg(lseg);
 			ret = lseg;
 			break;
@@ -820,7 +822,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
 
 	dprintk("%s:Return lseg %p ref %d valid %d\n",
 		__func__, ret, ret ? atomic_read(&ret->pls_refcount) : 0,
-		ret ? ret->valid : 0);
+		ret ? test_bit(NFS_LSEG_VALID, &ret->pls_flags) : 0);
 	return ret;
 }
 
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index b5a30b8..82b9a7e 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -33,11 +33,15 @@
 #include <linux/nfs_page.h>
 #include "callback.h" /* for cb_layoutrecallargs */
 
+enum {
+	NFS_LSEG_VALID = 0,	/* cleared when lseg is recalled/returned */
+};
+
 struct pnfs_layout_segment {
 	struct list_head fi_list;
 	struct pnfs_layout_range range;
 	atomic_t pls_refcount;
-	bool valid;
+	unsigned long pls_flags;
 	struct pnfs_layout_hdr *layout;
 	int pls_notify_count;
 };
-- 
1.7.2.1


  parent reply	other threads:[~2010-12-10  6:08 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10  1:22 [PATCH 00/22] pnfs more wave2 patches Fred Isaman
2010-12-10  1:22 ` [PATCH 01/22] Revert "pnfs-submit: handle NFS4ERR_DELEG_REVOKED for LAYOUTRETURN" Fred Isaman
2010-12-10  1:22 ` [PATCH 02/22] Revert "SQUASHME: pnfs-submit: encode layoutreturn on close before close" Fred Isaman
2010-12-10  1:22 ` [PATCH 03/22] Revert "SQUASHME: make roc patches compile without v4.1" Fred Isaman
2010-12-10  1:22 ` [PATCH 04/22] Revert "pnfs_submit: roc add layoutcommit op to close compound" Fred Isaman
2010-12-10  1:22 ` [PATCH 05/22] Revert "pnfs-submit refactor pnfs_layoutcommit_setup" Fred Isaman
2010-12-10  1:22 ` [PATCH 06/22] Revert "pnfs-submit refactor layoutcommit xdr structures" Fred Isaman
2010-12-10  1:22 ` [PATCH 07/22] Revert "pnfs-submit: roc add layoutreturn op to close compound" Fred Isaman
2010-12-10  1:22 ` [PATCH 08/22] Revert "FIXME: NFS: clear fsinfo before sendign rpc" Fred Isaman
2010-12-10  1:22 ` [PATCH 09/22] SQUASHME onto "pnfs_submit: cb_layoutrecall": revert pointless reordering Fred Isaman
2010-12-10  1:22 ` [PATCH 10/22] pnfs-submit: wave4: fix bug dealing with commit split between DS and MDS Fred Isaman
2010-12-10  1:22 ` [PATCH 11/22] pnfs-submit: wave2: NFS4ERR_RESOURCE is not a valid error for CB_LAYOUTRECALL Fred Isaman
2010-12-10  1:22 ` [PATCH 12/22] pnfs-submit: wave2: rewrite validate_bitmap_values to obey spec Fred Isaman
2010-12-15 13:57   ` Benny Halevy
2010-12-15 14:11     ` Fred Isaman
2010-12-15 15:29       ` Benny Halevy
2010-12-15 15:43         ` Fred Isaman
2010-12-15 15:56           ` Benny Halevy
2010-12-15 15:59             ` Fred Isaman
2010-12-15 16:48               ` Benny Halevy
2010-12-10  1:22 ` [PATCH 13/22] pnfs-submit: wave2: check that partial LAYOUTGET return is ignored Fred Isaman
2010-12-10  1:22 ` [PATCH 14/22] pnfs-submit: wave2: Don't wait in layoutget Fred Isaman
2010-12-10  1:22 ` [PATCH 15/22] pnfs-submit: wave2: Pull out all recall initiated LAYOUTRETURNS Fred Isaman
2010-12-10  1:22 ` [PATCH 16/22] pnfs-submit: wave2: remove cl_layoutrecalls list Fred Isaman
2010-12-10  1:22 ` [PATCH 17/22] pnfs-submit: wave2: change plh_outstanding to atomic_t Fred Isaman
2010-12-10  1:22 ` Fred Isaman [this message]
2010-12-10  1:22 ` [PATCH 19/22] pnfs-submit: wave2: Remove LAYOUTRETURN from return on close Fred Isaman
2010-12-10  1:22 ` [PATCH 20/22] pnfs-submit: wave2: remove all LAYOUTRETURN code Fred Isaman
2010-12-16 12:47   ` Boaz Harrosh
2010-12-16 14:04     ` Fred Isaman
2010-12-10  1:22 ` [PATCH 21/22] SQUASHME: pnfs: filelayout: call print_ds under ifdebug(FACILITY) Fred Isaman
2010-12-10  1:22 ` [PATCH 22/22] pnfs-submit: Turn off layoutcommits Fred Isaman
2010-12-16 12:47   ` Boaz Harrosh
2010-12-16 14:13     ` Fred Isaman
2010-12-16 14:49       ` Boaz Harrosh

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=1291944177-7819-19-git-send-email-iisaman@netapp.com \
    --to=iisaman@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).