diff options
author | David Teigland <teigland@redhat.com> | 2020-02-17 12:14:13 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2020-02-17 13:07:06 -0600 |
commit | 4829f27b76742ed663de0a11babb5b9a5985b741 (patch) | |
tree | fb7d8a5852fa1247a51aecf3cdcc0bcec2217f12 | |
parent | db1d66859f8086467979b2d7e32843f70e4436e1 (diff) | |
download | lvm2-4829f27b76742ed663de0a11babb5b9a5985b741.tar.gz |
writecache: drop real dm suffix
fixes the problem of adding writecache to an active LV
-rw-r--r-- | lib/misc/lvm-string.c | 1 | ||||
-rw-r--r-- | lib/writecache/writecache.c | 2 | ||||
-rw-r--r-- | test/shell/writecache.sh | 36 |
3 files changed, 37 insertions, 2 deletions
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c index 0ee3403d5..d8b27cb84 100644 --- a/lib/misc/lvm-string.c +++ b/lib/misc/lvm-string.c @@ -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" : diff --git a/lib/writecache/writecache.c b/lib/writecache/writecache.c index 130922a54..08a306e88 100644 --- a/lib/writecache/writecache.c +++ b/lib/writecache/writecache.c @@ -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"))) diff --git a/test/shell/writecache.sh b/test/shell/writecache.sh index 6cd46654e..0a7f694bb 100644 --- a/test/shell/writecache.sh +++ b/test/shell/writecache.sh @@ -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 |