summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-09-27 00:49:54 +0530
committerPranith Kumar K <pkarampu@redhat.com>2012-09-27 10:41:19 +0530
commit13cfed388a19dd70984197fb14330d0277ba91e7 (patch)
tree8e86f3cc4f441b3804741ee9dc6dbb9288269b12 /xlators/cluster/dht
parentc8f9437b6ef507a4dc7fe03aa32a9fbf220d09f6 (diff)
mgmt/glusterd: Implementation of server-side quorum.
Feature-page: http://www.gluster.org/community/documentation/index.php/Features/Server-quorum Change-Id: Ifec0f1a697d390a29ba447a09750602fea1b3a4b BUG: 840122 Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.h4
-rw-r--r--xlators/cluster/dht/src/dht.c4
-rw-r--r--xlators/cluster/dht/src/nufa.c13
-rw-r--r--xlators/cluster/dht/src/switch.c18
4 files changed, 20 insertions, 19 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index da83967e76d..d244921279d 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -222,8 +222,8 @@ struct dht_conf {
gf_boolean_t search_unhashed;
int gen;
dht_du_t *du_stats;
- uint64_t min_free_disk;
- uint32_t min_free_inodes;
+ double min_free_disk;
+ double min_free_inodes;
char disk_unit;
int32_t refresh_interval;
gf_boolean_t unhashed_sticky_bit;
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 47b387437e4..a678bb9ef04 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -118,8 +118,8 @@ dht_priv_dump (xlator_t *this)
gf_proc_dump_write("search_unhashed", "%d", conf->search_unhashed);
gf_proc_dump_write("gen", "%d", conf->gen);
- gf_proc_dump_write("min_free_disk", "%lu", conf->min_free_disk);
- gf_proc_dump_write("min_free_inodes", "%lu", conf->min_free_inodes);
+ gf_proc_dump_write("min_free_disk", "%lf", conf->min_free_disk);
+ gf_proc_dump_write("min_free_inodes", "%lf", conf->min_free_inodes);
gf_proc_dump_write("disk_unit", "%c", conf->disk_unit);
gf_proc_dump_write("refresh_interval", "%d", conf->refresh_interval);
gf_proc_dump_write("unhashed_sticky_bit", "%d", conf->unhashed_sticky_bit);
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 2179870d9ad..1d3e3224763 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -504,7 +504,8 @@ init (xlator_t *this)
int ret = -1;
int i = 0;
char my_hostname[256];
- uint32_t temp_free_disk = 0;
+ double temp_free_disk = 0;
+ uint64_t size = 0;
if (!this->children) {
gf_log (this->name, GF_LOG_CRITICAL,
@@ -589,16 +590,16 @@ init (xlator_t *this)
if (gf_string2percent (temp_str,
&temp_free_disk) == 0) {
if (temp_free_disk > 100) {
- gf_string2bytesize (temp_str,
- &conf->min_free_disk);
+ gf_string2bytesize (temp_str, &size);
+ conf->min_free_disk = size;
conf->disk_unit = 'b';
} else {
- conf->min_free_disk = (uint64_t)temp_free_disk;
+ conf->min_free_disk = temp_free_disk;
conf->disk_unit = 'p';
}
} else {
- gf_string2bytesize (temp_str,
- &conf->min_free_disk);
+ gf_string2bytesize (temp_str, &size);
+ conf->min_free_disk = size;
conf->disk_unit = 'b';
}
}
diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c
index fe75914f247..bc1f5f1f499 100644
--- a/xlators/cluster/dht/src/switch.c
+++ b/xlators/cluster/dht/src/switch.c
@@ -832,7 +832,8 @@ init (xlator_t *this)
char *temp_str = NULL;
int ret = -1;
int i = 0;
- uint32_t temp_free_disk = 0;
+ double temp_free_disk = 0;
+ uint64_t size = 0;
if (!this->children) {
gf_log (this->name, GF_LOG_CRITICAL,
@@ -865,24 +866,23 @@ init (xlator_t *this)
gf_string2boolean (temp_str, &conf->unhashed_sticky_bit);
}
- conf->min_free_disk = 10;
+ conf->min_free_disk = 10.0;
conf->disk_unit = 'p';
if (dict_get_str (this->options, "min-free-disk",
&temp_str) == 0) {
- if (gf_string2percent (temp_str,
- &temp_free_disk) == 0) {
+ if (gf_string2percent (temp_str, &temp_free_disk) == 0) {
if (temp_free_disk > 100) {
- gf_string2bytesize (temp_str,
- &conf->min_free_disk);
+ gf_string2bytesize (temp_str, &size);
+ conf->min_free_disk = size;
conf->disk_unit = 'b';
} else {
- conf->min_free_disk = (uint64_t)temp_free_disk;
+ conf->min_free_disk = temp_free_disk;
conf->disk_unit = 'p';
}
} else {
- gf_string2bytesize (temp_str,
- &conf->min_free_disk);
+ gf_string2bytesize (temp_str, &size);
+ conf->min_free_disk = size;
conf->disk_unit = 'b';
}
}