summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-07-15 01:20:15 +0000
committerAnand Avati <avati@gluster.com>2011-07-17 07:47:00 -0700
commitc9b5f595fa6471997a90113bd7f5a708f1bc67a4 (patch)
treec9dbb4fdcfd28456c343adc500e21a9a8b17da5f
parentcb071504b4d20965f844466a444e38b839cf02db (diff)
write-behind: changes in volume_options to assist
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2041 (volume set help option) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
-rw-r--r--xlators/performance/write-behind/src/write-behind.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 952de57b7b6..959826673a1 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2880,6 +2880,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) {
@@ -2939,7 +2940,20 @@ 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");
+ return -1;
+ } else {
+ if (gf_string2bytesize (def_val, &conf->window_size)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size corrupt");
+ return -1;
+ }
+ }
+
+
ret = dict_get_str (options, "cache-size",
&str);
if (ret == 0) {
@@ -2973,7 +2987,21 @@ 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");
+ return -1;
+ } else {
+ if (gf_string2boolean (def_val, &conf->flush_behind)) {
+ gf_log (this->name, GF_LOG_ERROR, "Default value of "
+ "cache-size corrupt");
+ return -1;
+ }
+ }
+
+
ret = dict_get_str (options, "flush-behind",
&str);
if (ret == 0) {
@@ -3049,12 +3077,20 @@ 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,