diff options
-rwxr-xr-x | tests/basic/tier/tier.t | 1 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 1 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-shared.c | 4 | ||||
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 24 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 11 |
5 files changed, 41 insertions, 0 deletions
diff --git a/tests/basic/tier/tier.t b/tests/basic/tier/tier.t index 5874a9b6e83..deff2e299ef 100755 --- a/tests/basic/tier/tier.t +++ b/tests/basic/tier/tier.t @@ -112,6 +112,7 @@ TEST $CLI volume set $V0 cluster.watermark-hi 85 TEST $CLI volume set $V0 cluster.watermark-low 75 TEST $CLI volume set $V0 cluster.tier-max-mb 1000 TEST $CLI volume set $V0 cluster.tier-max-files 1000 +TEST $CLI volume set $V0 cluster.tier-max-promote-file-size 1000 TEST ! $CLI volume set $V0 cluster.tier-max-files -3 TEST ! $CLI volume set $V0 cluster.watermark-low 90 TEST ! $CLI volume set $V0 cluster.read-freq-threshold -12 diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index d9b52e28bb9..6ba94ec8814 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -357,6 +357,7 @@ typedef struct gf_tier_conf { uint64_t max_migrate_bytes; int max_migrate_files; tier_mode_t mode; + int tier_max_promote_size; int tier_promote_frequency; int tier_demote_frequency; uint64_t st_last_promoted_size; diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c index e3e7fadca3f..856819ac052 100644 --- a/xlators/cluster/dht/src/dht-shared.c +++ b/xlators/cluster/dht/src/dht-shared.c @@ -1032,6 +1032,10 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_INT, .default_value = "4000", }, + { .key = {"tier-max-promote-file-size"}, + .type = GF_OPTION_TYPE_INT, + .default_value = "0", + }, { .key = {"tier-max-files"}, .type = GF_OPTION_TYPE_INT, .default_value = "10000", diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 007cfc60c5a..b99497bc66a 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -724,6 +724,17 @@ tier_migrate_using_query_file (void *_args) per_link_status = -1; goto abort; } + + if (query_cbk_args->is_promotion && + defrag->tier_conf.tier_max_promote_size && + (current.ia_size > defrag->tier_conf.tier_max_promote_size)) { + gf_msg (this->name, GF_LOG_INFO, 0, + DHT_MSG_LOG_TIER_STATUS, + "File size exceeds maxsize for promotion. "); + per_link_status = 1; + goto abort; + } + linked_inode = inode_link (loc.inode, NULL, NULL, ¤t); inode_unref (loc.inode); @@ -2079,6 +2090,7 @@ tier_init (xlator_t *this) { int ret = -1; int freq = 0; + int maxsize = 0; dht_conf_t *conf = NULL; gf_defrag_info_t *defrag = NULL; char *voldir = NULL; @@ -2130,6 +2142,14 @@ tier_init (xlator_t *this) defrag->tier_conf.is_tier = 1; ret = dict_get_int32 (this->options, + "tier-max-promote-file-size", &maxsize); + if (ret) { + maxsize = 0; + } + + defrag->tier_conf.tier_max_promote_size = maxsize; + + ret = dict_get_int32 (this->options, "tier-promote-frequency", &freq); if (ret) { freq = DEFAULT_PROMOTE_FREQ_SEC; @@ -2316,6 +2336,10 @@ tier_reconfigure (xlator_t *this, dict_t *options) if (conf->defrag) { defrag = conf->defrag; + GF_OPTION_RECONF ("tier-max-promote-file-size", + defrag->tier_conf.tier_max_promote_size, + options, int32, out); + GF_OPTION_RECONF ("tier-promote-frequency", defrag->tier_conf.tier_promote_frequency, options, int32, out); diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index 5d9aafeb661..d0e5efbd9a0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -452,6 +452,7 @@ validate_tier (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, } } else if (strstr (key, "tier-promote-frequency") || strstr (key, "tier-max-mb") || + strstr (key, "tier-max-promote-file-size") || strstr (key, "tier-max-files") || strstr (key, "tier-demote-frequency")) { if (origin_val < 1) { @@ -2496,6 +2497,16 @@ struct volopt_map_entry glusterd_volopt_map[] = { " Cache mode does so based on whether the cache is full or not," " as specified with watermarks." }, + { .key = "cluster.tier-max-promote-file-size", + .voltype = "cluster/tier", + .option = "tier-max-promote-file-size", + .value = "0", + .op_version = GD_OP_VERSION_3_7_10, + .flags = OPT_FLAG_CLIENT_OPT, + .validate_fn = validate_tier, + .description = "The maximum file size in bytes that is promoted. If 0, there" + " is no maximum size (default)." + }, { .key = "cluster.tier-max-mb", .voltype = "cluster/tier", .option = "tier-max-mb", |