From 2c03c753fe77dfadb7660ecb39fe0bbb6bad026f Mon Sep 17 00:00:00 2001 From: Poornima G Date: Thu, 8 Dec 2016 16:48:55 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/16072 Reviewed-by: Raghavendra G Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c') 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 @@ -3390,6 +3397,30 @@ out: return ret; } +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, @@ -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); -- cgit