summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-04-27 12:55:52 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-05-05 23:34:35 +0200
commitd0111563c2ffd4026ea45dc38c97d4210d903889 (patch)
tree3e3abeff56ccb53db3bb32584b38f4e0b193dc15
parentfd79027cae16be4f7fcae98568c2063ac37c9e3a (diff)
downloadlvm2-d0111563c2ffd4026ea45dc38c97d4210d903889.tar.gz
debug: enhance debug msg for cache
-rw-r--r--lib/cache_segtype/cache.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index b3edff8e3..0cbb993ca 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -211,8 +211,11 @@ static int _target_present(struct cmd_context *cmd,
unsigned cache_alias;
const char feature[12];
const char module[12]; /* check dm-%s */
+ const char *aliasing;
} _features[] = {
- { 1, 9, 0, CACHE_FEATURE_POLICY_MQ, "policy_smq", "cache-smq" },
+ /* Assumption: cache >=1.9 always aliases MQ policy */
+ { 1, 9, CACHE_FEATURE_POLICY_SMQ, CACHE_FEATURE_POLICY_MQ, "policy_smq", "cache-smq",
+ " and aliases cache-mq" },
{ 1, 8, CACHE_FEATURE_POLICY_SMQ, 0, "policy_smq", "cache-smq" },
{ 1, 3, CACHE_FEATURE_POLICY_MQ, 0, "policy_mq", "cache-mq" },
};
@@ -245,16 +248,17 @@ static int _target_present(struct cmd_context *cmd,
return 0;
}
-
for (i = 0; i < DM_ARRAY_SIZE(_features); ++i) {
+ if (_attrs & _features[i].cache_feature)
+ continue; /* already present */
if (((maj > _features[i].maj) ||
(maj == _features[i].maj && min >= _features[i].min)) &&
- (!_features[i].module[0] ||
- (_attrs & _features[i].cache_feature) || /* already present */
- module_present(cmd, _features[i].module)))
- _attrs |= _features[i].cache_feature |
- _features[i].cache_alias;
- else
+ module_present(cmd, _features[i].module)) {
+ log_debug_activation("Cache policy %s is available%s.",
+ _features[i].module,
+ _features[i].aliasing ? : "");
+ _attrs |= (_features[i].cache_feature | _features[i].cache_alias);
+ } else if (!_features[i].cache_alias)
log_very_verbose("Target %s does not support %s.",
_cache_module, _features[i].feature);
}