summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-05-11 15:26:30 +0000
committerAlasdair Kergon <agk@redhat.com>2012-05-11 15:26:30 +0000
commitb63eb871fd2980b358b41bc6c4aaed5841f6c62b (patch)
tree1ff1e703ea0e14971e533ba84ee98b894c1c07f4
parentdcc18799ecb4822a57a65dead6f78cf9a466b567 (diff)
downloadlvm2-b63eb871fd2980b358b41bc6c4aaed5841f6c62b.tar.gz
Refactor _has_matching_pv_tag to provide a fn that takes PV structs.
-rw-r--r--lib/metadata/lv_manip.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f8765a67a..727d3d9f3 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1248,13 +1248,13 @@ static int _is_same_pv(struct pv_match *pvmatch __attribute((unused)), struct pv
* Does PV area have a tag listed in allocation/cling_tag_list that
* matches a tag of the PV of the existing segment?
*/
-static int _has_matching_pv_tag(struct pv_match *pvmatch, struct pv_segment *pvseg, struct pv_area *pva)
+static int _pvs_have_matching_tag(const struct dm_config_node *cling_tag_list_cn, struct physical_volume *pv1, struct physical_volume *pv2)
{
const struct dm_config_value *cv;
const char *str;
const char *tag_matched;
- for (cv = pvmatch->cling_tag_list_cn->v; cv; cv = cv->next) {
+ for (cv = cling_tag_list_cn->v; cv; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
log_error("Ignoring invalid string in config file entry "
"allocation/cling_tag_list");
@@ -1283,21 +1283,21 @@ static int _has_matching_pv_tag(struct pv_match *pvmatch, struct pv_segment *pvs
/* Wildcard matches any tag against any tag. */
if (!strcmp(str, "*")) {
- if (!str_list_match_list(&pvseg->pv->tags, &pva->map->pv->tags, &tag_matched))
+ if (!str_list_match_list(&pv1->tags, &pv2->tags, &tag_matched))
continue;
else {
log_debug("Matched allocation PV tag %s on existing %s with free space on %s.",
- tag_matched, pv_dev_name(pvseg->pv), pv_dev_name(pva->map->pv));
+ tag_matched, pv_dev_name(pv1), pv_dev_name(pv2));
return 1;
}
}
- if (!str_list_match_item(&pvseg->pv->tags, str) ||
- !str_list_match_item(&pva->map->pv->tags, str))
+ if (!str_list_match_item(&pv1->tags, str) ||
+ !str_list_match_item(&pv2->tags, str))
continue;
else {
log_debug("Matched allocation PV tag %s on existing %s with free space on %s.",
- str, pv_dev_name(pvseg->pv), pv_dev_name(pva->map->pv));
+ str, pv_dev_name(pv1), pv_dev_name(pv2));
return 1;
}
}
@@ -1305,6 +1305,11 @@ static int _has_matching_pv_tag(struct pv_match *pvmatch, struct pv_segment *pvs
return 0;
}
+static int _has_matching_pv_tag(struct pv_match *pvmatch, struct pv_segment *pvseg, struct pv_area *pva)
+{
+ return _pvs_have_matching_tag(pvmatch->cling_tag_list_cn, pvseg->pv, pva->map->pv);
+}
+
/*
* Is PV area contiguous to PV segment?
*/