summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-07-12 05:33:31 +0000
committerAnand Avati <avati@gluster.com>2011-07-12 09:03:15 -0700
commit6b40f3eba97c8aad653f0602754127f7ae5a9707 (patch)
treeb7ac48b1d1bb22ae039692ac4f4e9ef108db3d08 /xlators
parente87432be87c37c36467a85e3d2c55970f8439915 (diff)
dht: changes in volume_options to assist volume set help/help-xml
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2041 (volume set help option) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index f28c50442b9..3abba0dfe40 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -34,7 +34,7 @@
- handle all cases in self heal layout reconstruction
- complete linkfile selfheal
*/
-
+struct volume_options options[];
void
dht_layout_dump (dht_layout_t *layout, const char *prefix)
@@ -353,6 +353,7 @@ init (xlator_t *this)
int ret = -1;
int i = 0;
uint32_t temp_free_disk = 0;
+ char *def_val = NULL;
GF_VALIDATE_OR_GOTO ("dht", this, err);
@@ -395,8 +396,27 @@ init (xlator_t *this)
gf_string2boolean (temp_str, &conf->use_readdirp);
}
- conf->disk_unit = 'p';
- conf->min_free_disk = 10;
+ if (xlator_get_volopt_info (&this->volume_options, "min-free-disk",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ " min-free-disk not found");
+ ret = -1;
+ goto err;
+ } else {
+ if (gf_string2percent (def_val, &temp_free_disk) == 0) {
+ if (temp_free_disk > 100) {
+ gf_string2bytesize (temp_str,
+ &conf->min_free_disk);
+ conf->disk_unit = 'b';
+ } else {
+ conf->min_free_disk = (uint64_t)temp_free_disk;
+ conf->disk_unit = 'p';
+ }
+ } else {
+ gf_string2bytesize (temp_str, &conf->min_free_disk);
+ conf->disk_unit = 'b';
+ }
+ }
if (dict_get_str (this->options, "min-free-disk", &temp_str) == 0) {
if (gf_string2percent (temp_str, &temp_free_disk) == 0) {
@@ -541,6 +561,9 @@ struct volume_options options[] = {
},
{ .key = {"min-free-disk"},
.type = GF_OPTION_TYPE_PERCENT_OR_SIZET,
+ .default_value = "10%",
+ .description = "Percentage/Size of disk space that must be "
+ "kept free."
},
{ .key = {"unhashed-sticky-bit"},
.type = GF_OPTION_TYPE_BOOL