From 0162933589d025ca1812e159368d107cfc355e8e Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Thu, 17 Oct 2013 16:17:54 +0530 Subject: gNFS: Make NFS I/O size to 1MB by default For better NFS performance, make the default I/O size to 1MB, same as kernel NFS. Also refactor the description for read-size, write-size and readdir-size (i.e. it must be a multiple of 1KB but min value is 4KB and max supported value is 1MB). On slower network, rsize/wsize can be adjusted to 16/32/64-KB through nfs.read-size or nfs.write-size respectively. Change-Id: I142cff1c3644bb9f93188e4e890478177c9465e3 BUG: 1009223 Signed-off-by: Santosh Kumar Pradhan Reviewed-on: http://review.gluster.org/6103 Tested-by: Gluster Build System Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Anand Avati --- xlators/nfs/server/src/nfs3.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'xlators/nfs/server/src/nfs3.c') diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 1754b5e8a..afb5ba332 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -5137,6 +5137,33 @@ rpcsvc_program_t nfs3prog = { .min_auth = AUTH_NULL, }; +/* + * This function rounds up the input value to multiple of 4096. If the + * value is same as default, then its a NO-OP. Default is already a + * multiple of 4096. Min and Max supported I/O size limits are + * 4KB (GF_NFS3_FILE_IO_SIZE_MIN) and 1MB (GF_NFS3_FILE_IO_SIZE_MAX). + */ +static void +nfs3_iosize_roundup_4KB (size_t *iosz, size_t iodef) +{ + size_t iosize = *iosz; + size_t iopages; + + if (iosize == iodef) + return; + + iopages = (iosize + GF_NFS3_IO_SIZE -1) >> GF_NFS3_IO_SHIFT; + iosize = iopages * GF_NFS3_IO_SIZE; + + /* Double check - boundary conditions */ + if (iosize < GF_NFS3_FILE_IO_SIZE_MIN) { + iosize = GF_NFS3_FILE_IO_SIZE_MIN; + } else if (iosize > GF_NFS3_FILE_IO_SIZE_MAX) { + iosize = GF_NFS3_FILE_IO_SIZE_MAX; + } + + *iosz = iosize; +} int nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) @@ -5168,6 +5195,7 @@ nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) goto err; } } + nfs3_iosize_roundup_4KB (&nfs3->readsize, GF_NFS3_RTPREF); /* nfs3.write-size */ nfs3->writesize = GF_NFS3_WTPREF; @@ -5189,6 +5217,7 @@ nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) goto err; } } + nfs3_iosize_roundup_4KB (&nfs3->writesize, GF_NFS3_WTPREF); /* nfs3.readdir.size */ nfs3->readdirsize = GF_NFS3_DTPREF; @@ -5210,6 +5239,7 @@ nfs3_init_options (struct nfs3_state *nfs3, xlator_t *nfsx) goto err; } } + nfs3_iosize_roundup_4KB (&nfs3->readdirsize, GF_NFS3_DTPREF); /* We want to use the size of the biggest param for the io buffer size. -- cgit