summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-06-02 03:07:02 +0000
committerAnand Avati <avati@gluster.com>2011-06-08 09:57:58 -0700
commitdde84f682e76ff10d92156cec205b64ed55d4c32 (patch)
treec1bb473ca08661a3aae29e9ad529548591eb43f5
parent52ad8a814d9137e9e83b70638fa13e77c09d22c0 (diff)
performance/io-cache: fix the check of min and max file size.
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2974 (volume set for 'cache-min-file-size' succeeds even if 'min-file size' is greater than 'max-file-size') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2974
-rw-r--r--xlators/performance/io-cache/src/io-cache.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index be7227e9948..d4307dc085f 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1499,6 +1499,7 @@ mem_acct_init (xlator_t *this)
int
validate_options (xlator_t *this, dict_t *options, char **op_errstr)
{
+ ioc_table_t *table = NULL;
int32_t cache_timeout;
int64_t min_file_size = 0;
int64_t max_file_size = 0;
@@ -1507,6 +1508,10 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
char *cache_size_string = NULL;
int ret = 0;
+ if (!this || !this->private)
+ goto out;
+
+ table = this->private;
if (dict_get (options, "cache-timeout")) {
cache_timeout = data_to_uint32 (dict_get (options,
@@ -1581,7 +1586,7 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
" cache-size %"PRIu64"", cache_size);
}
-
+ min_file_size = table->min_file_size;
tmp = data_to_str (dict_get (options, "min-file-size"));
if (tmp != NULL) {
if (gf_string2bytesize (tmp,
@@ -1601,6 +1606,7 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
}
+ max_file_size = table->max_file_size;
tmp = data_to_str (dict_get (options, "max-file-size"));
if (tmp != NULL) {
if (gf_string2bytesize (tmp,
@@ -1620,7 +1626,7 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
max_file_size);
}
- if ((max_file_size >= 0) & (min_file_size > max_file_size)) {
+ if ((max_file_size >= 0) && (min_file_size > max_file_size)) {
gf_log ("io-cache", GF_LOG_WARNING, "minimum size (%"
PRIu64") of a file that can be cached is "
"greater than maximum size (%"PRIu64"). ",
@@ -1631,10 +1637,8 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
goto out;
}
-
out:
- return ret;
-
+ return ret;
}
int
@@ -1749,8 +1753,6 @@ reconfigure (xlator_t *this, dict_t *options)
table->max_pri ++;
}
-
-
min_file_size = table->min_file_size;
tmp = data_to_str (dict_get (options, "min-file-size"));
if (tmp != NULL) {
@@ -1788,7 +1790,7 @@ reconfigure (xlator_t *this, dict_t *options)
table->max_file_size);
}
- if ((max_file_size >= 0) & (min_file_size > max_file_size)) {
+ if ((max_file_size >= 0) && (min_file_size > max_file_size)) {
gf_log ("io-cache", GF_LOG_ERROR, "minimum size (%"
PRIu64") of a file that can be cached is "
"greater than maximum size (%"PRIu64"). "