[pnfs] [PATCH 1/6] 2.6-latest pnfs client send fs_layout_types attribute

andros at umich.edu andros at umich.edu
Fri Oct 19 14:13:17 EDT 2007


From: Andy Adamson <andros at umich.edu>

Add CONFIG_PNFS around FATTR4_WORD1_FS_LAYOUT_TYPES
Create a new fsinfo for pNFS

Signed-off by: Andy Adamson<andros at umich.edu>
---
 fs/nfs/nfs4_fs.h  |    3 +++
 fs/nfs/nfs4proc.c |   10 +++++++++-
 fs/nfs/nfs4xdr.c  |   31 +++++++++++++++++++++++++++++--
 3 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 885231b..1a0f0a3 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -206,6 +206,9 @@ extern const u32 nfs4_fattr_bitmap[2];
 extern const u32 nfs4_statfs_bitmap[2];
 extern const u32 nfs4_pathconf_bitmap[2];
 extern const u32 nfs4_fsinfo_bitmap[2];
+#ifdef CONFIG_PNFS
+extern const u32 nfs4_pnfs_fsinfo_bitmap[2];
+#endif /* CONFIG_PNFS */
 extern const u32 nfs4_fs_locations_bitmap[2];
 
 /* nfs4renewd.c */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 396a165..d2dcd0f 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -127,12 +127,20 @@ const u32 nfs4_pathconf_bitmap[2] = {
 	0
 };
 
-const u32 nfs4_fsinfo_bitmap[2] = { FATTR4_WORD0_MAXFILESIZE
+#ifdef CONFIG_PNFS
+const u32 nfs4_pnfs_fsinfo_bitmap[2] = { FATTR4_WORD0_MAXFILESIZE
 			| FATTR4_WORD0_MAXREAD
 			| FATTR4_WORD0_MAXWRITE
 			| FATTR4_WORD0_LEASE_TIME,
 			FATTR4_WORD1_FS_LAYOUT_TYPES
 };
+#endif /* CONFIG_PNFS */
+
+const u32 nfs4_fsinfo_bitmap[2] = { FATTR4_WORD0_MAXFILESIZE
+			| FATTR4_WORD0_MAXREAD
+			| FATTR4_WORD0_MAXWRITE
+			| FATTR4_WORD0_LEASE_TIME
+};
 
 const u32 nfs4_fs_locations_bitmap[2] = {
 	FATTR4_WORD0_TYPE
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 6af10bd..2f426c0 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1041,6 +1041,14 @@ static int encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask)
 			bitmask[1] & nfs4_fsinfo_bitmap[1]);
 }
 
+#ifdef CONFIG_PNFS
+static int encode_pnfs_fsinfo(struct xdr_stream *xdr, const u32* bitmask)
+{
+	return encode_getattr_two(xdr, bitmask[0] & nfs4_fsinfo_bitmap[0],
+			bitmask[1] & nfs4_pnfs_fsinfo_bitmap[1]);
+}
+#endif /* CONFIG_PNFS */
+
 static int encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask)
 {
 	return encode_getattr_two(xdr,
@@ -2891,6 +2899,18 @@ static int nfs4_xdr_enc_fsinfo(struct xdr_stream *xdr, struct nfs4_fsinfo_arg *a
 	return status;
 }
 
+#ifdef CONFIG_PNFS
+static int nfs4_xdr_enc_pnfs_fsinfo(struct xdr_stream *xdr, struct nfs4_fsinfo_arg *args)
+{
+	int status;
+
+	status = encode_putfh(xdr, args->fh);
+	if (!status)
+		status = encode_pnfs_fsinfo(xdr, args->bitmask);
+	return status;
+}
+#endif /* CONFIG_PNFS */
+
 static int nfs40_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsinfo_arg *args)
 {
 	struct xdr_stream xdr;
@@ -2916,7 +2936,11 @@ static int nfs41_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsi
 	encode_compound_hdr(&xdr, &hdr, 1);
 	encode_sequence(&xdr, &args->seq_args);
 
+#ifdef CONFIG_PNFS
+	return nfs4_xdr_enc_pnfs_fsinfo(&xdr, args);
+#else
 	return nfs4_xdr_enc_fsinfo(&xdr, args);
+#endif /* CONFIG_PNFS */
 }
 #endif
 
@@ -4166,7 +4190,7 @@ static int verify_attr_len(struct xdr_stream *xdr, __be32 *savep, uint32_t attrl
 	}
 	return 0;
 }
-
+#ifdef CONFIG_PNFS
 /*
  * Decode potentially multiple layout types. Currently we only support
  * one layout driver per file system.
@@ -4212,6 +4236,7 @@ static int decode_attr_pnfstype(struct xdr_stream *xdr, uint32_t *bitmap, uint32
         }
         return status;
 }
+#endif /* CONFIG_PNFS */
 
 static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
 {
@@ -4463,8 +4488,10 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
 	if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0)
 		goto xdr_error;
 	fsinfo->wtpref = fsinfo->wtmax;
+#ifdef CONFIG_PNFS
 	if ((status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layoutclass)) != 0)
-	goto xdr_error;
+		goto xdr_error;
+#endif /* CONFIG_PNFS */
 
 	status = verify_attr_len(xdr, savep, attrlen);
 xdr_error:
-- 
1.5.0.2



More information about the pNFS mailing list