summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-08-16 13:10:41 +0530
committerAnand Avati <avati@gluster.com>2011-08-18 22:42:48 -0700
commitce0aaba383b97dca52d11c18846a8154d529bf8a (patch)
tree494673947140ddded481e4532ce6c340eac09446 /xlators/performance
parentb7596882b3ceba77bd812d2e5757d9fa3aa0fa17 (diff)
mgmt/Glusterd: Implementation volume set help/help-xml
Change-Id: I0c54fd1c15550e5e5551e95ed32adb14d8029fab Reviewed-on: http://review.gluster.com/238 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c104
-rw-r--r--xlators/performance/io-threads/src/io-threads.c34
-rw-r--r--xlators/performance/quick-read/src/quick-read.c21
-rw-r--r--xlators/performance/write-behind/src/write-behind.c47
4 files changed, 180 insertions, 26 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 6853558cabb..230842389cc 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -40,6 +40,7 @@ ioc_get_priority (ioc_table_t *table, const char *path);
uint32_t
ioc_get_priority (ioc_table_t *table, const char *path);
+struct volume_options options[];
inline uint32_t
ioc_hashfn (void *data, int len)
@@ -1719,14 +1720,15 @@ int32_t
init (xlator_t *this)
{
ioc_table_t *table = NULL;
- dict_t *options = NULL;
+ dict_t *xl_options = this->options;
uint32_t index = 0;
char *cache_size_string = NULL, *tmp = NULL;
int32_t ret = -1;
glusterfs_ctx_t *ctx = NULL;
data_t *data = 0;
+ char *def_val = NULL;
- options = this->options;
+ xl_options = this->options;
if (!this->children || this->children->next) {
gf_log (this->name, GF_LOG_ERROR,
@@ -1750,7 +1752,22 @@ init (xlator_t *this)
table->page_size = this->ctx->page_size;
table->cache_size = IOC_CACHE_SIZE;
- data = dict_get (options, "cache-size");
+ if (xlator_get_volopt_info (&this->volume_options, "cache-size",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of cache-size "
+ "not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2bytesize (def_val, &table->cache_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
+ data = dict_get (xl_options, "cache-size");
if (data)
cache_size_string = data_to_str (data);
@@ -1768,9 +1785,23 @@ init (xlator_t *this)
"using cache-size %"PRIu64"", table->cache_size);
}
- table->cache_timeout = 1;
+ if (xlator_get_volopt_info (&this->volume_options, "cache-timeout",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-timeout not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2int32 (def_val, &table->cache_timeout)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-timeout corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
- data = dict_get (options, "cache-timeout");
+ data = dict_get (xl_options, "cache-timeout");
if (data) {
table->cache_timeout = data_to_uint32 (data);
gf_log (this->name, GF_LOG_TRACE,
@@ -1780,7 +1811,7 @@ init (xlator_t *this)
INIT_LIST_HEAD (&table->priority_list);
table->max_pri = 1;
- data = dict_get (options, "priority");
+ data = dict_get (xl_options, "priority");
if (data) {
char *option_list = data_to_str (data);
gf_log (this->name, GF_LOG_TRACE,
@@ -1795,9 +1826,24 @@ init (xlator_t *this)
}
table->max_pri ++;
- table->min_file_size = 0;
+ if (xlator_get_volopt_info (&this->volume_options, "min-file-size",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "min-file-size not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2bytesize (def_val,
+ (uint64_t *) &table->min_file_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "min-file-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
- data = dict_get (options, "min-file-size");
+ data = dict_get (xl_options, "min-file-size");
if (data)
tmp = data_to_str (data);
@@ -1815,9 +1861,24 @@ init (xlator_t *this)
"using min-file-size %"PRIu64"", table->min_file_size);
}
+ if (xlator_get_volopt_info (&this->volume_options, "max-file-size",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "max-file-size not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2bytesize (def_val,
+ (uint64_t *) &table->max_file_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "max-file-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
tmp = NULL;
- table->max_file_size = -1;
- data = dict_get (options, "max-file-size");
+ data = dict_get (xl_options, "max-file-size");
if (data)
tmp = data_to_str (data);
@@ -1954,23 +2015,40 @@ struct xlator_cbks cbks = {
struct volume_options options[] = {
{ .key = {"priority"},
- .type = GF_OPTION_TYPE_ANY
+ .type = GF_OPTION_TYPE_ANY,
+ .default_value = "",
+ .description = "Assigns priority to filenames with specific "
+ "patterns so that when a page needs to be ejected "
+ "out of the cache, the page of a file whose "
+ "priority is the lowest will be ejected earlier"
},
{ .key = {"cache-timeout", "force-revalidate-timeout"},
.type = GF_OPTION_TYPE_INT,
.min = 0,
- .max = 60
+ .max = 60,
+ .default_value = "1",
+ .description = "The cached data for a file will be retained till "
+ "'cache-refresh-timeout' seconds, after which data "
+ "re-validation is performed."
},
{ .key = {"cache-size"},
.type = GF_OPTION_TYPE_SIZET,
.min = 4 * GF_UNIT_MB,
- .max = 6 * GF_UNIT_GB
+ .max = 6 * GF_UNIT_GB,
+ .default_value = "32MB",
+ .description = "Size of the read cache."
},
{ .key = {"min-file-size"},
.type = GF_OPTION_TYPE_SIZET,
+ .default_value = "0",
+ .description = "Minimum file size which would be cached by the "
+ "io-cache translator."
},
{ .key = {"max-file-size"},
.type = GF_OPTION_TYPE_SIZET,
+ .default_value = "0",
+ .description = "Maximum file size which would be cached by the "
+ "io-cache translator."
},
{ .key = {NULL} },
};
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 83a7d40aa90..a19a14f0f1c 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -36,7 +36,7 @@
void *iot_worker (void *arg);
int iot_workers_scale (iot_conf_t *conf);
int __iot_workers_scale (iot_conf_t *conf);
-
+struct volume_options options[];
call_stub_t *
__iot_dequeue (iot_conf_t *conf)
@@ -2157,11 +2157,12 @@ int
init (xlator_t *this)
{
iot_conf_t *conf = NULL;
- dict_t *options = this->options;
+ dict_t *xl_options = this->options;
int thread_count = IOT_DEFAULT_THREADS;
int idle_time = IOT_DEFAULT_IDLE;
int ret = -1;
int i = 0;
+ char *def_val = NULL;
if (!this->children || this->children->next) {
gf_log ("io-threads", GF_LOG_ERROR,
@@ -2196,10 +2197,23 @@ init (xlator_t *this)
set_stack_size (conf);
- thread_count = IOT_DEFAULT_THREADS;
+ if (xlator_get_volopt_info (&this->volume_options, "thread-count",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "thread-count not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2int32 (def_val, &conf->max_count)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "thread corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
- if (dict_get (options, "thread-count")) {
- thread_count = data_to_int32 (dict_get (options,
+ if (dict_get (xl_options, "thread-count")) {
+ thread_count = data_to_int32 (dict_get (xl_options,
"thread-count"));
if (thread_count < IOT_MIN_THREADS) {
gf_log ("io-threads", GF_LOG_WARNING,
@@ -2216,8 +2230,8 @@ init (xlator_t *this)
}
conf->max_count = thread_count;
- if (dict_get (options, "idle-time")) {
- idle_time = data_to_int32 (dict_get (options,
+ if (dict_get (xl_options, "idle-time")) {
+ idle_time = data_to_int32 (dict_get (xl_options,
"idle-time"));
if (idle_time < 0)
idle_time = 1;
@@ -2304,7 +2318,11 @@ struct volume_options options[] = {
{ .key = {"thread-count"},
.type = GF_OPTION_TYPE_INT,
.min = IOT_MIN_THREADS,
- .max = IOT_MAX_THREADS
+ .max = IOT_MAX_THREADS,
+ .default_value = "16",
+ .description = "Number of threads in IO threads translator which "
+ "perform concurrent IO operations"
+
},
{.key = {"idle-time"},
.type = GF_OPTION_TYPE_INT,
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index d04ea4fc60d..d0fbdb050b3 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -22,6 +22,8 @@
#define QR_DEFAULT_CACHE_SIZE 134217728
+struct volume_options options[];
+
void
qr_local_free (qr_local_t *local)
{
@@ -3477,6 +3479,7 @@ init (xlator_t *this)
int32_t ret = -1, i = 0;
qr_private_t *priv = NULL;
qr_conf_t *conf = NULL;
+ char *def_val = NULL;
if (!this->children || this->children->next) {
gf_log (this->name, GF_LOG_ERROR,
@@ -3526,7 +3529,21 @@ init (xlator_t *this)
}
}
- conf->cache_size = QR_DEFAULT_CACHE_SIZE;
+ if (xlator_get_volopt_info (&this->volume_options, "cache-size",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2bytesize (def_val, &conf->cache_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = dict_get_str (this->options, "cache-size", &str);
if (ret == 0) {
ret = gf_string2bytesize (str, &conf->cache_size);
@@ -3618,6 +3635,8 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_SIZET,
.min = 0,
.max = 6 * GF_UNIT_GB,
+ .default_value = "128MB",
+ .description = "Size of the read cache."
},
{ .key = {"cache-timeout"},
.type = GF_OPTION_TYPE_INT,
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 47911d8a137..1a8bfe7df58 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2977,6 +2977,7 @@ init (xlator_t *this)
wb_conf_t *conf = NULL;
char *str = NULL;
int32_t ret = -1;
+ char *def_val = NULL;
if ((this->children == NULL)
|| this->children->next) {
@@ -3029,7 +3030,21 @@ init (xlator_t *this)
conf->disable_till);
/* configure 'option window-size <size>' */
- conf->window_size = WB_WINDOW_SIZE;
+ if (xlator_get_volopt_info (&this->volume_options, "cache-size",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2bytesize (def_val, &conf->window_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = dict_get_str (options, "cache-size", &str);
if (ret == 0) {
ret = gf_string2bytesize (str, &conf->window_size);
@@ -3060,7 +3075,22 @@ init (xlator_t *this)
}
/* configure 'option flush-behind <on/off>' */
- conf->flush_behind = 1;
+
+ if (xlator_get_volopt_info (&this->volume_options, "flush-behind",
+ &def_val, NULL)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size not found");
+ ret = -1;
+ goto out;
+ } else {
+ if (gf_string2boolean (def_val, &conf->flush_behind)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size corrupt");
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = dict_get_str (options, "flush-behind", &str);
if (ret == 0) {
ret = gf_string2boolean (str, &conf->flush_behind);
@@ -3141,12 +3171,21 @@ struct xlator_dumpops dumpops = {
struct volume_options options[] = {
{ .key = {"flush-behind"},
- .type = GF_OPTION_TYPE_BOOL
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .description = "If this option is set ON, instructs write-behind "
+ "translator to perform flush in background, by "
+ "returning success (or any errors, if any of "
+ "previous writes were failed) to application even "
+ "before flush is sent to backend filesystem. "
},
{ .key = {"cache-size", "window-size"},
.type = GF_OPTION_TYPE_SIZET,
.min = 512 * GF_UNIT_KB,
- .max = 1 * GF_UNIT_GB
+ .max = 1 * GF_UNIT_GB,
+ .default_value = "1MB",
+ .description = "Size of the per-file write-behind buffer. "
+
},
{ .key = {"disable-for-first-nbytes"},
.type = GF_OPTION_TYPE_SIZET,