summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs3.c
diff options
context:
space:
mode:
authorSantosh Kumar Pradhan <spradhan@redhat.com>2013-10-17 16:17:54 +0530
committerAnand Avati <avati@redhat.com>2013-10-27 23:15:12 -0700
commit0162933589d025ca1812e159368d107cfc355e8e (patch)
treebe9098f225fe9777787a41d8c1a4204f03296dcf /xlators/nfs/server/src/nfs3.c
parentf42a76492463e33c56868e3569932776b14d08e8 (diff)
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 <spradhan@redhat.com> Reviewed-on: http://review.gluster.org/6103 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/nfs/server/src/nfs3.c')
-rw-r--r--xlators/nfs/server/src/nfs3.c30
1 files changed, 30 insertions, 0 deletions
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.