master - writecache: set block_size using --cachesettings
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=229e63b6388ae384fad...
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)) {
5 years, 5 months
master - io: use sync io if aio fails
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ca66d520326493311a3...
Commit: ca66d520326493311a3c7132b1bcee0807862301
Parent: b1e9fe9505293e8c9b4a4bfffafe62c5a83b4d11
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Nov 16 12:21:20 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Nov 20 09:13:20 2018 -0600
io: use sync io if aio fails
io_setup() for aio may fail if a system has reached the
aio request limit. In this case, fall back to using
sync io. Also, lvm use of aio can be disabled entirely
with config setting global/use_aio=0.
The system limit for aio requests can be seen from
/proc/sys/fs/aio-max-nr
The current usage of aio requests can be seen from
/proc/sys/fs/aio-nr
The system limit for aio requests can be increased by
setting fs.aio-max-nr using sysctl.
Also add last-byte limit to the sync io code.
---
lib/commands/toolcontext.c | 2 ++
lib/config/config_settings.h | 3 +++
lib/config/defaults.h | 1 +
lib/device/bcache.c | 42 ++++++++++++++++++++++++++++++++++++++++++
lib/label/label.c | 17 +++++++++++++----
lib/misc/lvm-globals.c | 11 +++++++++++
lib/misc/lvm-globals.h | 2 ++
7 files changed, 74 insertions(+), 4 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 58d46ac..754be86 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -331,6 +331,8 @@ static void _init_logging(struct cmd_context *cmd)
find_config_tree_bool(cmd, global_test_CFG, NULL);
init_test(cmd->default_settings.test);
+ init_use_aio(find_config_tree_bool(cmd, global_use_aio_CFG, NULL));
+
/* Settings for logging to file */
if (find_config_tree_bool(cmd, log_overwrite_CFG, NULL))
append = 0;
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 636446f..29ec980 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1003,6 +1003,9 @@ cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL,
cfg(global_lvmetad_update_wait_time_CFG, "lvmetad_update_wait_time", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(2, 2, 151), NULL, vsn(3, 0, 0), NULL,
"This setting is no longer used.\n")
+cfg(global_use_aio_CFG, "use_aio", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_USE_AIO, vsn(2, 2, 183), NULL, 0, NULL,
+ "Use async I/O when reading and writing devices.\n")
+
cfg(global_use_lvmlockd_CFG, "use_lvmlockd", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 124), NULL, 0, NULL,
"Use lvmlockd for locking among hosts using LVM on shared storage.\n"
"Applicable only if LVM is compiled with lockd support in which\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 9fbe8c2..f3fcb09 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -60,6 +60,7 @@
#define DEFAULT_METADATA_READ_ONLY 0
#define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
#define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]"
+#define DEFAULT_USE_AIO 1
#define DEFAULT_SANLOCK_LV_EXTEND_MB 256
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index 62970ef..7e640a4 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -389,6 +389,48 @@ static bool _sync_issue(struct io_engine *ioe, enum dir d, int fd,
return false;
}
+ /*
+ * If bcache block goes past where lvm wants to write, then clamp it.
+ */
+ if ((d == DIR_WRITE) && _last_byte_offset && (fd == _last_byte_fd)) {
+ uint64_t offset = where;
+ uint64_t nbytes = len;
+ sector_t limit_nbytes = 0;
+ sector_t extra_nbytes = 0;
+
+ if (offset > _last_byte_offset) {
+ log_error("Limit write at %llu len %llu beyond last byte %llu",
+ (unsigned long long)offset,
+ (unsigned long long)nbytes,
+ (unsigned long long)_last_byte_offset);
+ return false;
+ }
+
+ if (offset + nbytes > _last_byte_offset) {
+ limit_nbytes = _last_byte_offset - offset;
+ if (limit_nbytes % _last_byte_sector_size)
+ extra_nbytes = _last_byte_sector_size - (limit_nbytes % _last_byte_sector_size);
+
+ if (extra_nbytes) {
+ log_debug("Limit write at %llu len %llu to len %llu rounded to %llu",
+ (unsigned long long)offset,
+ (unsigned long long)nbytes,
+ (unsigned long long)limit_nbytes,
+ (unsigned long long)(limit_nbytes + extra_nbytes));
+ nbytes = limit_nbytes + extra_nbytes;
+ } else {
+ log_debug("Limit write at %llu len %llu to len %llu",
+ (unsigned long long)offset,
+ (unsigned long long)nbytes,
+ (unsigned long long)limit_nbytes);
+ nbytes = limit_nbytes;
+ }
+ }
+
+ where = offset;
+ len = nbytes;
+ }
+
while (len) {
do {
if (d == DIR_READ)
diff --git a/lib/label/label.c b/lib/label/label.c
index 5387161..82ebd71 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -799,7 +799,7 @@ out:
static int _setup_bcache(int cache_blocks)
{
- struct io_engine *ioe;
+ struct io_engine *ioe = NULL;
if (cache_blocks < MIN_BCACHE_BLOCKS)
cache_blocks = MIN_BCACHE_BLOCKS;
@@ -807,9 +807,18 @@ static int _setup_bcache(int cache_blocks)
if (cache_blocks > MAX_BCACHE_BLOCKS)
cache_blocks = MAX_BCACHE_BLOCKS;
- if (!(ioe = create_async_io_engine())) {
- log_error("Failed to create bcache io engine.");
- return 0;
+ if (use_aio()) {
+ if (!(ioe = create_async_io_engine())) {
+ log_warn("Failed to set up async io, using sync io.");
+ init_use_aio(0);
+ }
+ }
+
+ if (!ioe) {
+ if (!(ioe = create_sync_io_engine())) {
+ log_error("Failed to set up sync io.");
+ return 0;
+ }
}
if (!(scan_bcache = bcache_create(BCACHE_BLOCK_SIZE_IN_SECTORS, cache_blocks, ioe))) {
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 86e6cf4..0ad60fd 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -24,6 +24,7 @@
static int _verbose_level = VERBOSE_BASE_LEVEL;
static int _silent = 0;
static int _test = 0;
+static int _use_aio = 0;
static int _md_filtering = 0;
static int _internal_filtering = 0;
static int _fwraid_filtering = 0;
@@ -69,6 +70,11 @@ void init_test(int level)
_test = level;
}
+void init_use_aio(int use_aio)
+{
+ _use_aio = use_aio;
+}
+
void init_md_filtering(int level)
{
_md_filtering = level;
@@ -215,6 +221,11 @@ int test_mode(void)
return _test;
}
+int use_aio(void)
+{
+ return _use_aio;
+}
+
int md_filtering(void)
{
return _md_filtering;
diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h
index 6fc26cc..42dcc34 100644
--- a/lib/misc/lvm-globals.h
+++ b/lib/misc/lvm-globals.h
@@ -25,6 +25,7 @@ enum dev_ext_e;
void init_verbose(int level);
void init_silent(int silent);
void init_test(int level);
+void init_use_aio(int use_aio);
void init_md_filtering(int level);
void init_internal_filtering(int level);
void init_fwraid_filtering(int level);
@@ -55,6 +56,7 @@ const char *get_cmd_name(void);
void set_sysfs_dir_path(const char *path);
int test_mode(void);
+int use_aio(void);
int md_filtering(void);
int internal_filtering(void);
int fwraid_filtering(void);
5 years, 5 months
master - bcache: sync io fixes
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7e721ca04832d36b5ff...
Commit: 7e721ca04832d36b5ffbb992eaaaeb5e424de271
Parent: ca66d520326493311a3c7132b1bcee0807862301
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Nov 16 13:09:29 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Nov 20 09:19:18 2018 -0600
bcache: sync io fixes
fix lseek error check
fix read/write error checks
handle zero return from read and write
don't return an error for short io
fix partial read/write loop
---
lib/device/bcache.c | 74 +++++++++++++++++++++++++++++++++-----------------
1 files changed, 49 insertions(+), 25 deletions(-)
diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index 7e640a4..18ffcf0 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -329,7 +329,7 @@ struct io_engine *create_async_io_engine(void)
e->aio_context = 0;
r = io_setup(MAX_IO, &e->aio_context);
if (r < 0) {
- log_warn("io_setup failed");
+ log_debug("io_setup failed %d", r);
free(e);
return NULL;
}
@@ -372,8 +372,11 @@ static void _sync_destroy(struct io_engine *ioe)
static bool _sync_issue(struct io_engine *ioe, enum dir d, int fd,
sector_t sb, sector_t se, void *data, void *context)
{
- int r;
- uint64_t len = (se - sb) * 512, where;
+ int rv;
+ off_t off;
+ uint64_t where;
+ uint64_t pos = 0;
+ uint64_t len = (se - sb) * 512;
struct sync_engine *e = _to_sync(ioe);
struct sync_io *io = malloc(sizeof(*io));
if (!io) {
@@ -382,11 +385,16 @@ static bool _sync_issue(struct io_engine *ioe, enum dir d, int fd,
}
where = sb * 512;
- r = lseek(fd, where, SEEK_SET);
- if (r < 0) {
- log_warn("unable to seek to position %llu", (unsigned long long) where);
+ off = lseek(fd, where, SEEK_SET);
+ if (off == (off_t) -1) {
+ log_warn("Device seek error %d for offset %llu", errno, (unsigned long long)where);
free(io);
- return false;
+ return false;
+ }
+ if (off != (off_t) where) {
+ log_warn("Device seek failed for offset %llu", (unsigned long long)where);
+ free(io);
+ return false;
}
/*
@@ -431,28 +439,44 @@ static bool _sync_issue(struct io_engine *ioe, enum dir d, int fd,
len = nbytes;
}
- while (len) {
- do {
- if (d == DIR_READ)
- r = read(fd, data, len);
- else
- r = write(fd, data, len);
+ while (pos < len) {
+ if (d == DIR_READ)
+ rv = read(fd, (char *)data + pos, len - pos);
+ else
+ rv = write(fd, (char *)data + pos, len - pos);
+
+ if (rv == -1 && errno == EINTR)
+ continue;
+ if (rv == -1 && errno == EAGAIN)
+ continue;
- } while ((r < 0) && ((r == EINTR) || (r == EAGAIN)));
+ if (!rv)
+ break;
- if (r < 0) {
- log_warn("io failed %d", r);
+ if (rv < 0) {
+ if (d == DIR_READ)
+ log_debug("Device read error %d offset %llu len %llu", errno,
+ (unsigned long long)(where + pos),
+ (unsigned long long)(len - pos));
+ else
+ log_debug("Device write error %d offset %llu len %llu", errno,
+ (unsigned long long)(where + pos),
+ (unsigned long long)(len - pos));
free(io);
- return false;
- }
-
- len -= r;
+ return false;
+ }
+ pos += rv;
}
- if (len) {
- log_warn("short io %u bytes remaining", (unsigned) len);
- free(io);
+ if (pos < len) {
+ if (d == DIR_READ)
+ log_warn("Device read short %u bytes remaining", (unsigned)(len - pos));
+ else
+ log_warn("Device write short %u bytes remaining", (unsigned)(len - pos));
+ /*
+ free(io);
return false;
+ */
}
5 years, 5 months
master - WHATS_NEW: sync io
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9deb1340143f4e036e2...
Commit: 9deb1340143f4e036e2531788adc5ad82751cbfd
Parent: 7e721ca04832d36b5ffbb992eaaaeb5e424de271
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Nov 20 09:20:28 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Nov 20 09:20:28 2018 -0600
WHATS_NEW: sync io
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e152027..68cdcea 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Use sync io if async io_setup fails, or use_aio=0 is set in config.
Version 2.03.01 - 31st October 2018
===================================
5 years, 5 months
master - tests: update required raid target
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b1e9fe9505293e8c9b4...
Commit: b1e9fe9505293e8c9b4a4bfffafe62c5a83b4d11
Parent: cb15373ad705a360c4a32d4ca9e97af949fec17a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 19 18:06:39 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 18:08:54 2018 +0100
tests: update required raid target
For embeded reshaping operation require higher driver version.
(otherwise we get:
Converting vg/LV1 from raid6 (same as raid6_zr) is directly possible to the following layouts:
raid6_nc
raid6_nr
raid6_la_6
raid6_ls_6
raid6_ra_6
raid6_rs_6
raid6_n_6
---
test/shell/lvconvert-raid-regionsize.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-raid-regionsize.sh b/test/shell/lvconvert-raid-regionsize.sh
index cba04cc..924e95a 100644
--- a/test/shell/lvconvert-raid-regionsize.sh
+++ b/test/shell/lvconvert-raid-regionsize.sh
@@ -65,7 +65,8 @@ _test_regionsizes raid1
# Clean up
lvremove --yes $vg
-if aux have_raid 1 10 1; then
+# Needs reshaping kernel for raid6 conversion
+if aux have_raid 1 14 0; then
# Create 5-way raid6
lvcreate --yes -aey --type raid6 -i 3 --stripesize 128K -R 256K -L8M -n $lv1 $vg
check lv_field $vg/$lv1 segtype "raid6"
5 years, 5 months
master - tests: missing copyright
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cb15373ad705a360c4a...
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
*
5 years, 5 months
master - sanlock: update headers
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b968c73d2171b10f457...
Commit: b968c73d2171b10f457babb2a5c428ffdc5ed21c
Parent: b2261b5d81732d8d8c3445e9b8c4ce935bcc49d4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 19 16:55:11 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 16:55:11 2018 +0100
sanlock: update headers
---
daemons/lvmlockd/lvmlockd-internal.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index ead3098..04645fa 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -504,7 +504,7 @@ static inline int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flag
return -1;
}
-static inline int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, uint64_t free_offset)
+static inline int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, int sector_size, int align_size, uint64_t free_offset)
{
return -1;
}
@@ -592,7 +592,7 @@ static inline int lm_is_running_sanlock(void)
return 0;
}
-static inline int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset)
+static inline int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset, int *sector_size, int *align_size)
{
return -1;
}
5 years, 5 months
master - tests: generate slightly less volumes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b2261b5d81732d8d8c3...
Commit: b2261b5d81732d8d8c3445e9b8c4ce935bcc49d4
Parent: 54de0d829b0e07ee48e92d68b428dfed8d6d7bf1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 19 13:39:39 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 19 13:42:23 2018 +0100
tests: generate slightly less volumes
---
test/shell/metadata-full.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/metadata-full.sh b/test/shell/metadata-full.sh
index eb617ee..67333d8 100644
--- a/test/shell/metadata-full.sh
+++ b/test/shell/metadata-full.sh
@@ -42,7 +42,7 @@ vgcreate $SHARED -s 512K --metadatacopies 8 $vg "${DEVICES[@]}"
# is written.
vgcfgbackup -f data $vg
-TEST_DEVS=930
+TEST_DEVS=925
# Generate a lot of LV devices (size of 1 extent)
awk -v TEST_DEVS=$TEST_DEVS '/^\t\}/ {
printf("\t}\n\tlogical_volumes {\n");
5 years, 5 months
master - tests: speed-up testing full of lvm2 metadata
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=54de0d829b0e07ee48e...
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
-
5 years, 5 months
master - tests: update parm for new kernel
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a53024cafccf1fd0eee...
Commit: a53024cafccf1fd0eee02a63336247923dd72ce1
Parent: 6d2609a2324988027795a757c1b387dd2ec3214b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Nov 18 22:04:00 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Nov 18 22:21:24 2018 +0100
tests: update parm for new kernel
---
test/shell/lvextend-thin-metadata-dmeventd.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvextend-thin-metadata-dmeventd.sh b/test/shell/lvextend-thin-metadata-dmeventd.sh
index 437a04e..20b70d3 100644
--- a/test/shell/lvextend-thin-metadata-dmeventd.sh
+++ b/test/shell/lvextend-thin-metadata-dmeventd.sh
@@ -90,7 +90,9 @@ lvchange -an $vg/pool
# Consume more then (100% - 4MiB) out of 32MiB metadata volume (>87.5%)
# (Test for less than 4MiB free space in metadata, which is less than 25%)
-fake_metadata_ 7400 2 >data
+DATA=7200 # Newer version of thin-pool have hidden reserve, so use lower value
+aux target_at_least dm-thin-pool 1 20 0 || DATA=7400
+fake_metadata_ "$DATA" 2 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv2"
# Swap volume with restored fake metadata
lvconvert -y --chunksize 64k --thinpool $vg/pool --poolmetadata $vg/$lv2
5 years, 5 months