summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-07-15 01:20:14 +0000
committerAnand Avati <avati@gluster.com>2011-07-17 07:46:54 -0700
commitcb071504b4d20965f844466a444e38b839cf02db (patch)
tree9e687abc94a02ba400d1f67b4266dad6c82e37b2 /xlators
parent3426188d20d0ee624b67198eca9eed9582122de3 (diff)
quick-read: changes in volume_options to assist volume set help/help-xml
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 BUG: 2041 (volume set help option) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/quick-read/src/quick-read.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index adee951cf46..6bcfb4466ee 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)
{
@@ -2653,6 +2655,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,
@@ -2705,7 +2708,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);
@@ -2802,6 +2819,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,