]> sourceware.org Git - lvm2.git/commitdiff
Use lv_activate_opts struct instead of ACTIVATE_EXCL status flag
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 17 Jun 2011 14:22:48 +0000 (14:22 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 17 Jun 2011 14:22:48 +0000 (14:22 +0000)
Let's hope all conditions has been properly converted.

WHATS_NEW
lib/activate/activate.c
lib/activate/dev_manager.c
lib/snapshot/snapshot.c

index eb520dc47ff4ce355aa9948895298a987712579a..ba7eaab833f962b3ae671819f21d6268770dc8f9 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.86 -  
 =================================
+  Use lv_activate_opts struct instead of MERGING status flag.
   Use lv_activate_opts struct instead of ACTIVATE_EXCL status flag.
   Add lv_activate_opts structure for activation (replacing activation flags).
   Fix a problem with inconsistent pre-commit metadata on MISSING_PV devices.
index 79b1b0414d85182f452cc321d18615347eff202f..1e8998af3028df22b8c26217f85bb3f331b10b6b 100644 (file)
@@ -986,8 +986,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
         * In case of a snapshot device, we monitor lv->snapshot->lv,
         * not the actual LV itself.
         */
-       if (lv_is_cow(lv) && !lv_is_merging_cow(lv))
-               return monitor_dev_for_events(cmd, lv->snapshot->lv, 0, monitor);
+       if (lv_is_cow(lv) && (laopts->no_merging || !lv_is_merging_cow(lv)))
+               return monitor_dev_for_events(cmd, lv->snapshot->lv, NULL, monitor);
 
        /*
         * In case this LV is a snapshot origin, we instead monitor
index 8465c79ea8468cb876b427c3408dd6133f4a7ba3..98f973ea7b5aac7c4226e87584e889c4464b17ef 100644 (file)
@@ -1276,7 +1276,7 @@ static int _add_snapshot_target_to_dtree(struct dev_manager *dm,
 
        size = (uint64_t) snap_seg->len * snap_seg->origin->vg->extent_size;
 
-       if (lv_is_merging_cow(lv)) {
+       if (!laopts->no_merging && lv_is_merging_cow(lv)) {
                /* cow is to be merged so load the error target */
                if (!dm_tree_node_add_error_target(dnode, size))
                        return_0;
@@ -1412,7 +1412,7 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
        /* If this is a snapshot origin, add real LV */
        /* If this is a snapshot origin + merging snapshot, add cow + real LV */
        } else if (lv_is_origin(seg->lv) && !layer) {
-               if (lv_is_merging_origin(seg->lv)) {
+               if (!laopts->no_merging && lv_is_merging_origin(seg->lv)) {
                        if (!_add_new_lv_to_dtree(dm, dtree,
                             find_merging_cow(seg->lv)->cow, laopts, "cow"))
                                return_0;
@@ -1423,7 +1423,7 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
                }
                if (!_add_new_lv_to_dtree(dm, dtree, seg->lv, laopts, "real"))
                        return_0;
-       } else if (lv_is_cow(seg->lv) && !layer) {
+       } else if (!laopts->no_merging && lv_is_cow(seg->lv) && !layer) {
                if (!_add_new_lv_to_dtree(dm, dtree, seg->lv, laopts, "cow"))
                        return_0;
        } else {
@@ -1437,14 +1437,14 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
 
        /* Now we've added its dependencies, we can add the target itself */
        if (lv_is_origin(seg->lv) && !layer) {
-               if (!lv_is_merging_origin(seg->lv)) {
+               if (laopts->no_merging || !lv_is_merging_origin(seg->lv)) {
                        if (!_add_origin_target_to_dtree(dm, dnode, seg->lv))
                                return_0;
                } else {
                        if (!_add_snapshot_merge_target_to_dtree(dm, dnode, seg->lv))
                                return_0;
                }
-       } else if (lv_is_cow(seg->lv) && !layer) {
+       } else if (!laopts->no_merging && lv_is_cow(seg->lv) && !layer) {
                if (!_add_snapshot_target_to_dtree(dm, dnode, seg->lv, laopts))
                        return_0;
        } else if (!_add_target_to_dtree(dm, dnode, seg, laopts))
@@ -1490,7 +1490,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
                                           dtree)) && dinfo->open_count)) {
                        /* FIXME Is there anything simpler to check for instead? */
                        if (!lv_has_target_type(dm->mem, lv, NULL, "snapshot-merge"))
-                               clear_snapshot_merge(lv);
+                               laopts->no_merging = 1;
                }
        }
 
@@ -1542,7 +1542,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
                /* These aren't real segments in the LVM2 metadata */
                if (lv_is_origin(lv) && !layer)
                        break;
-               if (lv_is_cow(lv) && !layer)
+               if (!laopts->no_merging && lv_is_cow(lv) && !layer)
                        break;
                if (max_stripe_size < seg->stripe_size * seg->area_count)
                        max_stripe_size = seg->stripe_size * seg->area_count;
index 3555f366b930a779ac5193ac3c4e5e8c02cb1045..8c48308952528cd8d4b486cd572e076cdf0ca786 100644 (file)
@@ -31,7 +31,7 @@ static const char *_snap_name(const struct lv_segment *seg)
 static const char *_snap_target_name(const struct lv_segment *seg,
                                     const struct lv_activate_opts *laopts)
 {
-       if (seg->status & MERGING)
+       if (!laopts->no_merging && (seg->status & MERGING))
                return "snapshot-merge";
 
        return _snap_name(seg);
This page took 0.044005 seconds and 5 git commands to generate.