summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server
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
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')
-rw-r--r--xlators/nfs/server/src/nfs.c31
-rw-r--r--xlators/nfs/server/src/nfs3.c30
-rw-r--r--xlators/nfs/server/src/nfs3.h18
3 files changed, 60 insertions, 19 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index bc75cf11925..8158f954f22 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -1115,28 +1115,39 @@ struct volume_options options[] = {
.min = GF_NFS3_RTMIN,
.max = GF_NFS3_RTMAX,
.default_value = TOSTRING(GF_NFS3_RTPREF),
- .description = "Size in which the client should issue read requests"
- " to the Gluster NFSv3 server. Must be a multiple of"
- " 4KB. Max supported value is 1MB(1048576)."
+ .description = "Size in which the client should issue read requests "
+ "to the Gluster NFSv3 server. Must be a multiple of "
+ "4KB (4096). Min and Max supported values are 4KB "
+ "(4096) and 1MB (1048576) respectively. If the "
+ "specified value is within the supported range but "
+ "not a multiple of 4096, it is rounded up to the "
+ "nearest multiple of 4096."
},
{ .key = {"nfs3.write-size"},
.type = GF_OPTION_TYPE_SIZET,
.min = GF_NFS3_WTMIN,
.max = GF_NFS3_WTMAX,
.default_value = TOSTRING(GF_NFS3_WTPREF),
- .description = "Size in which the client should issue write requests"
- " to the Gluster NFSv3 server. Must be a multiple of"
- " 4KB. Max supported value is 1MB(1048576)."
+ .description = "Size in which the client should issue write requests "
+ "to the Gluster NFSv3 server. Must be a multiple of "
+ "1KB (1024). Min and Max supported values are "
+ "4KB (4096) and 1MB(1048576) respectively. If the "
+ "specified value is within the supported range but "
+ "not a multiple of 4096, it is rounded up to the "
+ "nearest multiple of 4096."
},
{ .key = {"nfs3.readdir-size"},
.type = GF_OPTION_TYPE_SIZET,
.min = GF_NFS3_DTMIN,
.max = GF_NFS3_DTMAX,
.default_value = TOSTRING(GF_NFS3_DTPREF),
- .description = "Size in which the client should issue directory"
- " reading requests to Gluster NFSv3 server. Must"
- " be a multiple of 4KB. Max supported value is"
- " 1MB(1048576)."
+ .description = "Size in which the client should issue directory "
+ "reading requests to the Gluster NFSv3 server. Must "
+ "be a multiple of 1KB (1024). Min and Max supported "
+ "values are 4KB (4096) and 1MB (1048576) respectively."
+ "If the specified value is within the supported range "
+ "but not a multiple of 4096, it is rounded up to the "
+ "nearest multiple of 4096."
},
{ .key = {"nfs3.*.volume-access"},
.type = GF_OPTION_TYPE_STR,
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 1754b5e8a47..afb5ba33248 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.
diff --git a/xlators/nfs/server/src/nfs3.h b/xlators/nfs/server/src/nfs3.h
index 315cae9435c..054429c82b8 100644
--- a/xlators/nfs/server/src/nfs3.h
+++ b/xlators/nfs/server/src/nfs3.h
@@ -39,19 +39,19 @@
/* Static values used for FSINFO
- * To change the maximum rsize and wsize supported by the NFS client,
- * adjust GF_NFS3_FILE_IO_SIZE_MAX. The Gluster NFS server defaults to
- * 64KB(65536) which is reasonable for 1GE and 10GE. But for better
- * performance on 10GE, rsize/wsize can be raised to 1MB(1048576).
- * rsize and wsize can be tuned through nfs.read-size and
+ * To change the maximum rsize and wsize supported by the NFS client, adjust
+ * GF_NFS3_FILE_IO_SIZE_MAX. The Gluster NFS server defaults to 1MB(1048576)
+ * (same as kernel NFS server). For slower network, rsize/wsize can be trimmed
+ * to 16/32/64-KB. rsize and wsize can be tuned through nfs.read-size and
* nfs.write-size respectively.
*
* NB: For Kernel-NFS, NFS_MAX_FILE_IO_SIZE is 1048576U (1MB).
*/
#define GF_NFS3_FILE_IO_SIZE_MAX (1 * GF_UNIT_MB) /* 1048576 */
-#define GF_NFS3_FILE_IO_SIZE_DEF (64 * GF_UNIT_KB) /* 65536 */
#define GF_NFS3_FILE_IO_SIZE_MIN (4 * GF_UNIT_KB) /* 4096 */
+#define GF_NFS3_FILE_IO_SIZE_DEF GF_NFS3_FILE_IO_SIZE_MAX
+
#define GF_NFS3_RTMAX GF_NFS3_FILE_IO_SIZE_MAX
#define GF_NFS3_RTMIN GF_NFS3_FILE_IO_SIZE_MIN
#define GF_NFS3_RTPREF GF_NFS3_FILE_IO_SIZE_DEF
@@ -69,6 +69,9 @@
#define GF_NFS3_MAXFILESIZE (1 * GF_UNIT_PB)
+#define GF_NFS3_IO_SIZE 4096 /* 4-KB */
+#define GF_NFS3_IO_SHIFT 12 /* 2^12 = 4KB */
+
/* FIXME: Handle time resolutions */
#define GF_NFS3_TIMEDELTA_SECS {1,0}
#define GF_NFS3_TIMEDELTA_NSECS {0,1}
@@ -274,9 +277,6 @@ struct inode_op_queue {
pthread_mutex_t qlock;
};
-
-
-
extern rpcsvc_program_t *
nfs3svc_init (xlator_t *nfsx);
#endif