diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-10-22 12:26:57 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-12-05 04:02:07 -0500 |
commit | 323494932f955e645c399469faa2ed823a1364c6 (patch) | |
tree | 38b7a697156a5365fc6ee3c2ff2dce09ae562c2b /xlators/cluster | |
parent | 3a500f12bd38f30de2eb60438f8c4d398584f2d2 (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.
Upstream Patch : http://review.gluster.org/3918
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 858488
Change-Id: I7916d69ba72f0647881062d910bae73884a1b1c7
Reviewed-on: https://code.engineering.redhat.com/gerrit/144
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index a678bb9ef04..46ede414d8b 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -324,6 +324,11 @@ 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, @@ -431,6 +436,11 @@ init (xlator_t *this) bool, err); GF_OPTION_INIT ("readdir-optimize", conf->readdir_optimize, 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; |