diff options
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 46 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 29 | ||||
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 52 |
3 files changed, 113 insertions, 14 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 645388d46da..a662037e788 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -30,6 +30,8 @@ #endif #include "afr-common.c" +struct volume_options options[]; + int32_t notify (xlator_t *this, int32_t event, void *data, ...) @@ -377,6 +379,7 @@ init (xlator_t *this) char * strict_readdir = NULL; char * inodelk_trace = NULL; char * entrylk_trace = NULL; + char * def_val = NULL; int32_t background_count = 0; int32_t lock_server_count = 1; int32_t window_size = 0; @@ -437,16 +440,37 @@ init (xlator_t *this) } } - priv->data_self_heal_algorithm = ""; - + if (xlator_get_volopt_info (&this->volume_options, + "data-self-heal-algorithm", &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + " data-self-heal-algorithm not found"); + ret = -1; + goto out; + } else { + priv->data_self_heal_algorithm = def_val; + } dict_ret = dict_get_str (this->options, "data-self-heal-algorithm", &algo); if (dict_ret == 0) { priv->data_self_heal_algorithm = gf_strdup (algo); } - - priv->data_self_heal_window_size = 16; + if (xlator_get_volopt_info (&this->volume_options, + "data-self-heal-window-size",&def_val, + NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "data-self-heal-window-size not found"); + ret = -1; + goto out; + } else { + if (gf_string2int32 (def_val, + (int *)&priv->data_self_heal_window_size)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "data-self-heal-window-size corrupt"); + ret = -1; + goto out; + } + } dict_ret = dict_get_int32 (this->options, "data-self-heal-window-size", &window_size); @@ -808,12 +832,22 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_BOOL }, { .key = {"data-self-heal-algorithm"}, - .type = GF_OPTION_TYPE_STR + .type = GF_OPTION_TYPE_STR, + .default_value = "", + .description = "Select between \"full\", \"diff\". The " + "\"full\" algorithm copies the entire file from " + "source to sink. The \"diff\" algorithm copies to " + "sink only those blocks whose checksums don't match " + "with those of source.", + .value = { "diff", "full" } }, { .key = {"data-self-heal-window-size"}, .type = GF_OPTION_TYPE_INT, .min = 1, - .max = 1024 + .max = 1024, + .default_value = "16", + .description = "Maximum number blocks per file for which self-heal " + "process would be applied simultaneously." }, { .key = {"metadata-self-heal"}, .type = GF_OPTION_TYPE_BOOL diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index ffdcce34048..0958a8babb6 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -34,7 +34,7 @@ - handle all cases in self heal layout reconstruction - complete linkfile selfheal */ - +struct volume_options options[]; void dht_layout_dump (dht_layout_t *layout, const char *prefix) @@ -359,6 +359,7 @@ init (xlator_t *this) int ret = -1; int i = 0; uint32_t temp_free_disk = 0; + char *def_val = NULL; GF_VALIDATE_OR_GOTO ("dht", this, err); @@ -401,8 +402,27 @@ init (xlator_t *this) gf_string2boolean (temp_str, &conf->use_readdirp); } - conf->disk_unit = 'p'; - conf->min_free_disk = 10; + if (xlator_get_volopt_info (&this->volume_options, "min-free-disk", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + " min-free-disk not found"); + ret = -1; + goto err; + } else { + if (gf_string2percent (def_val, &temp_free_disk) == 0) { + if (temp_free_disk > 100) { + gf_string2bytesize (temp_str, + &conf->min_free_disk); + conf->disk_unit = 'b'; + } else { + conf->min_free_disk = (uint64_t)temp_free_disk; + conf->disk_unit = 'p'; + } + } else { + gf_string2bytesize (temp_str, &conf->min_free_disk); + conf->disk_unit = 'b'; + } + } if (dict_get_str (this->options, "min-free-disk", &temp_str) == 0) { if (gf_string2percent (temp_str, &temp_free_disk) == 0) { @@ -550,6 +570,9 @@ struct volume_options options[] = { }, { .key = {"min-free-disk"}, .type = GF_OPTION_TYPE_PERCENT_OR_SIZET, + .default_value = "10%", + .description = "Percentage/Size of disk space that must be " + "kept free." }, { .key = {"unhashed-sticky-bit"}, .type = GF_OPTION_TYPE_BOOL diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 5dcf1951304..81f37a57277 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -37,6 +37,8 @@ #include "libxlator.h" #include "byte-order.h" +struct volume_options options[]; + void stripe_local_wipe (stripe_local_t *local) { @@ -4030,6 +4032,7 @@ init (xlator_t *this) stripe_private_t *priv = NULL; xlator_list_t *trav = NULL; data_t *data = NULL; + char *def_blk_size = NULL; int32_t count = 0; int ret = -1; @@ -4093,20 +4096,55 @@ init (xlator_t *this) goto out; } - priv->block_size = (128 * GF_UNIT_KB); + if (xlator_get_volopt_info (&this->volume_options, "block-size", + &def_blk_size, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of stripe " + "block-size corrupt"); + ret = -1; + goto out; + } else { + if (gf_string2bytesize (def_blk_size, &priv->block_size)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "stripe block-size corrupt"); + ret = -1; + goto out; + } + } + + /* option stripe-pattern *avi:1GB,*pdf:4096 */ data = dict_get (this->options, "block-size"); if (!data) { gf_log (this->name, GF_LOG_DEBUG, "No \"option block-size <x>\" given, defaulting " - "to 128KB"); + "to %s", def_blk_size); } else { ret = set_stripe_block_size (this, priv, data->data); if (ret) goto out; } - priv->xattr_supported = 1; + if (xlator_get_volopt_info (&this->volume_options, "use-xattr", + &def_blk_size, NULL)) { + ret = -1; + gf_log (this->name, GF_LOG_ERROR, + "error setting(default) hard check for extended" + " attribute"); + goto out; + + } + else { + if (gf_string2boolean (def_blk_size, + &priv->xattr_supported)) { + ret = -1; + gf_log (this->name, GF_LOG_ERROR, + "error setting(default) hard check for extended" + " attribute"); + goto out; + } + } + + data = dict_get (this->options, "use-xattr"); if (data) { if (gf_string2boolean (data->data, @@ -4364,10 +4402,14 @@ struct xlator_cbks cbks = { struct volume_options options[] = { { .key = {"block-size"}, - .type = GF_OPTION_TYPE_ANY + .type = GF_OPTION_TYPE_ANY, + .default_value = "128KB", + .description = "Size of the stripe unit that would be read " + "from or written to the striped servers." }, { .key = {"use-xattr"}, - .type = GF_OPTION_TYPE_BOOL + .type = GF_OPTION_TYPE_BOOL, + .default_value = "true" }, { .key = {NULL} }, }; |