summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-07-01 04:40:05 +0000
committerAnand Avati <avati@gluster.com>2011-07-14 01:01:39 -0700
commit3f76fe277ec0a826bf3052134ad877ee65ce9e79 (patch)
tree802ddcc8c34de9c65563e64635c8ba2ac1f1c59f /xlators/cluster/dht/src/dht.c
parent6cf06cfd4bf72b16ac7665323629d354b78b6b05 (diff)
cluster/distribute: bring in directory-spread-count option
global spread count option is given through volume file Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2257 (enhance distribute to control the spread count (ie, control the hashing range)) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2257
Diffstat (limited to 'xlators/cluster/dht/src/dht.c')
-rw-r--r--xlators/cluster/dht/src/dht.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 3abba0dfe..42f0c0d75 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -290,6 +290,7 @@ reconfigure (xlator_t *this, dict_t *options)
gf_boolean_t search_unhashed;
uint32_t temp_free_disk = 0;
int ret = -1;
+ uint32_t dir_spread = 0;
GF_VALIDATE_OR_GOTO ("dht", this, out);
GF_VALIDATE_OR_GOTO ("dht", options, out);
@@ -340,6 +341,22 @@ reconfigure (xlator_t *this, dict_t *options)
" min-free-disk reconfigured to %s",
temp_str);
}
+
+ if (dict_get_str (options, "directory-layout-spread", &temp_str) == 0) {
+ ret = gf_string2uint32 (temp_str, &dir_spread);
+ if (ret ||
+ (dir_spread > conf->subvolume_cnt) ||
+ (dir_spread < 1)) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "wrong 'directory-layout-spread' option given "
+ "(%s). setting to earlier value (%d)",
+ temp_str, conf->dir_spread_cnt);
+ ret = -1;
+ goto out;
+ }
+ conf->dir_spread_cnt = dir_spread;
+ }
+
ret = 0;
out:
return ret;
@@ -433,6 +450,21 @@ init (xlator_t *this)
}
}
+ conf->dir_spread_cnt = conf->subvolume_cnt;
+ if (dict_get_str (this->options, "directory-layout-spread",
+ &temp_str) == 0) {
+ ret = gf_string2uint32 (temp_str, &conf->dir_spread_cnt);
+ if (ret ||
+ (conf->dir_spread_cnt > conf->subvolume_cnt) ||
+ (conf->dir_spread_cnt < 1)) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "wrong 'directory-layout-spread' option given "
+ "(%s). setting it to subvolume count",
+ temp_str);
+ conf->dir_spread_cnt = conf->subvolume_cnt;
+ }
+ }
+
conf->assert_no_child_down = 0;
ret = dict_get_str_boolean (this->options, "assert-no-child-down", 0);
@@ -574,5 +606,8 @@ struct volume_options options[] = {
{ .key = {"assert-no-child-down"},
.type = GF_OPTION_TYPE_BOOL
},
+ { .key = {"directory-layout-spread"},
+ .type = GF_OPTION_TYPE_INT,
+ },
{ .key = {NULL} },
};