summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-07-15 01:20:10 +0000
committerAnand Avati <avati@gluster.com>2011-07-17 07:46:30 -0700
commita33ff98a525e883dcacb1387d2aaa44aee1ae226 (patch)
treeaea09531354b0745ab93dd2129a6417a10f1778b
parent4a10b038ebdb8c065ab9024bed686f0ada09cf6e (diff)
dht: changes in volume_options to assist volume set
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
-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 3f81ba755..40b0551d4 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)
@@ -362,6 +362,7 @@ init (xlator_t *this)
int ret = -1;
int i = 0;
uint32_t temp_free_disk = 0;
+ char *def_val = NULL;
if (!this->children) {
@@ -405,8 +406,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) {
@@ -542,6 +562,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