summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/dht.c')
-rw-r--r--xlators/cluster/dht/src/dht.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 3be6312937c..ddf95832f66 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -110,6 +110,15 @@ init (xlator_t *this)
gf_string2boolean (lookup_unhashed_str,
&conf->search_unhashed);
}
+
+ conf->min_free_disk = 10;
+
+ if (dict_get_str (this->options, "min-free-disk",
+ &lookup_unhashed_str) == 0) {
+ gf_string2percent (lookup_unhashed_str,
+ &conf->min_free_disk);
+ }
+
ret = dht_init_subvolumes (this, conf);
if (ret == -1) {
@@ -121,6 +130,13 @@ init (xlator_t *this)
goto err;
}
+ conf->du_stats = CALLOC (conf->subvolume_cnt, sizeof (dht_du_t));
+ if (!conf->du_stats) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "memory allocation failed :(");
+ goto err;
+ }
+
LOCK_INIT (&conf->subvolume_lock);
conf->gen = 1;
@@ -147,6 +163,9 @@ err:
if (conf->subvolume_status)
FREE (conf->subvolume_status);
+ if (conf->du_stats)
+ FREE (conf->du_stats);
+
FREE (conf);
}
@@ -218,5 +237,8 @@ struct volume_options options[] = {
{ .key = {"lookup-unhashed"},
.type = GF_OPTION_TYPE_BOOL
},
+ { .key = {"min-free-disk"},
+ .type = GF_OPTION_TYPE_PERCENT
+ },
{ .key = {NULL} },
};