]> sourceware.org Git - lvm2.git/commitdiff
Refactor _has_matching_pv_tag to provide a fn that takes PV structs.
authorAlasdair Kergon <agk@redhat.com>
Fri, 11 May 2012 15:26:30 +0000 (15:26 +0000)
committerAlasdair Kergon <agk@redhat.com>
Fri, 11 May 2012 15:26:30 +0000 (15:26 +0000)
lib/metadata/lv_manip.c

index f8765a67a517d89564f816f6ba9e41259940d085..727d3d9f38ef1965578449a91129bb5f764cb97e 100644 (file)
@@ -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?
  */
This page took 0.059619 seconds and 5 git commands to generate.