1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lv_manip: fix move_lv_segments moved bits

For proper functionality of insert_layer_for_lv we need to
move more bits to layerd LV.

Add some missing new types and correct usage of caller,
so the new LV type is set after the movement.
This commit is contained in:
Zdenek Kabelac 2023-07-10 15:43:49 +02:00
parent e022805f1d
commit 077b46e014
4 changed files with 16 additions and 8 deletions

View File

@ -421,7 +421,7 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_CACHE)))
return_NULL;
if (!insert_layer_for_lv(cmd, cache_lv, CACHE, "_corig"))
if (!insert_layer_for_lv(cmd, cache_lv, 0, "_corig"))
return_NULL;
seg = first_seg(cache_lv);

View File

@ -677,7 +677,7 @@ int lv_add_integrity_to_raid(struct logical_volume *lv, struct integrity_setting
* but gets a new integrity segment, in place of the segments
* that were moved to lv_iorig.
*/
if (!insert_layer_for_lv(cmd, lv_image, INTEGRITY, "_iorig"))
if (!insert_layer_for_lv(cmd, lv_image, 0, "_iorig"))
goto_bad;
lv_image->status |= INTEGRITY;

View File

@ -8213,7 +8213,17 @@ int move_lv_segments(struct logical_volume *lv_to,
struct logical_volume *lv_from,
uint64_t set_status, uint64_t reset_status)
{
const uint64_t MOVE_BITS = (RAID | MIRROR | THIN_VOLUME | CACHE | LV_VDO);
const uint64_t MOVE_BITS = (CACHE |
CACHE_POOL |
INTEGRITY |
LV_CACHE_VOL |
LV_VDO |
LV_VDO_POOL |
MIRROR |
RAID |
THIN_POOL |
THIN_VOLUME |
WRITECACHE);
struct lv_segment *seg;
dm_list_iterate_items(seg, &lv_to->segments)

View File

@ -5876,23 +5876,21 @@ static struct logical_volume *_lv_writecache_create(struct cmd_context *cmd,
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_WRITECACHE)))
return_NULL;
lv->status |= WRITECACHE;
/*
* "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,
* in place of the segments that were moved to lv_wcorig.
*/
if (!(lv_wcorig = insert_layer_for_lv(cmd, lv, WRITECACHE, "_wcorig")))
if (!(lv_wcorig = insert_layer_for_lv(cmd, lv, 0, "_wcorig")))
return_NULL;
lv_set_hidden(lv_fast);
lv->status |= WRITECACHE;
seg = first_seg(lv);
seg->segtype = segtype;
seg->writecache = lv_fast;
lv_set_hidden(lv_fast);
/* writecache_block_size is in bytes */
seg->writecache_block_size = block_size_sectors * 512;