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

writecache: drop real dm suffix

fixes the problem of adding writecache to an active LV
This commit is contained in:
David Teigland 2020-02-17 12:14:13 -06:00
parent db1d66859f
commit 4829f27b76
3 changed files with 37 additions and 2 deletions

View File

@ -251,7 +251,6 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
*/
/* Suffixes used here MUST match lib/activate/dev_manager.c */
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_pool_data(lv) ? "cdata" :
lv_is_cache_pool_metadata(lv) ? "cmeta" :

View File

@ -260,7 +260,7 @@ static int _writecache_add_target_line(struct dev_manager *dm,
if ((pmem = lv_on_pmem(seg->writecache)) < 0)
return_0;
if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), "real")))
if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), NULL)))
return_0;
if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))

View File

@ -127,5 +127,41 @@ umount $mount_dir
lvchange -an $vg/$lv1
lvchange -an $vg/$lv2
# test3: attach writecache to an active LV
lvchange -ay $vg/$lv1
mkfs.xfs -f -s size=4096 "$DM_DEV_DIR/$vg/$lv1"
mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
cp pattern1 $mount_dir/pattern1
ls -l $mount_dir
lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1
check lv_field $vg/$lv1 segtype writecache
lvs -a $vg/${lv2}_cvol --noheadings -o segtype >out
grep linear out
cp pattern1 $mount_dir/pattern1.after
diff pattern1 $mount_dir/pattern1
diff pattern1 $mount_dir/pattern1.after
umount $mount_dir
lvchange -an $vg/$lv1
lvchange -ay $vg/$lv1
mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
diff pattern1 $mount_dir/pattern1
diff pattern1 $mount_dir/pattern1.after
umount $mount_dir
lvchange -an $vg/$lv1
lvremove $vg/$lv1
vgremove -ff $vg