summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-09-18 03:31:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-18 07:02:03 -0700
commit5c297be9612f76dad6f970092fb6762b4ee4844a (patch)
treef65290e7f12e8d6913f3f3b8d3ffa8dc4cd06618 /xlators/performance
parentfaa817ea9cb119c7f65fce24f03a172fa4b4ada1 (diff)
Glusterd: gluster volume set <volume> <option> <value>
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c159
-rw-r--r--xlators/performance/io-threads/src/io-threads.c41
-rw-r--r--xlators/performance/write-behind/src/write-behind.c51
3 files changed, 251 insertions, 0 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 490d31688..296edf233 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1470,6 +1470,165 @@ mem_acct_init (xlator_t *this)
return ret;
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+ ioc_table_t *table = NULL;
+ int32_t cache_timeout;
+ int64_t min_file_size = 0;
+ int64_t max_file_size = 0;
+ char *tmp = NULL;
+ uint64_t cache_size;
+ char *cache_size_string = NULL;
+ int ret = 0;
+
+ table = this->private;
+
+ ioc_table_lock (table);
+ {
+ if (dict_get (options, "cache-timeout")) {
+ cache_timeout =
+ data_to_uint32 (dict_get (options,
+ "cache-timeout"));
+ if (cache_timeout < 0){
+ gf_log (this->name, GF_LOG_WARNING,
+ "cache-timeout %d seconds invalid,"
+ " has to be >=0", cache_timeout);
+ ret = -1;
+ goto out;
+ }
+
+
+ if (cache_timeout > 60){
+ gf_log (this->name, GF_LOG_WARNING,
+ "cache-timeout %d seconds invalid,"
+ " has to be <=60", cache_timeout);
+ ret = -1;
+ goto out;
+ }
+
+ table->cache_timeout = cache_timeout;
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring %d seconds to"
+ " revalidate cache", table->cache_timeout);
+ }
+
+
+ if (dict_get (options, "cache-size"))
+ cache_size_string = data_to_str (dict_get (options,
+ "cache-size"));
+ if (cache_size_string) {
+ if (gf_string2bytesize (cache_size_string,
+ &cache_size) != 0) {
+ gf_log ("io-cache", GF_LOG_ERROR,
+ "invalid number format \"%s\" of "
+ "\"option cache-size\" Defaulting"
+ "to old value", cache_size_string);
+ ret = -1;
+ goto out;
+ }
+
+ if (cache_size < (4*(2^20))) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 4MiB, Defaulting to old value (%d)"
+ , cache_size_string, table->cache_size);
+ ret = -1;
+ goto out;
+ }
+
+ if (cache_size > (6 *(2^30))) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 6GiB, Defaulting to old value (%d)"
+ , cache_size_string, table->cache_size);
+ ret = -1;
+ goto out;
+ }
+
+
+ gf_log (this->name, GF_LOG_DEBUG, "Reconfiguring "
+ " cache-size %"PRIu64"", table->cache_size);
+ table->cache_size = cache_size;
+ }
+
+
+ if (dict_get (options, "priority")) {
+ char *option_list = data_to_str (dict_get (options,
+ "priority"));
+ gf_log (this->name, GF_LOG_TRACE,
+ "option path %s", option_list);
+ /* parse the list of pattern:priority */
+ table->max_pri = ioc_get_priority_list (option_list,
+ &table->priority_list);
+
+ if (table->max_pri == -1) {
+ ret = -1;
+ goto out;
+ }
+ table->max_pri ++;
+ }
+
+
+
+ min_file_size = table->min_file_size;
+ tmp = data_to_str (dict_get (options, "min-file-size"));
+ if (tmp != NULL) {
+ if (gf_string2bytesize (tmp,
+ (uint64_t *)&min_file_size)
+ != 0) {
+ gf_log ("io-cache", GF_LOG_ERROR,
+ "invalid number format \"%s\" of "
+ "\"option min-file-size\"", tmp);
+ ret = -1;
+ goto out;
+ }
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring min-file-size %"PRIu64"",
+ table->min_file_size);
+ }
+
+ max_file_size = table->max_file_size;
+ tmp = data_to_str (dict_get (options, "max-file-size"));
+ if (tmp != NULL) {
+ if (gf_string2bytesize (tmp,
+ (uint64_t *)&max_file_size)
+ != 0) {
+ gf_log ("io-cache", GF_LOG_ERROR,
+ "invalid number format \"%s\" of "
+ "\"option max-file-size\"", tmp);
+ ret = -1;
+ goto out;
+ }
+
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Reconfiguring max-file-size %"PRIu64"",
+ table->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"). "
+ "Hence Defaulting to old value",
+ table->min_file_size, table->max_file_size);
+ ret = -1;
+ goto out;
+ }
+
+ table->min_file_size = min_file_size;
+ table->max_file_size = max_file_size;
+ }
+
+ ioc_table_unlock (table);
+out:
+ return ret;
+
+}
+
/*
* init -
* @this:
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index e31bd4bba..0fe034a3f 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -2079,10 +2079,51 @@ mem_acct_init (xlator_t *this)
return ret;
}
+
+
return ret;
}
int
+reconfigure ( xlator_t *this, dict_t *options)
+{
+ iot_conf_t *conf = NULL;
+ int ret = 0;
+ int thread_count;
+
+
+ if (dict_get (options, "thread-count")) {
+ thread_count = data_to_int32 (dict_get (options,
+ "thread-count"));
+
+ if (thread_count < IOT_MIN_THREADS) {
+ gf_log ("io-threads", GF_LOG_WARNING,
+ "Number of threads opted is less then min rest"
+ "oring it to previous value",conf->max_count);
+ ret = -1;
+ goto out;
+ }
+
+ if (thread_count > IOT_MAX_THREADS) {
+ gf_log ("io-threads", GF_LOG_WARNING,
+ "Number of threads opted is greater than max "
+ "restoring it to previous value",conf->max_count);
+ ret = -1;
+ goto out;
+ }
+
+ conf->max_count = thread_count;
+ }
+
+ ret = 0;
+
+out:
+ return ret;
+
+
+}
+
+int
init (xlator_t *this)
{
iot_conf_t *conf = NULL;
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index c9fc25a5b..efb78acf7 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2727,6 +2727,57 @@ mem_acct_init (xlator_t *this)
return ret;
}
+int
+reconfigure (xlator_t *this, dict_t *options)
+{
+ char *str=NULL;
+ uint64_t window_size;
+ wb_conf_t *conf = NULL;
+ int ret = 0;
+
+ conf = this->private;
+
+ ret = dict_get_str (options, "cache-size",
+ &str);
+ if (ret == 0) {
+ ret = gf_string2bytesize (str, &window_size);
+ if (ret != 0) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s failed , Invalid"
+ " number format, Defaulting to old value (%d)"
+ , str, conf->window_size);
+ ret = -1;
+ goto out;
+ }
+
+ if (window_size < (2^19)) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 512KiB, Defaulting to old value (%d)"
+ , str, conf->window_size);
+ ret = -1;
+ goto out;
+ }
+
+ if (window_size > (2^30)) {
+ gf_log(this->name, GF_LOG_ERROR, "Reconfiguration"
+ "'option cache-size %s' failed , Max value"
+ "can be 1 GiB, Defaulting to old value (%d)"
+ , str, conf->window_size);
+ ret = -1;
+ goto out;
+ }
+
+ conf->window_size = window_size;
+ gf_log(this->name, GF_LOG_DEBUG, "Reconfiguring "
+ "'option cache-size %s ' to %d"
+ , str, conf->window_size);
+ }
+out:
+ return 0;
+
+}
+
int32_t
init (xlator_t *this)
{