[pnfs] [PATCH 1/5] cleanup: nfs client CONFIG_PNFS

Benny Halevy bhalevy at panasas.com
Thu Aug 30 06:51:50 EDT 2007


Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/inode.c            |   14 ++++++++------
 fs/nfs/read.c             |    2 +-
 fs/nfs/super.c            |   10 +++++-----
 fs/nfs/write.c            |    2 +-
 include/linux/nfs_fs.h    |    2 ++
 include/linux/nfs_fs_sb.h |    2 ++
 6 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index a3ea1ce..3caae18 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -905,7 +905,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			&& !nfs_fsid_equal(&server->fsid, &fattr->fsid))
 		server->fsid = fattr->fsid;
 
-#ifdef CONFIG_NFS_V4 /* XXX CONFIG_PNFS */
+#ifdef CONFIG_PNFS
 	/*
 	 * file needs layout commit, server attributes may be stale
 	 */
@@ -914,7 +914,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 		        __FUNCTION__, inode->i_sb->s_id, inode->i_ino);
 		return 0;
 	}
-#endif /* CONFIG_NFS_V4 */
+#endif /* CONFIG_PNFS */
 
 	/*
 	 * Update the read time so we don't revalidate too often.
@@ -937,16 +937,16 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 		if (nfsi->npages == 0) {
 			/* No, but did we race with nfs_end_data_update()? */
 			if (data_stable) {
-#ifdef CONFIG_NFS_V4 /* XXX CONFIG_PNFS */
+#ifdef CONFIG_PNFS
 				/* File could be have been updated by other pnfs clients */
 				if (!nfsi->layoutcommit_ctx || new_isize > cur_isize) {
 				inode->i_size = new_isize;
 				invalid |= NFS_INO_INVALID_DATA;
 			}
-#else /* CONFIG_NFS_V4 */
+#else /* CONFIG_PNFS */
 				inode->i_size = new_isize;
 				invalid |= NFS_INO_INVALID_DATA;
-#endif /* CONFIG_NFS_V4 */
+#endif /* CONFIG_PNFS */
 			}
 			invalid |= NFS_INO_INVALID_ATTR;
 		} else if (new_isize > cur_isize) {
@@ -1108,11 +1108,13 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
 	nfsi->acl_access = ERR_PTR(-EAGAIN);
 	nfsi->acl_default = ERR_PTR(-EAGAIN);
 #endif
-#ifdef CONFIG_NFS_V4 /* XXX CONFIG_PNFS */
+#ifdef CONFIG_NFS_V4
 	nfsi->nfs4_acl = NULL;
+#ifdef CONFIG_PNFS
 	nfsi->pnfs_layout_state = 0;
 	nfsi->current_layout = NULL;
 	nfsi->layoutcommit_ctx = NULL;
+#endif /* CONFIG_PNFS */
 #endif /* CONFIG_NFS_V4 */
 	return &nfsi->vfs_inode;
 }
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index c03399b..f3a6976 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -899,7 +899,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
 	ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc);
 	if (!list_empty(&head)) {
 		int err;
-		#ifdef CONFIG_NFS_V4
+		#ifdef CONFIG_PNFS
 			struct nfs_page *first_page, *last_page;
 			loff_t offset;
 			size_t count;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c076c8b..09f3d65 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -592,7 +592,7 @@ nfs_sb_init(struct super_block *sb, rpc_authflavor_t authflavor)
 	    server->rpc_ops->pathconf(server, &server->fh, &pathinfo) >= 0)
 		server->namelen = pathinfo.max_namelen;
 
-#ifdef CONFIG_NFS_V4 /* XXX CONFIG_PNFS */
+#ifdef CONFIG_PNFS
 	/* XXX: This should probably be in nfs4_fill_super, or some nfsv4
 	 * specific routine, rather than have such a lame fencing off
 	 */
@@ -609,10 +609,10 @@ nfs_sb_init(struct super_block *sb, rpc_authflavor_t authflavor)
 					(server->ds_rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 		}
 	}
-#else
+#else /* CONFIG_PNFS */
 	server->pnfs_curr_ld = NULL;
 	server->pnfs_mountid = NULL;
-#endif
+#endif /* CONFIG_PNFS */
 
 	/* Work out a lot of parameters */
 	if (server->rsize == 0)
@@ -638,7 +638,7 @@ nfs_sb_init(struct super_block *sb, rpc_authflavor_t authflavor)
 		server->wsize = NFS_MAX_FILE_IO_SIZE;
 	server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
-#ifdef CONFIG_NFS_V4 /* XXX CONFIG_PNFS */
+#ifdef CONFIG_PNFS
 	/* Fix up data server values if there is no layout driver or
 	* the layout driver doesn't define its own blocksize
 	*/
@@ -649,7 +649,7 @@ nfs_sb_init(struct super_block *sb, rpc_authflavor_t authflavor)
 		server->ds_rpages = server->rpages;
 		server->ds_wpages = server->wpages;
 	}
-#endif
+#endif /* CONFIG_PNFS */
 
 	if (sb->s_blocksize == 0)
 		sb->s_blocksize = nfs_block_bits(server->wsize,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b46c050..f8a3e37 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1814,7 +1814,7 @@ int nfs_sync_inode_wait(struct inode *inode, unsigned long idx_start,
 			if (how & FLUSH_INVALIDATE)
 				nfs_cancel_dirty_list(&head);
 			else {
-				#ifdef CONFIG_NFS_V4
+				#ifdef CONFIG_PNFS
 					/* Check if we have a layout cached. If not, get
 					 * one
 					 */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index a3a2ac3..0885b5b 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -173,6 +173,7 @@ struct nfs_inode {
 	struct rw_semaphore	rwsem;
 
 	/* pNFS layout information */
+#ifdef CONFIG_PNFS
 	u32 pnfs_layout_state;
 #define NFS_INO_LAYOUT_FAILED	0x0001	/* get layout failed, stop trying */
 	time_t pnfs_layout_suspend;
@@ -184,6 +185,7 @@ struct nfs_inode {
 	 */
 	loff_t                  pnfs_write_begin_pos;
 	loff_t                  pnfs_write_end_pos;
+#endif /* CONFIG_PNFS */
 #endif /* CONFIG_NFS_V4*/
 	struct inode		vfs_inode;
 };
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3daa212..6e97206 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -54,10 +54,12 @@ struct nfs_server {
 	u32			acl_bitmask;	/* V4 bitmask representing the ACEs
 						   that are supported on this
 						   filesystem */
+#ifdef CONFIG_PNFS
 	struct pnfs_layoutdriver_type *	pnfs_curr_ld;  /* Active layout driver */
 	struct pnfs_mount_type        * pnfs_mountid;  /* Mount identifier for
 							  layout driver
 						       */
+#endif
 	/* Data server values will equal NFS server values if
 	 * no pNFS layout driver exists for the mountpoint
 	 */
-- 
1.5.2.5



More information about the pNFS mailing list