[pnfs] [PATCH 1/3] layout_return and return_on_close
Benny Halevy
bhalevy at panasas.com
Tue Nov 28 03:21:49 EST 2006
- 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
diff -x CVS -urp a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
--- a/fs/nfs/nfs4xdr.c 2006-11-16 09:38:24.000000000 +0200
+++ b/fs/nfs/nfs4xdr.c 2006-11-27 18:15:25.000000000 +0200
@@ -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);
diff -x CVS -urp a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
--- a/fs/nfs/pnfs.c 2006-11-27 11:36:09.000000000 +0200
+++ b/fs/nfs/pnfs.c 2006-11-27 18:15:33.000000000 +0200
@@ -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;
diff -x CVS -urp a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c 2006-11-27 13:55:07.000000000 +0200
+++ b/fs/nfsd/nfs4proc.c 2006-11-27 18:15:25.000000000 +0200
@@ -931,9 +931,9 @@ 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;
}
@@ -949,8 +949,8 @@ nfsd4_layoutreturn( struct svc_rqst *rqs
status =
sb->s_export_op->layout_return(current_fh->fh_dentry->d_inode,
(void *)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;
}
diff -x CVS -urp a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
--- a/fs/nfsd/nfs4xdr.c 2006-09-25 11:34:14.000000000 +0300
+++ b/fs/nfsd/nfs4xdr.c 2006-11-27 18:15:25.000000000 +0200
@@ -1114,10 +1114,10 @@ nfsd4_decode_layoutreturn(struct nfsd4_c
READ_BUF(40);
READ64(lrp->lr_clientid);
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);
diff -x CVS -urp a/include/linux/nfsd/nfsd4_pnfs.h
b/include/linux/nfsd/nfsd4_pnfs.h
--- a/include/linux/nfsd/nfsd4_pnfs.h 2006-09-01 01:44:19.000000000 +0300
+++ b/include/linux/nfsd/nfsd4_pnfs.h 2006-11-27 18:15:26.000000000 +0200
@@ -110,12 +110,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 */
};
struct layout_return {
diff -x CVS -urp a/include/linux/pnfs_xdr.h b/include/linux/pnfs_xdr.h
--- a/include/linux/pnfs_xdr.h 2006-11-27 11:06:50.000000000 +0200
+++ b/include/linux/pnfs_xdr.h 2006-11-27 18:15:35.000000000 +0200
@@ -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;
};
More information about the pNFS
mailing list