]> sourceware.org Git - lvm2.git/commitdiff
Thin use origin_only for thin pools as well
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 25 Jan 2012 09:13:10 +0000 (09:13 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 25 Jan 2012 09:13:10 +0000 (09:13 +0000)
Extend the usage of origin_only flag to allow resume of thin pool LV
(when it's active) to pass only the messages.

origin_only flag will skip detection of already resumed tree for thin_pool,
so we do not need to suspend the tree and we just send messages.

lib/activate/activate.c
lib/metadata/thin_manip.c

index 36fe3df4318cab2ff16990e8eba377c89e7b376a..87e34ecf8256060c4af50047ba78621196946cea 100644 (file)
@@ -1508,6 +1508,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
        struct logical_volume *lv;
        struct lvinfo info;
        int r = 0;
+       int messages_only = 0;
 
        if (!activation())
                return 1;
@@ -1515,6 +1516,9 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
        if (!(lv = lv_from_lvid(cmd, lvid_s, 0)))
                goto_out;
 
+       if (lv_is_thin_pool(lv) && laopts->origin_only)
+               messages_only = 1;
+
        if (!lv_is_origin(lv))
                laopts->origin_only = 0;
 
@@ -1533,7 +1537,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
        if (!lv_info(cmd, lv, laopts->origin_only, &info, 0, 0))
                goto_out;
 
-       if (!info.exists || !info.suspended) {
+       if (!info.exists || !(info.suspended || messages_only)) {
                if (error_if_not_active)
                        goto_out;
                r = 1;
index 167e24c2a55c884a6a99cdc8a4e9c962cb0afb17..8b8e8a0243f417832593503b92c383316893ab76 100644 (file)
@@ -379,15 +379,11 @@ int update_pool_lv(struct logical_volume *lv, int activate)
                        if (!deactivate_lv(lv->vg->cmd, lv))
                                return_0;
                }
-               /* If already active, do suspend resume
-                *
-                * TODO: Support pool resume without suspend,
-                * since the real suspend is not needed here
+               /*
+                * Resume active pool to send thin messages.
+                * origin_only is used to skip check for resumed state
                 */
-               else if (!suspend_lv(lv->vg->cmd, lv)) {
-                       log_error("Failed to suspend %s.", lv->name);
-                       return 0;
-               } else if (!resume_lv(lv->vg->cmd, lv)) {
+               else if (!resume_lv_origin(lv->vg->cmd, lv)) {
                        log_error("Failed to resume %s.", lv->name);
                        return 0;
                }
This page took 0.036403 seconds and 5 git commands to generate.