diff options
author | Kaushik BV <kbudiger@redhat.com> | 2012-01-30 19:17:12 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-03 09:23:37 -0800 |
commit | 5ebc522717ef891c138307d02dcbc0bc1e9017f8 (patch) | |
tree | 642c3baa4e4fc7abf1b64d978f442a34ac3c46f6 /xlators/performance/read-ahead | |
parent | 9636f5b16c1847bc94d42ca6ac948c680bd55f2e (diff) |
read-ahead: add performance.read-ahead--page-count option to 'volume set' framework
Change-Id: I727be1ae2e3da1816afa52fc9555269aa07c39c1
BUG: 783379
Signed-off-by: Kaushik BV <kbudiger@redhat.com>
Reviewed-on: http://review.gluster.com/2700
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/performance/read-ahead')
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 928d8b7bdbc..b77715490fe 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -1009,11 +1009,28 @@ out: } int +reconfigure (xlator_t *this, dict_t *options) +{ + ra_conf_t *conf = NULL; + int ret = -1; + + GF_VALIDATE_OR_GOTO ("read-ahead", this, out); + GF_VALIDATE_OR_GOTO ("read-ahead", this->private, out); + + conf = this->private; + + GF_OPTION_RECONF ("page-count", conf->page_count, options, uint32, out); + + ret = 0; + out: + return ret; +} + +int init (xlator_t *this) { ra_conf_t *conf = NULL; dict_t *options = NULL; - char *page_count_string = NULL; int32_t ret = -1; GF_VALIDATE_OR_GOTO ("read-ahead", this, out); @@ -1037,47 +1054,10 @@ init (xlator_t *this) } conf->page_size = this->ctx->page_size; - conf->page_count = 4; - - if (dict_get (options, "page-count")) { - page_count_string = data_to_str (dict_get (options, - "page-count")); - } - - if (page_count_string) { - if (gf_string2uint_base10 (page_count_string, &conf->page_count) - != 0) { - gf_log ("read-ahead", GF_LOG_ERROR, - "invalid number format \"%s\" of \"option " - "page-count\"", - page_count_string); - goto out; - } - - gf_log (this->name, GF_LOG_WARNING, - "Using conf->page_count = %u", conf->page_count); - } - if (dict_get (options, "force-atime-update")) { - char *force_atime_update_str = NULL; + GF_OPTION_INIT ("page-count", conf->page_count, uint32, out); - force_atime_update_str - = data_to_str (dict_get (options, - "force-atime-update")); - - if (gf_string2boolean (force_atime_update_str, - &conf->force_atime_update) == -1) { - gf_log (this->name, GF_LOG_ERROR, - "'force-atime-update' takes only boolean " - "options"); - goto out; - } - - if (conf->force_atime_update) { - gf_log (this->name, GF_LOG_WARNING, "Forcing atime " - "updates on cache hit"); - } - } + GF_OPTION_INIT ("force-atime-update", conf->force_atime_update, bool, out); conf->files.next = &conf->files; conf->files.prev = &conf->files; @@ -1141,12 +1121,15 @@ struct xlator_dumpops dumpops = { struct volume_options options[] = { { .key = {"force-atime-update"}, - .type = GF_OPTION_TYPE_BOOL + .type = GF_OPTION_TYPE_BOOL, + .default_value = "false" }, { .key = {"page-count"}, .type = GF_OPTION_TYPE_INT, .min = 1, - .max = 16 + .max = 16, + .default_value = "4", + .description = "Number of pages that will be pre-fetched" }, { .key = {NULL} }, }; |