Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=229e63b6388ae384fad08…
Commit: 229e63b6388ae384fad08dfbf659b360b95753bc
Parent: 9deb1340143f4e036e2531788adc5ad82751cbfd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Nov 21 15:16:23 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Nov 21 15:16:23 2018 -0600
writecache: set block_size using --cachesettings
instead of a separate --writecacheblocksize option.
writecache block_size is not technically a setting,
but it can borrow the option as a special case.
---
man/lvmcache.7_main | 2 +-
tools/args.h | 3 ---
tools/command-lines.in | 2 +-
tools/lvconvert.c | 35 +++++++++++++++++++++++------------
4 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index 1e2acf4..89a1943 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -117,7 +117,7 @@ attached.
The dm-writecache block size can be 4096 bytes (the default), or 512
bytes. The default 4096 has better performance and should be used except
when 512 is necessary for compatibility. The dm-writecache block size is
-specified with --writecacheblocksize 4096b|512b when caching is started.
+specified with --cachesettings block_size=4096|512 when caching is started.
When a file system like xfs already exists on the main LV prior to
caching, and the file system is using a block size of 512, then the
diff --git a/tools/args.h b/tools/args.h
index 1ceba99..414d7a8 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -812,9 +812,6 @@ arg(withversions_ARG, '\0', "withversions", 0, 0, 0,
"each configuration node. If the setting is deprecated, also display\n"
"the version since which it is deprecated.\n")
-arg(writecacheblocksize_ARG, '\0', "writecacheblocksize", sizekb_VAL, 0, 0,
- "The block size to use for cache blocks in writecache.\n")
-
arg(writebehind_ARG, '\0', "writebehind", number_VAL, 0, 0,
"The maximum number of outstanding writes that are allowed to\n"
"devices in a RAID1 LV that is marked write-mostly.\n"
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 018153a..b06acec 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -470,7 +470,7 @@ FLAGS: SECONDARY_SYNTAX
---
lvconvert --type writecache --cachepool LV LV_linear_striped_raid
-OO: OO_LVCONVERT, --cachesettings String, --writecacheblocksize SizeKB
+OO: OO_LVCONVERT, --cachesettings String
ID: lvconvert_to_writecache_vol
DESC: Attach a writecache to an LV, converts the LV to type writecache.
RULE: all and lv_is_visible
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a207bd9..a29a66b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5271,8 +5271,22 @@ out:
}
static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecache_settings *settings,
- char *key, char *val)
+ char *key, char *val, uint32_t *block_size_sectors)
{
+ /* special case: block_size is not a setting but is set with the --cachesettings option */
+ if (!strncmp(key, "block_size", strlen("block_size"))) {
+ uint32_t block_size = 0;
+ if (sscanf(val, "%u", &block_size) != 1)
+ goto_bad;
+ if (block_size == 512)
+ *block_size_sectors = 1;
+ else if (block_size == 4096)
+ *block_size_sectors = 8;
+ else
+ goto_bad;
+ return 1;
+ }
+
if (!strncmp(key, "high_watermark", strlen("high_watermark"))) {
if (sscanf(val, "%llu", (unsigned long long *)&settings->high_watermark) != 1)
goto_bad;
@@ -5352,7 +5366,8 @@ static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecach
return 0;
}
-static int _get_writecache_settings(struct cmd_context *cmd, struct writecache_settings *settings)
+static int _get_writecache_settings(struct cmd_context *cmd, struct writecache_settings *settings,
+ uint32_t *block_size_sectors)
{
struct arg_value_group_list *group;
const char *str;
@@ -5388,7 +5403,7 @@ static int _get_writecache_settings(struct cmd_context *cmd, struct writecache_s
pos += num;
- if (!_get_one_writecache_setting(cmd, settings, key, val))
+ if (!_get_one_writecache_setting(cmd, settings, key, val, block_size_sectors))
return_0;
}
}
@@ -5437,6 +5452,8 @@ static struct logical_volume *_lv_writecache_create(struct cmd_context *cmd,
return lv_wcorig;
}
+#define DEFAULT_WRITECACHE_BLOCK_SIZE_SECTORS 8 /* 4K */
+
static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
@@ -5469,16 +5486,10 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
return 0;
}
- /* default block size is 4096 bytes (8 sectors) */
- block_size_sectors = arg_int_value(cmd, writecacheblocksize_ARG, 8);
- if (block_size_sectors > 8) {
- log_error("Max writecache block size is 4096 bytes.");
- return 0;
- }
-
memset(&settings, 0, sizeof(settings));
+ block_size_sectors = DEFAULT_WRITECACHE_BLOCK_SIZE_SECTORS;
- if (!_get_writecache_settings(cmd, &settings)) {
+ if (!_get_writecache_settings(cmd, &settings, &block_size_sectors)) {
log_error("Invalid writecache settings.");
return 0;
}
@@ -5498,7 +5509,7 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
* an existing file system on lv may become unmountable with the
* writecache attached because of the changing sector size. If this
* happens, then use --splitcache, and reattach the writecache using a
- * --writecacheblocksize value matching the sector size of lv.
+ * writecache block_size value matching the sector size of lv.
*/
if (!_writecache_zero(cmd, lv_fast)) {
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cb15373ad705a360c4a32…
Commit: cb15373ad705a360c4a32d4ca9e97af949fec17a
Parent: b968c73d2171b10f457babb2a5c428ffdc5ed21c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 19 17:16:36 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 17:58:09 2018 +0100
tests: missing copyright
---
test/lib/dmsecuretest.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/test/lib/dmsecuretest.c b/test/lib/dmsecuretest.c
index 2ab7f81..d90546c 100644
--- a/test/lib/dmsecuretest.c
+++ b/test/lib/dmsecuretest.c
@@ -1,6 +1,18 @@
/*
+ * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
* Test sample code to check for leftovers from secure table loading in
- * userspace memory
+ * userspace memory (initial sample provided by Milan Broz).
*
* Compile with: gcc -O2 -g -o tst dmcrypt.c -ldevmapper
*
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=54de0d829b0e07ee48e92…
Commit: 54de0d829b0e07ee48e92d68b428dfed8d6d7bf1
Parent: a53024cafccf1fd0eee02a63336247923dd72ce1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 19 13:15:05 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 13:16:03 2018 +0100
tests: speed-up testing full of lvm2 metadata
Generate faster full metadata condition.
FIXME: vgremove is extremaly slow with larger set of LVs.
---
test/shell/metadata-full.sh | 69 ++++++++++++++++++++++++++++++++----------
1 files changed, 52 insertions(+), 17 deletions(-)
diff --git a/test/shell/metadata-full.sh b/test/shell/metadata-full.sh
index 388ebcd..eb617ee 100644
--- a/test/shell/metadata-full.sh
+++ b/test/shell/metadata-full.sh
@@ -16,21 +16,22 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+# this test needs lot of memory
+test "$(aux total_mem)" -gt 524288 || skip
+
LVM_TEST_PVS=${LVM_TEST_PVS:-64}
# aux prepare_vg $LVM_TEST_PVS
unset LVM_LOG_FILE_MAX_LINES
-aux prepare_devs 64
+aux prepare_devs 64 1000
get_devs
vgcreate $SHARED -s 512K --metadatacopies 8 $vg "${DEVICES[@]}"
-# have tested to see how many LVs can be created in a
-# vg set up like this and it's around 1190, so pick a
-# number less than that but over 1024 (in case there's
-# some issue at the number 1024 we want to find it.)
+
+# Create a large metadata set, that getting close to 1/2MiB in size
#
# uses long tags to increase the size of the metadata
# more quickly
@@ -40,15 +41,46 @@ vgcreate $SHARED -s 512K --metadatacopies 8 $vg "${DEVICES[@]}"
# based on how much metadata it produces at the time this
# is written.
+vgcfgbackup -f data $vg
+TEST_DEVS=930
+# Generate a lot of LV devices (size of 1 extent)
+awk -v TEST_DEVS=$TEST_DEVS '/^\t\}/ {
+ printf("\t}\n\tlogical_volumes {\n");
+ cnt=0;
+ for (i = 0; i < TEST_DEVS; i++) {
+ printf("\t\tlvol%d {\n", i);
+ printf("\t\t\tid = \"%06d-1111-2222-3333-2222-1111-%06d\"\n", i, i);
+ print "\t\t\tstatus = [\"READ\", \"WRITE\", \"VISIBLE\"]";
+ print "\t\t\ttags = [\"A123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\"]";
+ print "\t\t\tsegment_count = 1";
+ print "\t\t\tsegment1 {";
+ print "\t\t\t\tstart_extent = 0";
+ print "\t\t\t\textent_count = 1";
+ print "\t\t\t\ttype = \"striped\"";
+ print "\t\t\t\tstripe_count = 1";
+ print "\t\t\t\tstripes = [";
+ print "\t\t\t\t\t\"pv0\", " cnt++;
+ printf("\t\t\t\t]\n\t\t\t}\n\t\t}\n");
+ }
+ }
+ {print}
+' data >data_new
+# Restoring big data set of LVs
+vgcfgrestore -f data_new $vg
-for i in `seq 1 1050`; do lvcreate -l1 -an --addtag A123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg; done
# should show non-zero
vgs -o+pv_mda_free
# these addtag's will fail at some point when metadata space is full
-for i in `seq 1 1050`; do lvchange --addtag B123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg/lvol$i || true; done
+for i in $(seq 1 "$TEST_DEVS"); do
+ lvchange --addtag B123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg/lvol$i || break;
+done
+
+# test we hit 'out-of-metadata-space'
+test "$i" -gt 5
+test "$i" -lt "$TEST_DEVS"
# should show 0
vgs -o+pv_mda_free
@@ -57,14 +89,18 @@ check vg_field $vg vg_mda_free 0
# remove some of the tags to check that we can reduce the size of the
# metadata, and continue using the vg
-for i in `seq 1 50`; do lvchange --deltag B123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg/lvol$i || true; done
+for j in $(seq 1 "$i"); do
+ lvchange --deltag B123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg/lvol$j;
+done
# should show non-zero
vgs -o+pv_mda_free
# these will fail at some point when metadata space is full again
-for i in `seq 1 50`; do lvcreate -l1 -an --addtag C123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg || true; done
+for i in $(seq 1 50); do
+ lvcreate -l1 -an --addtag C123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 $vg || break;
+done
# should show 0
vgs -o+pv_mda_free
@@ -76,21 +112,20 @@ check vg_field $vg vg_mda_free 0
time vgs
-vgchange -ay $vg
-
-time vgs
-
-vgchange -an $vg
+# Avoid activation of large set of volumes - this is tested in vgchange-many.sh
+#vgchange -ay $vg
+#vgchange -an $vg
# see if we can remove LVs to make more metadata space,
# and then create more LVs
-for i in `seq 1 50`; do lvremove -y $vg/lvol$i; done
+for i in $(seq 1 30); do lvremove -y $vg/lvol$i; done
-for i in `seq 1 10`; do lvcreate -l1 $vg; done
+for i in $(seq 1 10); do lvcreate -l1 $vg; done
# should show non-zero
vgs -o+pv_mda_free
+# FIXME:
+# takes extreme amount of time, despite the fact, there are only few LVs active.
vgremove -ff $vg
-