summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorGauravKumarGarg <ggarg@redhat.com>2014-11-12 17:41:33 +0530
committerVijay Bellur <vbellur@redhat.com>2015-02-04 22:02:42 -0800
commite44d4e135747b04a5e2b7cfac21f9a3343e071db (patch)
treee514e5f6f0bd2752c2d0c0c564a0ae12dbb175f6 /libglusterfs/src/common-utils.c
parent0b198a113e254f6a2702a87a45e823cea964ab11 (diff)
DHT: cluster.min-free-disk option should validate correctly
PROBLEM: Previously gluster accepting input value as a percentage which is out of range [0-100] and accepting input value as a size (unit is byte) which is fractional for option cluster.min-free-disk. FIX: Now with this change it will refer to correct validation function and it will accept value that is in range [0-100] for input value as a percentage and unsigned integer value for input as a size (unit in byte) for option cluster.min-free-disk. Change-Id: Iee1962a100542e146276cfc8a4068abddee2bf2d BUG: 1163108 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/9104 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 6d03b09a943..39da27d83dd 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -1449,8 +1449,7 @@ gf_string2bytesize_uint64 (const char *str, uint64_t *n)
}
int
-gf_string2percent_or_bytesize (const char *str,
- uint64_t *n,
+gf_string2percent_or_bytesize (const char *str, double *n,
gf_boolean_t *is_percent)
{
double value = 0ULL;
@@ -1485,6 +1484,7 @@ gf_string2percent_or_bytesize (const char *str,
if (errno == 0)
errno = old_errno;
+ /*Maximum accepted value for 64 bit OS will be (2^14 -1)PB*/
if (tail[0] != '\0') {
if (strcasecmp (tail, GF_UNIT_KB_STRING) == 0)
value *= GF_UNIT_KB;
@@ -1508,7 +1508,7 @@ gf_string2percent_or_bytesize (const char *str,
return -1;
}
- *n = (uint64_t) value;
+ *n = value;
return 0;
}