summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2016-12-08 16:48:55 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-01-17 20:05:11 -0800
commit2c03c753fe77dfadb7660ecb39fe0bbb6bad026f (patch)
tree1300d52cbdef689cfd9c75cff9e792ca7b06a1f6 /xlators/mgmt/glusterd
parentc822e354e16646adf18bbc5123798663faa543b2 (diff)
glusterd: Change the volfile to have readdir-ahead as a child
of dht As mentioned in feature page http://review.gluster.org/#/c/16090/ readdir-ahead will be optionally placed below dht. There are two options: 1. performance.readdir-ahead 2. performance.parallel-readdir If only option is enabled, then readdir ahead is placed at its original place as an ancestor of dht. If both the options 1 and 2 are enabled then readdir ahead is placed as a child of dht. Also changes have been made to retain the rebalance, quotad, snapd vol files to remain unchanged. Change-Id: I0adf0b476fcbf91251f5a2fee2241786a3d8255a BUG: 1401812 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/16072 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h10
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c14
4 files changed, 63 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 7d1835236fe..c408f12c10d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -11028,22 +11028,6 @@ glusterd_enable_default_options (glusterd_volinfo_t *volinfo, char *option)
* }
* */
- /* readdir-ahead needs to be enabled for new volumes with
- * >= gluster version 3.7
- */
- if (!option || !strcmp ("performance.readdir-ahead", option)) {
- ret = dict_set_dynstr_with_alloc (volinfo->dict,
- "performance.readdir-ahead", "on");
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- GD_MSG_DICT_SET_FAILED,
- "Failed to set option "
- "'performance.readdir-ahead' on volume "
- "%s", volinfo->volname);
- goto out;
- }
- }
-
/* Option 'features.quota-deem-statfs' should not be turned off
* with 'gluster volume reset <VOLNAME>', since quota features
* can be reset only with 'gluster volume quota <VOLNAME>
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 9537156b6c3..144bd5a4d57 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2647,6 +2647,13 @@ perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
(vme->op_version > volinfo->client_op_version))
return 0;
+ /* if VKEY_READDIR_AHEAD is enabled and parallel readdir is
+ * not enabled then load readdir-ahead here else it will be
+ * loaded as a child of dht */
+ if (!strcmp (vme->key, VKEY_READDIR_AHEAD) &&
+ glusterd_volinfo_get_boolean (volinfo, VKEY_PARALLEL_READDIR))
+ return 0;
+
if (volgen_graph_add (graph, vme->voltype, volinfo->volname))
return 0;
else
@@ -3391,6 +3398,30 @@ out:
}
static int
+volgen_graph_build_readdir_ahead (volgen_graph_t *graph,
+ glusterd_volinfo_t *volinfo,
+ size_t child_count)
+{
+ int32_t clusters = 0;
+
+ if (graph->type == GF_REBALANCED ||
+ graph->type == GF_QUOTAD ||
+ graph->type == GF_SNAPD ||
+ !glusterd_volinfo_get_boolean (volinfo, VKEY_PARALLEL_READDIR) ||
+ !glusterd_volinfo_get_boolean (volinfo, VKEY_READDIR_AHEAD))
+ goto out;
+
+ clusters = volgen_link_bricks_from_list_tail (graph,
+ volinfo,
+ "performance/readdir-ahead",
+ "%s-readdir-ahead-%d",
+ child_count,
+ 1);
+out:
+ return clusters;
+}
+
+static int
volgen_graph_build_dht_cluster (volgen_graph_t *graph,
glusterd_volinfo_t *volinfo, size_t child_count,
gf_boolean_t is_quotad)
@@ -3726,6 +3757,11 @@ build_distribute:
else
strcat (volinfo->volname, "-cold");
}
+ clusters = volgen_graph_build_readdir_ahead (graph, volinfo,
+ dist_count);
+ if (clusters < 0)
+ goto out;
+
ret = volgen_graph_build_dht_cluster (graph, volinfo,
dist_count, is_quotad);
if (volinfo->tier_info.hot_brick_count)
@@ -4750,6 +4786,8 @@ build_rebalance_volfile (glusterd_volinfo_t *volinfo, char *filepath,
this = THIS;
+ graph.type = GF_REBALANCED;
+
if (volinfo->brick_count <= volinfo->dist_leaf_count) {
/*
* Volume is not a distribute volume or
@@ -5186,6 +5224,8 @@ build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict)
priv = this->private;
GF_ASSERT (priv);
+ graph->type = GF_QUOTAD;
+
set_dict = dict_new ();
if (!set_dict) {
ret = -ENOMEM;
@@ -6050,6 +6090,7 @@ glusterd_snapdsvc_create_volfile (glusterd_volinfo_t *volinfo)
int ret = -1;
char filename [PATH_MAX] = {0,};
+ graph.type = GF_SNAPD;
glusterd_svc_build_snapd_volfile (volinfo, filename, PATH_MAX);
ret = glusterd_snapdsvc_generate_volfile (&graph, volinfo);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index 2d62f720c8a..de1ba9428f5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -32,6 +32,8 @@
#define VKEY_FEATURES_TRASH "features.trash"
#define VKEY_FEATURES_BITROT "features.bitrot"
#define VKEY_FEATURES_SCRUB "features.scrub"
+#define VKEY_PARALLEL_READDIR "performance.parallel-readdir"
+#define VKEY_READDIR_AHEAD "performance.readdir-ahead"
#define AUTH_ALLOW_MAP_KEY "auth.allow"
#define AUTH_REJECT_MAP_KEY "auth.reject"
@@ -55,9 +57,17 @@ typedef enum {
GF_CLIENT_OTHER
} glusterd_client_type_t;
+/* It indicates the type of volfile that the graph is built for */
+typedef enum {
+ GF_REBALANCED = 1,
+ GF_QUOTAD,
+ GF_SNAPD,
+} glusterd_graph_type_t;
+
struct volgen_graph {
char **errstr;
glusterfs_graph_t graph;
+ glusterd_graph_type_t type;
};
typedef struct volgen_graph volgen_graph_t;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index a75770220b3..ae569c66a23 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1867,12 +1867,11 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{ .key = "performance.readdir-ahead",
.voltype = "performance/readdir-ahead",
.option = "!perf",
- .value = "off",
+ .value = "on",
.op_version = 3,
.description = "enable/disable readdir-ahead translator in the volume.",
.flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_XLATOR_OPT
},
-
{ .key = "performance.io-cache",
.voltype = "performance/io-cache",
.option = "!perf",
@@ -3092,6 +3091,17 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_8_4,
.flags = OPT_FLAG_CLIENT_OPT
},
+ { .key = "performance.parallel-readdir",
+ .voltype = "performance/readdir-ahead",
+ .option = "parallel-readdir",
+ .value = "off",
+ .type = DOC,
+ .op_version = GD_OP_VERSION_3_10_0,
+ .description = "If this option is enabled, the readdir operation is "
+ "performed parallely on all the bricks, thus improving"
+ " the performance of readdir. Note that the performance"
+ "improvement is higher in large clusters"
+ },
{ .key = "performance.rda-request-size",
.voltype = "performance/readdir-ahead",
.option = "rda-request-size",