summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-09-07 20:59:54 +0530
committerAnand Avati <avati@redhat.com>2012-09-07 16:48:51 -0700
commitc78919ce37ca55aa789733ca7f2b4beef72d7a54 (patch)
tree564dd64845b665230839fa25709fa9ddc59485db
parentc13823bd16b26bc471d3efb15f63b76fbfdf0309 (diff)
cluster/dht: handle percent option for 'min-free-disk'
* with the init option cleanups, setting of 'conf->disk_unit' was reset, which made it not set the '%' in the option. * bring a global check, which makes the option assume its percent, as long as value is < 100. Change-Id: I00bd1395a309cdc596a2b2b80304c6d98696a24a Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 852889 Reviewed-on: http://review.gluster.org/3918 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/cluster/dht/src/dht.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index d8aa33233d9..6029490c466 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -321,8 +321,14 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("min-free-disk", conf->min_free_disk, options,
percent_or_size, out);
+ /* option can be any one of percent or bytes */
+ conf->disk_unit = 0;
+ if (conf->min_free_disk < 100)
+ conf->disk_unit = 'p';
+
GF_OPTION_RECONF ("min-free-inodes", conf->min_free_inodes, options,
percent, out);
+
GF_OPTION_RECONF ("directory-layout-spread", conf->dir_spread_cnt,
options, uint32, out);
@@ -440,6 +446,11 @@ init (xlator_t *this)
GF_OPTION_INIT ("rebalance-stats", defrag->stats, bool, err);
}
+ /* option can be any one of percent or bytes */
+ conf->disk_unit = 0;
+ if (conf->min_free_disk < 100)
+ conf->disk_unit = 'p';
+
ret = dht_init_subvolumes (this, conf);
if (ret == -1) {
goto err;