[pnfs] CVS: nfsv4

Benny Halevy Panasas bhalevy at citi.umich.edu
Tue Dec 12 04:43:43 EST 2006


CVSROOT:	/cvs
Module name:	nfsv4
Changes by:	bhalevy at citi.	2006/12/12 04:43:43

Modified files:
	cvs/pnfs/fs/nfs: nfs4xdr.c pnfs.c 
	cvs/pnfs/fs/nfsd: nfs4proc.c nfs4state.c nfs4xdr.c 
	cvs/pnfs/include/linux: pnfs_xdr.h 
	cvs/pnfs/include/linux/nfsd: nfsd4_pnfs.h 

Log message:
- fix layout_return use of layout type and return type
- reorder in-core structures to follow on-the-wire protocol

Signed-off-by: Benny Halevy bhalevy at panasas.com

Index: fs/nfs/nfs4xdr.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/nfs4xdr.c,v
retrieving revision 1.23
diff -u -p -r1.23 nfs4xdr.c
--- fs/nfs/nfs4xdr.c	28 Sep 2006 05:46:16 -0000	1.23
+++ fs/nfs/nfs4xdr.c	12 Dec 2006 09:27:17 -0000
@@ -4824,10 +4824,10 @@ static int encode_pnfs_layoutreturn(stru
WRITE32(OP_LAYOUTRETURN);
WRITE64(args->clientid);
WRITE32(args->reclaim);
-	WRITE32(args->type);
+	WRITE32(args->layout_type);
WRITE32(args->iomode);
-	WRITE32(LAYOUTRETURN_FILE);
-	if (args->type == LAYOUT_NFSV4_FILES)
+	WRITE32(args->return_type);
+	if (args->return_type == LAYOUTRETURN_FILE)
{
WRITE64(args->offset);
WRITE64(args->length);
Index: fs/nfs/pnfs.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/pnfs.c,v
retrieving revision 1.46
diff -u -p -r1.46 pnfs.c
--- fs/nfs/pnfs.c	12 Dec 2006 09:03:51 -0000	1.46
+++ fs/nfs/pnfs.c	12 Dec 2006 09:27:19 -0000
@@ -345,11 +345,12 @@ pnfs_return_layout(struct inode* ino)
dprintk("%s: Returning layout...\n", __FUNCTION__);

arg.clientid = server->nfs4_state->cl_clientid;
-	arg.type = server->pnfs_curr_ld->id;
+	arg.reclaim = 0;
+	arg.layout_type = server->pnfs_curr_ld->id;
/* FMODE_WRITE =2= LAYOUTMODE_RW,  FMODE_READ =1= LAYOUTMODE_READ */
arg.iomode = FMODE_WRITE;
+	arg.return_type = LAYOUTRETURN_FILE;
arg.offset = 0;
-	arg.reclaim = 0;
arg.length = ~0;
arg.inode = ino;

Index: fs/nfsd/nfs4proc.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfsd/nfs4proc.c,v
retrieving revision 1.23
diff -u -p -r1.23 nfs4proc.c
--- fs/nfsd/nfs4proc.c	12 Dec 2006 09:03:51 -0000	1.23
+++ fs/nfsd/nfs4proc.c	12 Dec 2006 09:27:20 -0000
@@ -908,16 +908,16 @@ nfsd4_layoutreturn( struct svc_rqst *rqs
/* check to see if requested layout type is supported. */
status = nfserr_unknown_layouttype;
if (!sb->s_export_op->layout_type ||
-		((type = sb->s_export_op->layout_type()) != lrp->lr_type)) {
+		((type = sb->s_export_op->layout_type()) != lrp->lr_layout_type)) {

-		printk("pNFS %s: requested layout type %d does not match suppored type %d\n", __FUNCTION__, lrp->lr_type, type);
+		printk("pNFS %s: requested layout type %d does not match suppored type %d\n", __FUNCTION__, lrp->lr_layout_type, type);
goto out;
}

status = nfs4_pnfs_return_layout(sb, current_fh, lrp);
out:
-	dprintk("pNFS %s: status %d type %d\n",
-		__FUNCTION__, status, lrp->lr_type);
+	dprintk("pNFS %s: status %d layout_type %d\n",
+		__FUNCTION__, status, lrp->lr_layout_type);
return status;
}

Index: fs/nfsd/nfs4state.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfsd/nfs4state.c,v
retrieving revision 1.24
diff -u -p -r1.24 nfs4state.c
--- fs/nfsd/nfs4state.c	8 Dec 2006 07:08:46 -0000	1.24
+++ fs/nfsd/nfs4state.c	12 Dec 2006 09:27:23 -0000
@@ -3411,10 +3411,11 @@ free_nfs4_layout(struct kref *kref)

dprintk("pNFS %s: lp %p fp %p ino %p\n", __FUNCTION__, lp, fp, ino);
lr.lr_reclaim = 0;
+	lr.lr_layout_type = lp->lo_layout_type;
+	lr.lr_iomode = lp->lo_iomode;
+	lr.lr_return_type = LAYOUTRETURN_FILE;
lr.lr_offset = lp->lo_offset;
lr.lr_length = lp->lo_length;
-	lr.lr_iomode = lp->lo_iomode;
-	lr.lr_type = lp->lo_layout_type;
lr.lr_flags = 0; /* last return */

//??? recall layout
@@ -3600,10 +3601,11 @@ int nfs4_pnfs_get_layout(struct super_bl
lgp->lg_ops->layout_free(lgp->lg_layout);

lr.lr_reclaim = 0;
+		lr.lr_layout_type = lgp->lg_type;
+		lr.lr_iomode = lgp->lg_iomode;
+		lr.lr_return_type = LAYOUTRETURN_FILE;
lr.lr_offset = lgp->lg_offset;
lr.lr_length = lgp->lg_length;
-		lr.lr_iomode = lgp->lg_iomode;
-		lr.lr_type = lgp->lg_type;
lr.lr_flags = lgp->lg_flags;
if (sb->s_export_op->layout_return)
sb->s_export_op->layout_return(ino, &lr);
Index: fs/nfsd/nfs4xdr.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfsd/nfs4xdr.c,v
retrieving revision 1.29
diff -u -p -r1.29 nfs4xdr.c
--- fs/nfsd/nfs4xdr.c	30 Nov 2006 16:41:17 -0000	1.29
+++ fs/nfsd/nfs4xdr.c	12 Dec 2006 09:27:25 -0000
@@ -1114,10 +1114,10 @@ nfsd4_decode_layoutreturn(struct nfsd4_c
READ_BUF(40);
COPYMEM(&lrp->lr_clientid, sizeof(clientid_t));
READ32(lrp->lr_reclaim);
-	READ32(lrp->lr_type);
+	READ32(lrp->lr_layout_type);
READ32(lrp->lr_iomode);
-	READ32(lrp->lr_file);
-	if (lrp->lr_type == LAYOUT_NFSV4_FILES)
+	READ32(lrp->lr_return_type);
+	if (lrp->lr_return_type == LAYOUTRETURN_FILE)
{
READ64(lrp->lr_offset);
READ64(lrp->lr_length);
Index: include/linux/pnfs_xdr.h
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/include/linux/pnfs_xdr.h,v
retrieving revision 1.11
diff -u -p -r1.11 pnfs_xdr.h
--- include/linux/pnfs_xdr.h	31 Aug 2006 18:23:33 -0000	1.11
+++ include/linux/pnfs_xdr.h	12 Dec 2006 09:27:38 -0000
@@ -90,11 +90,12 @@ struct pnfs_layoutcommit_data {

struct nfs4_pnfs_layoutreturn_arg {
__u64	clientid;
+	__u32	reclaim;
+	__u32	layout_type;
+	__u32	iomode;
+	__u32   return_type;
__u64	offset;
__u64	length;
-	__u32	iomode;
-	__u32	reclaim;
-	__u32	type;
struct inode* inode;
};

Index: include/linux/nfsd/nfsd4_pnfs.h
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/include/linux/nfsd/nfsd4_pnfs.h,v
retrieving revision 1.8
diff -u -p -r1.8 nfsd4_pnfs.h
--- include/linux/nfsd/nfsd4_pnfs.h	6 Dec 2006 23:15:21 -0000	1.8
+++ include/linux/nfsd/nfsd4_pnfs.h	12 Dec 2006 09:27:39 -0000
@@ -111,12 +111,12 @@ struct nfsd4_pnfs_layoutcommit {

struct nfsd4_pnfs_layoutreturn {
u64				lr_clientid;	/* request */
+	u32				lr_reclaim;	/* request */
+	u32				lr_layout_type;	/* request */
+	u32				lr_iomode;	/* request */
+	u32				lr_return_type;	/* request */
u64				lr_offset;	/* request */
u64				lr_length;	/* request */
-	u32				lr_iomode;	/* request */
-	u32				lr_file;	/* request */
-	u32				lr_reclaim;	/* request */
-	u32				lr_type;	/* request */
u32				lr_flags;
};



More information about the pNFS mailing list