[pnfs] [PATCH 1/4 v2] deviceid64: nfs client

Benny Halevy bhalevy at panasas.com
Mon Aug 6 03:22:46 EDT 2007


change deviceid from u32 to u64

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/nfs4proc.c         |    6 +++---
 fs/nfs/nfs4xdr.c          |   12 ++++++------
 fs/nfs/pnfs.c             |    4 ++--
 include/linux/nfs4_pnfs.h |   14 ++++++++------
 include/linux/nfs_page.h  |    3 ++-
 include/linux/pnfs_xdr.h  |    2 +-
 6 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0a568a4..ca091cd 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2413,7 +2413,7 @@ int nfs4_pnfs_getdevicelist(struct nfs_server *server,
 /* DH: Retrieve information for a particular storage device.
  */
 static int _nfs4_pnfs_getdeviceinfo(struct nfs_server *server,
-				    u32 dev_id,
+				    pnfs_deviceid_t dev_id,
 				    struct pnfs_device *dev)
 {
 	struct nfs4_pnfs_getdeviceinfo_arg args = {
@@ -2461,7 +2461,7 @@ out:
 }
 
 int nfs4_pnfs_getdeviceinfo(struct nfs_server *server,
-			    u32 dev_id,
+			    pnfs_deviceid_t dev_id,
 			    struct pnfs_device* res)
 {
 	struct nfs4_exception exception = { };
@@ -2472,7 +2472,7 @@ int nfs4_pnfs_getdeviceinfo(struct nfs_server *server,
 					    &exception);
 	} while (exception.retry);
 
-	dprintk("nfs4_pnfs_getdevinfo: err=%d dev_id=%d\n", err, dev_id);
+	dprintk("nfs4_pnfs_getdevinfo: err=%d dev_id=0x%llx\n", err, dev_id);
 
 	return err;
 }
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 2e5a8a7..dfcbc4b 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -174,7 +174,7 @@ static int nfs_stat_to_errno(int);
                                     (NFS4_VERIFIER_SIZE >> 2))
 #define decode_getdevicelist_maxsz (op_decode_hdr_maxsz + 5 + 2 +      \
                                    NFS4_PNFS_DEV_MAXCOUNT*NFS4_PNFS_DEV_MAXSIZE)
-#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 2)
+#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 3)
 #define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + 3 + \
                                     NFS4_PNFS_DEV_MAXSIZE)
 #endif /* CONFIG_PNFS */
@@ -1622,9 +1622,9 @@ static int encode_getdevicelist(struct xdr_stream *xdr, const struct nfs4_pnfs_g
 static int encode_getdeviceinfo(struct xdr_stream *xdr, const struct nfs4_pnfs_getdeviceinfo_arg *args)
 {
         uint32_t *p;
-        RESERVE_SPACE(16);
+        RESERVE_SPACE(20);
         WRITE32(OP_GETDEVICEINFO);
-        WRITE32(args->dev_id);
+        WRITE64(args->dev_id);
         WRITE32(args->layoutclass);
         WRITE32(NFS4_PNFS_DEV_MAXSIZE);
         return 0;
@@ -4936,12 +4936,12 @@ static int decode_getdevicelist(struct xdr_stream *xdr, struct pnfs_devicelist *
 
         for (i = 0,cnt=0; i < res->num_devs && cnt < NFS4_PNFS_DEV_MAXCOUNT; i++)
         {
-                READ_BUF(4);
-                READ32(res->devs[cnt].dev_id);	/* device id */
+                READ_BUF(8);
+                READ64(res->devs[cnt].dev_id);	/* device id */
                 READ_BUF(4);			/* skip layout type */
                 READ_BUF(4);
                 READ32(len);
-                dprintk("%s: num_dev %d i %d cnt %d id %d len %d\n",
+                dprintk("%s: num_dev %d i %d cnt %d id 0x%llx len %d\n",
                         __FUNCTION__, res->num_devs, i, cnt,
                         res->devs[cnt].dev_id, len);
 
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index feb3c80..7f1addf 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -55,7 +55,7 @@
 
 extern int nfs_fsync(struct file *file, struct dentry *dentry, int datasync);
 extern int nfs4_pnfs_getdevicelist(struct nfs_server *server, struct pnfs_devicelist* devlist);
-extern int nfs4_pnfs_getdeviceinfo(struct nfs_server *server, u32 dev_id, struct pnfs_device *res);
+extern int nfs4_pnfs_getdeviceinfo(struct nfs_server *server, pnfs_deviceid_t dev_id, struct pnfs_device *res);
 extern void nfs_execute_write(struct nfs_write_data *data);
 extern void nfs_commit_rpcsetup(struct nfs_write_data *data, int sync);
 
@@ -1258,7 +1258,7 @@ pnfs_getdevicelist(struct super_block *sb, struct pnfs_devicelist* devlist)
 /* Retrieve the device information for a device.
  */
 int
-pnfs_getdeviceinfo(struct super_block *sb, u32 dev_id, struct pnfs_device* dev)
+pnfs_getdeviceinfo(struct super_block *sb, pnfs_deviceid_t dev_id, struct pnfs_device* dev)
 {
 	struct nfs_server *server = NFS_SB(sb);
 	int rc;
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 74d25fd..f2c8cff 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -119,13 +119,15 @@ struct pnfs_layoutdriver_type {
 	struct layoutdriver_policy_operations *ld_policy_ops;
 };
 
+typedef u64 pnfs_deviceid_t;
+
 struct pnfs_device
 {
-	int           dev_id;
-	int           dev_type;
-	unsigned int  dev_count;
-	unsigned int  dev_addr_len;
-	char          dev_addr_buf[NFS4_PNFS_DEV_MAXSIZE];
+	pnfs_deviceid_t     dev_id;
+	int                 dev_type;
+	unsigned int        dev_count;
+	unsigned int        dev_addr_len;
+	char                dev_addr_buf[NFS4_PNFS_DEV_MAXSIZE];
 };
 
 struct pnfs_devicelist {
@@ -143,7 +145,7 @@ struct pnfs_devicelist {
 struct pnfs_client_operations {
 	int (*nfs_fsync) (struct file * file, struct dentry * dentry, int datasync);
 	int (*nfs_getdevicelist) (struct super_block * sb, struct pnfs_devicelist* devlist);
-	int (*nfs_getdeviceinfo) (struct super_block * sb, u32 dev_id, struct pnfs_device * dev);
+	int (*nfs_getdeviceinfo) (struct super_block * sb, u64 dev_id, struct pnfs_device * dev);
 
         /* Post read callback.  Layout driver calls this function if unstable data was
 	 * written and requires a commit call
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 58c932a..4019972 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -15,6 +15,7 @@
 #include <linux/wait.h>
 #include <linux/sunrpc/auth.h>
 #include <linux/nfs_xdr.h>
+#include <linux/nfs4_pnfs.h>
 
 #include <asm/atomic.h>
 
@@ -45,7 +46,7 @@ struct nfs_page {
 	atomic_t		wb_count;	/* reference count */
 	unsigned long		wb_flags;
 	struct nfs_writeverf	wb_verf;	/* Commit cookie */
-	unsigned int		wb_devid;	/* pNFS data server id */
+	pnfs_deviceid_t		wb_devid;	/* pNFS data server id */
 };
 
 #define NFS_WBACK_BUSY(req)	(test_bit(PG_BUSY,&(req)->wb_flags))
diff --git a/include/linux/pnfs_xdr.h b/include/linux/pnfs_xdr.h
index 09aa69e..07d402d 100644
--- a/include/linux/pnfs_xdr.h
+++ b/include/linux/pnfs_xdr.h
@@ -121,7 +121,7 @@ struct nfs4_pnfs_getdevicelist_res {
 struct nfs4_pnfs_getdeviceinfo_arg {
 	const struct nfs_fh *            fh;
 	u32                              layoutclass;
-	u32                              dev_id;
+	u64                              dev_id;
 	void 				*minorversion_info;
 };
 
-- 
1.5.2.86.g99b5




More information about the pNFS mailing list