master - man: lvmcache raid1 references
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c392ccaa470dbf1481c...
Commit: c392ccaa470dbf1481cbf1c9e899ce9c59f2caea
Parent: 9532bb577a82df454254ab65002f4be5bcc65060
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Feb 27 11:33:55 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 27 11:33:55 2020 -0600
man: lvmcache raid1 references
---
man/lvmcache.7_main | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index d8e8dc7..425904e 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -417,13 +417,13 @@ compact, and stores dirty bits in a separate btree, which improves the
speed of shutting down the cache. With \fBauto\fP, lvm selects the best
option provided by the current dm-cache kernel module.
-.SS mirrored cache device
+.SS RAID1 cache device
\&
-The fast LV holding the cache can be created as a raid1 mirror so that it
-can tolerate a device failure. (When using dm-cache with separate data
-and metadata LVs, each of the sub-LVs can use raid1.)
+RAID1 can be used to create the fast LV holding the cache so that it can
+tolerate a device failure. (When using dm-cache with separate data
+and metadata LVs, each of the sub-LVs can use RAID1.)
.nf
$ lvcreate -n main -L Size vg /dev/slow
3 years, 9 months
master - tests: validate vdo slab_size
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9532bb577a82df45425...
Commit: 9532bb577a82df454254ab65002f4be5bcc65060
Parent: d02d7bc560ef27d2a0e66d40f96519379d320735
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Feb 26 13:26:46 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Feb 26 13:29:21 2020 +0100
tests: validate vdo slab_size
New vdoformat can print this size - so check we pass proper bit count
matching preset value.
---
WHATS_NEW | 1 +
test/lib/aux.sh | 1 +
test/shell/lvcreate-vdo.sh | 13 ++++++++-----
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 30f1391..664df61 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.09 -
====================================
+ Fix formating of vdopool (vdo_slab_size_mb was smaller by 2 bits).
Fix showing of a dm kernel error when uncaching a volume with cachevol.
Version 2.03.08 - 11th February 2020
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index a9d1fe4..83a88a6 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1233,6 +1233,7 @@ activation/udev_sync = 1
activation/verify_udev_operations = $LVM_VERIFY_UDEV
activation/raid_region_size = 512
allocation/wipe_signatures_when_zeroing_new_lvs = 0
+allocation/vdo_slab_size_mb = 128
backup/archive = 0
backup/backup = 0
devices/cache_dir = "$TESTDIR/etc"
diff --git a/test/shell/lvcreate-vdo.sh b/test/shell/lvcreate-vdo.sh
index 64377cd..d66e353 100644
--- a/test/shell/lvcreate-vdo.sh
+++ b/test/shell/lvcreate-vdo.sh
@@ -34,14 +34,17 @@ get_devs
# 'allocation/vdo_physical_threads = 0' \
# 'allocation/vdo_cpu_threads = 1'
-aux lvmconf 'allocation/vdo_slab_size_mb = 128'
-
-
vgcreate $SHARED -s 64K "$vg" "${DEVICES[@]}"
# Create VDO device (vdo-pool is ATM internal volume type)
-lvcreate --type vdo -L4G -n $lv1 $vg/$lv2
-check lv_field $vg/$lv1 size "1.24g"
+lvcreate --type vdo -L4G -n $lv1 $vg/$lv2 >out 2>&1
+# new vdoformat prints some more info
+if grep "data slabs" out ; then
+ # check we have match vdo_slab_size_mb == 128MB (aux.sh)
+ grep "each 128 MB" out
+fi
+
+check lv_field $vg/$lv1 size "<1.24g"
check lv_field $vg/${lv2} size "4.00g"
check lv_field $vg/${lv2}_vdata size "4.00g"
lvremove -ff $vg
3 years, 9 months
master - vdo: fix slab size bits calculation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d02d7bc560ef27d2a0e...
Commit: d02d7bc560ef27d2a0e66d40f96519379d320735
Parent: 84eab461c843e2018b6ff73a9af8140e27cde391
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Feb 21 11:59:29 2020 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 25 17:43:16 2020 +0100
vdo: fix slab size bits calculation
When formating VDO volume, the calculated amound of bits
for 'vdoformat --slab-bits' parameter was shifted by 2 bits
(calculated size was making 2MiB vdo_slab_size_mb value appear like if
user would be specifying only 512KiB)
Fixed by properly converting internal size_mb value to KiB.
---
lib/metadata/vdo_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
index 335e7dd..7862682 100644
--- a/lib/metadata/vdo_manip.c
+++ b/lib/metadata/vdo_manip.c
@@ -248,7 +248,7 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
args++;
}
- slabbits = 31 - clz(vtp->slab_size_mb / DM_VDO_BLOCK_SIZE * 512);
+ slabbits = 31 - clz(vtp->slab_size_mb / DM_VDO_BLOCK_SIZE * 2 * 1024); /* to KiB / block_size */
log_debug("Slab size %s converted to %u bits.",
display_size(data_lv->vg->cmd, vtp->slab_size_mb * UINT64_C(2 * 1024)), slabbits);
if (dm_snprintf(buf_args[args], sizeof(buf_args[0]), "--slab-bits=%u", slabbits) < 0)
3 years, 9 months
master - writecache: check watermark value
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=84eab461c843e2018b6...
Commit: 84eab461c843e2018b6ff73a9af8140e27cde391
Parent: 81d03330670f392cfe938d8bb12df2ed4c30f2d0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 25 10:34:30 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 25 10:34:30 2020 -0600
writecache: check watermark value
---
tools/lvconvert.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4ebda4c..68bd75c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5395,6 +5395,8 @@ static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecach
if (!strncmp(key, "high_watermark", strlen("high_watermark"))) {
if (sscanf(val, "%llu", (unsigned long long *)&settings->high_watermark) != 1)
goto_bad;
+ if (settings->high_watermark > 100)
+ goto_bad;
settings->high_watermark_set = 1;
return 1;
}
@@ -5402,6 +5404,8 @@ static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecach
if (!strncmp(key, "low_watermark", strlen("low_watermark"))) {
if (sscanf(val, "%llu", (unsigned long long *)&settings->low_watermark) != 1)
goto_bad;
+ if (settings->low_watermark > 100)
+ goto_bad;
settings->low_watermark_set = 1;
return 1;
}
3 years, 9 months
master - writecache: allow removing wcorig lv
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=81d03330670f392cfe9...
Commit: 81d03330670f392cfe938d8bb12df2ed4c30f2d0
Parent: 2284f845b0328df97dfef6200905b3b462cd3cce
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Feb 21 12:40:42 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Feb 21 12:41:52 2020 -0600
writecache: allow removing wcorig lv
like removing corig
---
lib/metadata/lv_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3604a63..3090a93 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6638,7 +6638,7 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
return 0;
}
- if (lv_is_cache_origin(lv)) {
+ if (lv_is_cache_origin(lv) || lv_is_writecache_origin(lv)) {
if (!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "cache origin"))
return_0;
/* Removal of cache LV also removes caching origin */
3 years, 9 months
master - writecache: fix watermark error message
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2284f845b0328df97df...
Commit: 2284f845b0328df97dfef6200905b3b462cd3cce
Parent: 8153c5f1e61b305661ab92302ebe1077e2d6f483
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Feb 21 08:13:32 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Feb 21 08:13:32 2020 -0600
writecache: fix watermark error message
---
tools/lvconvert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0ddeb35..4ebda4c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5515,7 +5515,7 @@ static int _get_writecache_settings(struct cmd_context *cmd, struct writecache_s
if (settings->high_watermark_set && settings->low_watermark_set &&
(settings->high_watermark <= settings->low_watermark)) {
- log_error("High watermark must be greater than or equal to low watermark.");
+ log_error("High watermark must be greater than low watermark.");
return 0;
}
3 years, 9 months
master - writecache: working real dm uuid suffix for wcorig lv
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8153c5f1e61b305661a...
Commit: 8153c5f1e61b305661ab92302ebe1077e2d6f483
Parent: 4829f27b76742ed663de0a11babb5b9a5985b741
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Feb 19 13:30:02 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 20 17:13:43 2020 -0600
writecache: working real dm uuid suffix for wcorig lv
---
lib/activate/dev_manager.c | 4 ++++
lib/metadata/lv.c | 2 +-
lib/metadata/writecache_manip.c | 16 ++++++++--------
lib/misc/lvm-string.c | 1 +
lib/writecache/writecache.c | 2 +-
tools/lvconvert.c | 2 ++
6 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index c8a22fb..3b99131 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -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))
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)))
return_0;
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index ab26b8d..17d4907 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -830,7 +830,7 @@ const char *lv_layer(const struct logical_volume *lv)
if (lv_is_vdo_pool(lv))
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 NULL;
diff --git a/lib/metadata/writecache_manip.c b/lib/metadata/writecache_manip.c
index 0122025..31d069e 100644
--- a/lib/metadata/writecache_manip.c
+++ b/lib/metadata/writecache_manip.c
@@ -24,15 +24,15 @@
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) {
- if (!sl->seg || !sl->seg->lv || !sl->seg->origin)
- continue;
- if (lv_is_writecache(sl->seg->lv) && (sl->seg->origin == lv))
- return 1;
- }
- return 0;
+ /* Make sure there's exactly one segment in segs_using_this_lv! */
+ if (dm_list_empty(&lv->segs_using_this_lv) ||
+ (dm_list_size(&lv->segs_using_this_lv) > 1))
+ return 0;
+
+ seg = get_only_segment_using_this_lv(lv);
+ 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)
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index d8b27cb..0ee3403 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -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 */
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 08a306e..130922a 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), NULL)))
+ if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), "real")))
return_0;
if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 757b323..0ddeb35 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -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)))
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,
3 years, 9 months
master - writecache: drop real dm suffix
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4829f27b76742ed663d...
Commit: 4829f27b76742ed663de0a11babb5b9a5985b741
Parent: db1d66859f8086467979b2d7e32843f70e4436e1
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Feb 17 12:14:13 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Feb 17 13:07:06 2020 -0600
writecache: drop real dm suffix
fixes the problem of adding writecache to an active LV
---
lib/misc/lvm-string.c | 1 -
lib/writecache/writecache.c | 2 +-
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 0ee3403..d8b27cb 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 130922a..08a306e 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 6cd4665..0a7f694 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
3 years, 9 months
master - thin: don't use writecache for poolmetadata
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=db1d66859f808646797...
Commit: db1d66859f8086467979b2d7e32843f70e4436e1
Parent: cba06012acc589888ef88221f1a580b5b81b4100
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Feb 13 17:22:37 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 13 17:22:37 2020 -0600
thin: don't use writecache for poolmetadata
---
tools/lvconvert.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index aa2dca7..757b323 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3104,8 +3104,9 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0;
}
- /* FIXME Tidy up all these type restrictions. */
+ /* FIXME Tidy up all these type restrictions. (Use a type whitelist?) */
if (lv_is_cache_type(metadata_lv) ||
+ lv_is_writecache(metadata_lv) ||
lv_is_thin_type(metadata_lv) ||
lv_is_cow(metadata_lv) || lv_is_merging_cow(metadata_lv) ||
lv_is_origin(metadata_lv) || lv_is_merging_origin(metadata_lv) ||
3 years, 9 months
master - writecache: check if cachevol is writable
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cba06012acc589888ef...
Commit: cba06012acc589888ef88221f1a580b5b81b4100
Parent: 892a182975049ebe732860c30c866fe2de5b7717
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 11 12:59:39 2020 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 11 13:01:13 2020 -0600
writecache: check if cachevol is writable
before trying to initialize it (since wipe_lv
does not return an error if it fails to write.)
---
tools/lvconvert.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index cd9a3e8..aa2dca7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5351,6 +5351,11 @@ static int _writecache_zero(struct cmd_context *cmd, struct logical_volume *lv)
};
int ret;
+ if (!(lv->status & LVM_WRITE)) {
+ log_error("Cannot initialize readonly LV %s", display_lvname(lv));
+ return 0;
+ }
+
if (test_mode())
return 1;
3 years, 10 months