1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-04 09:18:36 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2014-11-02 17:03:14 +01:00
parent 127cf4895a
commit 969ab6bbf0
2 changed files with 9 additions and 9 deletions

View File

@ -171,9 +171,12 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
struct lv_segment *seg; struct lv_segment *seg;
if (!validate_lv_cache_create_pool(pool_lv) || if (!validate_lv_cache_create_pool(pool_lv) ||
!validate_lv_cache_create_origin(origin_lv)) !validate_lv_cache_create_origin(cache_lv))
return_NULL; 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"))) if (!(segtype = get_segtype_from_string(cmd, "cache")))
return_NULL; return_NULL;

View 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 *pool_lv = lp->pool_data_lv;
struct logical_volume *cache_lv; struct logical_volume *cache_lv;
if (!validate_lv_cache_create_pool(pool_lv) || if (!validate_lv_cache_create_pool(pool_lv))
!validate_lv_cache_create_origin(origin_lv))
return_0; return_0;
if (!archive(origin_lv->vg)) if (!archive(origin_lv->vg))
@ -3254,12 +3253,10 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_PROCESSED; return ECMD_PROCESSED;
} }
if (lp->cache) { /* Validate origin prior we start conversion of pool */
if (lv_is_thin_pool(lv)) if (lp->cache &&
lv = seg_lv(first_seg(lv), 0); /* cache _tdata */ !validate_lv_cache_create_origin(lv))
if (!validate_lv_cache_create_origin(lv)) return_ECMD_FAILED;
return_ECMD_FAILED;
}
if (lp->thin) { if (lp->thin) {
if (lv_is_cache_type(lv) || if (lv_is_cache_type(lv) ||