[pnfs] CVS: nfsv4

Benny Halevy Panasas bhalevy at citi.umich.edu
Thu Dec 14 05:47:40 EST 2006


CVSROOT:	/cvs
Module name:	nfsv4
Changes by:	bhalevy at citi.	2006/12/14 05:47:40

Modified files:
	cvs/pnfs/fs/nfs: nfs4xdr.c pnfs.c 
	cvs/pnfs/include/linux: pnfs_xdr.h 

Log message:
Increase PNFS_LAYOUT_MAXSIZE to 4K.
Move allocation of layotu buffer to xdr layer.
Temporary solution used kmalloc. Will be improved
in the future to pass a page list to the upper
layers like readdir/link/acl and friends.

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.25
diff -u -p -r1.25 nfs4xdr.c
--- fs/nfs/nfs4xdr.c	12 Dec 2006 10:02:58 -0000	1.25
+++ fs/nfs/nfs4xdr.c	14 Dec 2006 10:24:30 -0000
@@ -414,9 +414,8 @@ static int nfs_stat_to_errno(int);
#define NFS4_dec_setacl_sz	(compound_decode_hdr_maxsz + \
decode_putfh_maxsz + \
op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz)
-#define encode_pnfs_layoutget_sz (11 + op_encode_hdr_maxsz)
-#define decode_pnfs_layoutget_maxsz (7 + PNFS_LAYOUT_MAXSIZE + \
-				     op_decode_hdr_maxsz)
+#define encode_pnfs_layoutget_sz (13 + op_encode_hdr_maxsz)
+#define decode_pnfs_layoutget_maxsz (8 + op_decode_hdr_maxsz)
#define NFS4_enc_pnfs_layoutget_sz (compound_encode_hdr_maxsz + \
encode_putfh_maxsz +	\
encode_pnfs_layoutget_sz)
@@ -4658,8 +4657,9 @@ static int decode_pnfs_layoutget(struct
res->type,
res->layout.len);

-	if (res->layout.len > PNFS_LAYOUT_MAXSIZE)
-		return -EINVAL;
+	res->layout.buf = kmalloc(res->layout.len, GFP_KERNEL);
+	if (!res->layout.buf)
+		return -ENOMEM;
READ_BUF(res->layout.len);
COPYMEM(res->layout.buf, res->layout.len);
return 0;
Index: fs/nfs/pnfs.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/pnfs.c,v
retrieving revision 1.49
diff -u -p -r1.49 pnfs.c
--- fs/nfs/pnfs.c	12 Dec 2006 10:02:58 -0000	1.49
+++ fs/nfs/pnfs.c	14 Dec 2006 10:24:31 -0000
@@ -435,6 +435,7 @@ virtual_update_layout(struct inode* ino,
return 0; /* Already have layout information */
}

+	res.layout.buf = NULL;
if ((result = get_layout(ino, ctx, count, pos, iomode, &arg, &res))) {
printk("\n%s: ERROR retrieving layout %d\n",__FUNCTION__,result);
result =  -EIO;
@@ -467,6 +468,9 @@ virtual_update_layout(struct inode* ino,

result = 0;
out:
+	/* res.layout.buf kalloc'ed by the xdr decoder? */
+	if (res.layout.buf)
+		kfree(res.layout.buf);
dprintk("%s end (err:%d)\n",__FUNCTION__,result);
return result;
}
Index: include/linux//pnfs_xdr.h
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/include/linux/pnfs_xdr.h,v
retrieving revision 1.14
diff -u -p -r1.14 pnfs_xdr.h
--- include/linux//pnfs_xdr.h	12 Dec 2006 10:02:59 -0000	1.14
+++ include/linux//pnfs_xdr.h	14 Dec 2006 10:24:32 -0000
@@ -14,7 +14,7 @@

#include <linux/nfs4.h>

-#define PNFS_LAYOUT_MAXSIZE 1024
+#define PNFS_LAYOUT_MAXSIZE 4096
#define PNFS_MAX_NUM_LAYOUT_TYPES 2

enum layoutreturn_type {
@@ -25,7 +25,7 @@ enum layoutreturn_type {

struct nfs4_pnfs_layout {
__u32 len;
-	char buf[PNFS_LAYOUT_MAXSIZE];
+	void *buf;
};

enum pnfs_iomode {



More information about the pNFS mailing list