[pnfs] [PATCH 2/7] pnfs: make pnfs_layout_state flags consistent

Fred Isaman iisaman at citi.umich.edu
Mon Jun 9 16:29:03 EDT 2008


The pnfs_layout_state flags defined by NFS_INO_LAYOUT_* were
used inconsistently, some as bit numbers and some as bitmasks.
Since wait_on_bit_lock requires bit numbers, define all the flags
as bit numbers and use them accordingly.

Signed-off-by: Fred Isaman <iisaman at citi.umich.edu>
---
 fs/nfs/pnfs.c          |    7 ++++---
 include/linux/nfs_fs.h |    4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index f910033..cac9675 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -941,11 +941,12 @@ pnfs_update_layout(struct inode *ino,
 	}
 
 	/* if get layout already failed once goto out */
-	if (nfsi->pnfs_layout_state & NFS_INO_LAYOUT_FAILED) {
+	if (test_bit(NFS_INO_LAYOUT_FAILED, &nfsi->pnfs_layout_state)) {
 		if (unlikely(nfsi->pnfs_layout_suspend &&
 		    get_seconds() >= nfsi->pnfs_layout_suspend)) {
 			dprintk("%s: layout_get resumed\n", __func__);
-			nfsi->pnfs_layout_state &= ~NFS_INO_LAYOUT_FAILED;
+			clear_bit(NFS_INO_LAYOUT_FAILED,
+				  &nfsi->pnfs_layout_state);
 			nfsi->pnfs_layout_suspend = 0;
 		} else {
 			result = 1;
@@ -1043,7 +1044,7 @@ pnfs_get_layout_done(struct pnfs_layout_type *lo,
 get_out:
 	/* remember that get layout failed and don't try again */
 	if (lgp->status < 0)
-		nfsi->pnfs_layout_state |= NFS_INO_LAYOUT_FAILED;
+		set_bit(NFS_INO_LAYOUT_FAILED, &nfsi->pnfs_layout_state);
 	spin_unlock(&nfsi->lo_lock);
 
 	/* Done processing layoutget. Set the layout stateid */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index ad61cb7..fdf163d 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -180,8 +180,8 @@ struct nfs_inode {
 	struct list_head	lo_inodes;
 
 	unsigned long pnfs_layout_state;
-#define NFS_INO_LAYOUT_FAILED	0x0001	/* get layout failed, stop trying */
-#define NFS_INO_LAYOUT_ALLOC	0x0002	/* get layout failed, stop trying */
+#define NFS_INO_LAYOUT_FAILED	0	/* get layout failed, stop trying */
+#define NFS_INO_LAYOUT_ALLOC	1	/* bit lock for layout allocation */
 	time_t pnfs_layout_suspend;
 	wait_queue_head_t lo_waitq;
 	spinlock_t lo_lock;
-- 
1.5.3.3



More information about the pNFS mailing list