[pnfs] [PATCH] Increase maximum buffer size for layouts to 4 KB

Benny Halevy bhalevy at panasas.com
Tue Dec 12 07:58:00 EST 2006


How does the following look for a start?

diff -rup a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
--- a/fs/nfs/nfs4xdr.c  2006-12-12 11:53:35.000000000 +0200
+++ b/fs/nfs/nfs4xdr.c  2006-12-12 14:49:34.000000000 +0200
@@ -4658,8 +4658,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;
diff -rup a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
--- a/fs/nfs/pnfs.c     2006-12-12 11:53:35.000000000 +0200
+++ b/fs/nfs/pnfs.c     2006-12-12 14:53:29.000000000 +0200
@@ -467,6 +467,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;
 }
diff -rup a/include/linux/pnfs_xdr.h b/include/linux/pnfs_xdr.h
--- a/include/linux/pnfs_xdr.h  2006-12-12 11:53:35.000000000 +0200
+++ b/include/linux/pnfs_xdr.h  2006-12-12 14:50:28.000000000 +0200
@@ -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 {

Dean Hildebrand wrote:
> Benny Halevy wrote:
>> William A. (Andy) Adamson wrote:
>>   
>>> hi benny
>>>
>>> should be ok.
>>> are you expecting to have a large number of 4KB layouts? are you 
>>> combining a bunch of layout ranges in the 4KB layout return?
>>>     
>> not necessarily...
>> we just have big data structures.
>> are we going to keep this static?
>> If so I will check what;s the largest size we can anticipate
>>
>>
>>   
> The patch below definitely can't go in as is since 4kb layouts will need 
> to come off the heap.  I'm assuming you are using a 64 bit machine or 
> 8kb stacksize to make this patch work.
> 
> Do we want to
> a) malloc 4kb on every layoutget
> b) use a layout buffer pool
> c) malloc a buffer on every layoutget, but retrieve the size of the 
> buffer (the max layout size) from the layout driver
> d) other ways?
> 
> Dean
> 
>>   
>>> -->Andy
>>>
>>> On 11/28/06, *Benny Halevy* <bhalevy at panasas.com 
>>> <mailto:bhalevy at panasas.com>> wrote:
>>>
>>>     We need a bigger buffer size for our layouts.  Since we're
>>>     still using a statically sized buffer, is it ok with everybody
>>>     to increase its size to 4 KB as in the patch below?
>>>
>>>     Benny
>>>
>>>     Increase maximum buffer size for layouts to 4 KB.
>>>
>>>     Signed-off-by: Benny Halevy bhalevy at panasas.com
>>>     <mailto:bhalevy at panasas.com>
>>>
>>>     ==== //depot/pub/pnfs/include/linux/pnfs_xdr.h#1 -
>>>     /home/bhalevy/p4.local/pub-pnfs/include/linux/pnfs_xdr.h ====
>>>     diff -Npu /tmp/tmp.12239.0
>>>     /home/bhalevy/p4.local/pub-pnfs/include/linux/pnfs_xdr.h -L
>>>     a/include/linux/pnfs_xdr.h -L b/include/linux/pnfs_xdr.h
>>>     --- a/include/linux/pnfs_xdr.h
>>>     +++ b/include/linux/pnfs_xdr.h
>>>     @@ -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 {
>>>     _______________________________________________
>>>     pNFS mailing list
>>>     pNFS at linux-nfs.org <mailto:pNFS at linux-nfs.org>
>>>     http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>>>
>>>
>>>     
>> _______________________________________________
>> pNFS mailing list
>> pNFS at linux-nfs.org
>> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>>   
> 



More information about the pNFS mailing list