From 6d108a367e32ffdcdf092a802370d601c3ee65d4 Mon Sep 17 00:00:00 2001
From: Poornima G <pgurusid@redhat.com>
Date: Thu, 8 Dec 2016 16:48:55 +0530
Subject: [PATCH 358/361] 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.
mainline:
> BUG: 1401812
> Reviewed-on: http://review.gluster.org/16072
> 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: Raghavendra G <rgowdapp@redhat.com>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
(cherry picked from commit 716756e73e13c73031a88b6aa6749299ea809cf2)
BUG: 1427096
Change-Id: I0adf0b476fcbf91251f5a2fee2241786a3d8255a
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/101418
Tested-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-utils.c | 16 ----------
xlators/mgmt/glusterd/src/glusterd-volgen.c | 40 +++++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-volgen.h | 10 +++++++
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 21 +++++++++++--
4 files changed, 69 insertions(+), 18 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index eee2224..4e15603 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -11354,22 +11354,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 1b53e7c..abebd10 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2541,6 +2541,12 @@ perfxl_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
if (!strcmp (vme->key, "performance.client-io-threads") &&
(GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type ||
GF_CLUSTER_TYPE_REPLICATE == volinfo->type))
+
+ /* 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))
@@ -3291,6 +3297,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)
@@ -3546,6 +3576,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)
@@ -4565,6 +4600,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
@@ -5003,6 +5040,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;
@@ -5851,6 +5890,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 f901773..bbf40b5 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 2898b4a..a2ef7c9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1864,12 +1864,11 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{ .key = "performance.readdir-ahead",
.voltype = "performance/readdir-ahead",
.option = "!perf",
- .value = "off",
+ .value = "on",
.op_version = GD_OP_VERSION_RHS_3_0,
.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",
@@ -3012,6 +3011,24 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_9_0,
.flags = OPT_FLAG_CLIENT_OPT
},
+ { .key = "cluster.use-compound-fops",
+ .voltype = "cluster/replicate",
+ .value = "off",
+ .type = DOC,
+ .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",
--
1.8.3.1