From: Zdenek Kabelac Date: Sun, 2 Nov 2014 16:03:14 +0000 (+0100) Subject: cache: convert thin-pool X-Git-Tag: v2_02_112~74 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=969ab6bbf02c11bf989ccc3105910a205448507b;p=lvm2.git cache: convert thin-pool Support caching of thin-pool. lvresize needs to be resolved - so far, user has to manually drop cache-pool before resizing. --- diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c index 44d1bd88c..e59a32f5e 100644 --- a/lib/metadata/cache_manip.c +++ b/lib/metadata/cache_manip.c @@ -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; diff --git a/tools/lvconvert.c b/tools/lvconvert.c index f37a7a832..a5127097d 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -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) ||