mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
writecache: working real dm uuid suffix for wcorig lv
This commit is contained in:
parent
4829f27b76
commit
8153c5f1e6
@ -3316,6 +3316,10 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
|
|||||||
if (!layer && lv_is_new_thin_pool(lv))
|
if (!layer && lv_is_new_thin_pool(lv))
|
||||||
layer = lv_layer(lv);
|
layer = lv_layer(lv);
|
||||||
|
|
||||||
|
/* Adds -real to the dm uuid of wcorig LV. */
|
||||||
|
if (!layer && lv_is_writecache_origin(lv))
|
||||||
|
layer = lv_layer(lv); /* "real" */
|
||||||
|
|
||||||
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
|
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
|
@ -830,7 +830,7 @@ const char *lv_layer(const struct logical_volume *lv)
|
|||||||
if (lv_is_vdo_pool(lv))
|
if (lv_is_vdo_pool(lv))
|
||||||
return "vpool";
|
return "vpool";
|
||||||
|
|
||||||
if (lv_is_origin(lv) || lv_is_external_origin(lv))
|
if (lv_is_origin(lv) || lv_is_external_origin(lv) || lv_is_writecache_origin(lv))
|
||||||
return "real";
|
return "real";
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -24,15 +24,15 @@
|
|||||||
|
|
||||||
int lv_is_writecache_origin(const struct logical_volume *lv)
|
int lv_is_writecache_origin(const struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
struct seg_list *sl;
|
struct lv_segment *seg;
|
||||||
|
|
||||||
dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
|
/* Make sure there's exactly one segment in segs_using_this_lv! */
|
||||||
if (!sl->seg || !sl->seg->lv || !sl->seg->origin)
|
if (dm_list_empty(&lv->segs_using_this_lv) ||
|
||||||
continue;
|
(dm_list_size(&lv->segs_using_this_lv) > 1))
|
||||||
if (lv_is_writecache(sl->seg->lv) && (sl->seg->origin == lv))
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
seg = get_only_segment_using_this_lv(lv);
|
||||||
return 0;
|
return seg && lv_is_writecache(seg->lv) && !lv_is_pending_delete(seg->lv) && (seg_lv(seg, 0) == lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lv_is_writecache_cachevol(const struct logical_volume *lv)
|
int lv_is_writecache_cachevol(const struct logical_volume *lv)
|
||||||
|
@ -251,6 +251,7 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
|
|||||||
*/
|
*/
|
||||||
/* Suffixes used here MUST match lib/activate/dev_manager.c */
|
/* Suffixes used here MUST match lib/activate/dev_manager.c */
|
||||||
layer = lv_is_cache_origin(lv) ? "real" :
|
layer = lv_is_cache_origin(lv) ? "real" :
|
||||||
|
lv_is_writecache_origin(lv) ? "real" :
|
||||||
(lv_is_cache(lv) && lv_is_pending_delete(lv)) ? "real" :
|
(lv_is_cache(lv) && lv_is_pending_delete(lv)) ? "real" :
|
||||||
lv_is_cache_pool_data(lv) ? "cdata" :
|
lv_is_cache_pool_data(lv) ? "cdata" :
|
||||||
lv_is_cache_pool_metadata(lv) ? "cmeta" :
|
lv_is_cache_pool_metadata(lv) ? "cmeta" :
|
||||||
|
@ -260,7 +260,7 @@ static int _writecache_add_target_line(struct dev_manager *dm,
|
|||||||
if ((pmem = lv_on_pmem(seg->writecache)) < 0)
|
if ((pmem = lv_on_pmem(seg->writecache)) < 0)
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), NULL)))
|
if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), "real")))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))
|
if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))
|
||||||
|
@ -5537,6 +5537,8 @@ static struct logical_volume *_lv_writecache_create(struct cmd_context *cmd,
|
|||||||
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_WRITECACHE)))
|
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_WRITECACHE)))
|
||||||
return_NULL;
|
return_NULL;
|
||||||
|
|
||||||
|
lv->status |= WRITECACHE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "lv_wcorig" is a new LV with new id, but with the segments from "lv".
|
* "lv_wcorig" is a new LV with new id, but with the segments from "lv".
|
||||||
* "lv" keeps the existing name and id, but gets a new writecache segment,
|
* "lv" keeps the existing name and id, but gets a new writecache segment,
|
||||||
|
Loading…
Reference in New Issue
Block a user