]> sourceware.org Git - lvm2.git/commitdiff
cache: convert thin-pool
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 2 Nov 2014 16:03:14 +0000 (17:03 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 3 Nov 2014 13:19:33 +0000 (14:19 +0100)
Support caching of thin-pool.

lvresize needs to be resolved - so far, user
has to manually drop cache-pool before resizing.

lib/metadata/cache_manip.c
tools/lvconvert.c

index 44d1bd88cfd7d371102e561ca7913b76190c23d5..e59a32f5ed53f9673eae9bfff67b6b7c8a143051 100644 (file)
@@ -171,9 +171,12 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
        struct lv_segment *seg;
 
        if (!validate_lv_cache_create_pool(pool_lv) ||
-           !validate_lv_cache_create_origin(origin_lv))
+           !validate_lv_cache_create_origin(cache_lv))
                return_NULL;
 
+       if (lv_is_thin_pool(cache_lv))
+               cache_lv = seg_lv(first_seg(cache_lv), 0); /* cache _tdata */
+
        if (!(segtype = get_segtype_from_string(cmd, "cache")))
                return_NULL;
 
index f37a7a8329f391e96be9d02a652a26ba0d5b9213..a5127097dcc2da0724c2f69973fc87ab0f6d9079 100644 (file)
@@ -3188,8 +3188,7 @@ static int _lvconvert_cache(struct cmd_context *cmd,
        struct logical_volume *pool_lv = lp->pool_data_lv;
        struct logical_volume *cache_lv;
 
-       if (!validate_lv_cache_create_pool(pool_lv) ||
-           !validate_lv_cache_create_origin(origin_lv))
+       if (!validate_lv_cache_create_pool(pool_lv))
                return_0;
 
        if (!archive(origin_lv->vg))
@@ -3254,12 +3253,10 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
                return ECMD_PROCESSED;
        }
 
-       if (lp->cache) {
-               if (lv_is_thin_pool(lv))
-                       lv = seg_lv(first_seg(lv), 0); /* cache _tdata */
-               if (!validate_lv_cache_create_origin(lv))
-                       return_ECMD_FAILED;
-       }
+       /* Validate origin prior we start conversion of pool */
+       if (lp->cache &&
+           !validate_lv_cache_create_origin(lv))
+               return_ECMD_FAILED;
 
        if (lp->thin) {
                if (lv_is_cache_type(lv) ||
This page took 0.0402400000000001 seconds and 5 git commands to generate.