stable-2.02 - configure: use our ordered list of python names
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1ed9cfad0954cb2e7c4...
Commit: 1ed9cfad0954cb2e7c4445fd7ff2105aa044ccf1
Parent: 305e80fe85e9fbc4fa30cdb70dc1576aebc80eec
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 2 20:40:52 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 18:09:55 2020 +0200
configure: use our ordered list of python names
Since it seems it's prefered now to use python3 in path name,
prefer this name as first in the list.
---
WHATS_NEW | 1 +
configure | 2 +-
configure.ac | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index fe1093201..3112105d7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.188 -
==================================
+ Configure use own python path name order to prefer using python3.
Enhance reporting and error handling when creating thin volumes.
Use revert_lv() on reload error path after vg_revert().
Improve estimation of needed extents when creating thin-pool.
diff --git a/configure b/configure
index c2b65d5a8..b6658b908 100755
--- a/configure
+++ b/configure
@@ -13256,7 +13256,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
- for am_cv_pathless_PYTHON in python python2 python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
+ for am_cv_pathless_PYTHON in python3 python2 python python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
diff --git a/configure.ac b/configure.ac
index 0e9de09f9..4aee76542 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1445,6 +1445,9 @@ if test "$PYTHON3_BINDINGS" = yes -o "$BUILD_LVMDBUSD" = yes; then
unset am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_platform
unset am_cv_python_pythondir am_cv_python_version am_cv_python_pyexecdir
unset ac_cv_path_PYTHON_CONFIG ac_cv_path_ac_pt_PYTHON_CONFIG
+ m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[ python3 python2 python dnl
+ python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 dnl
+ python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 ])
AM_PATH_PYTHON([3])
PYTHON3=$PYTHON
test -z "$PYTHON3" && AC_MSG_ERROR([python3 is required for --enable-python3_bindings or --enable-dbus-service but cannot be found])
3 years, 6 months
stable-2.02 - configure: update with latest AM_PATH_PYTHON
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=305e80fe85e9fbc4fa3...
Commit: 305e80fe85e9fbc4fa30cdb70dc1576aebc80eec
Parent: 3b5d51e821143202742c5ed7b1c57d48fe305913
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 16 15:39:54 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 18:09:55 2020 +0200
configure: update with latest AM_PATH_PYTHON
World has moved towards python3.9.
Although we still don't like path ordering.
---
aclocal.m4 | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
configure | 4 +--
2 files changed, 85 insertions(+), 14 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 07ea0b664..3e0fbd38d 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_python_module.html
+# https://www.gnu.org/software/autoconf-archive/ax_python_module.html
# ===========================================================================
#
# SYNOPSIS
@@ -37,7 +37,7 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 9
AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
AC_DEFUN([AX_PYTHON_MODULE],[
@@ -69,9 +69,9 @@ AC_DEFUN([AX_PYTHON_MODULE],[
fi
])
-dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
+
dnl Copyright �� 2004 Scott James Remnant <scott(a)netsplit.com>.
dnl Copyright �� 2012-2015 Dan Nicholson <dbn.lists(a)gmail.com>
dnl
@@ -112,7 +112,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29])
+[m4_define([PKG_MACROS_VERSION], [0.29.1])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@@ -345,7 +345,75 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+ [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+ [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+ [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+ AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+ [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+ [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+ [auto],[PKG_CHECK_MODULES([$1],[$2],
+ [m4_n([def_action_if_found]) $3],
+ [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+ [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+ [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -379,8 +447,11 @@ AC_DEFUN([AM_PATH_PYTHON],
dnl Find a Python interpreter. Python versions prior to 2.0 are not
dnl supported. (2.0 was released on October 16, 2000).
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
- python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
+[python python2 python3 dnl
+ python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
+ python3.2 python3.1 python3.0 dnl
+ python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
+ python2.0])
AC_ARG_VAR([PYTHON], [the Python interpreter])
@@ -580,7 +651,7 @@ for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
sys.exit(sys.hexversion < minverhex)"
AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/configure b/configure
index df27701ab..c2b65d5a8 100755
--- a/configure
+++ b/configure
@@ -12688,7 +12688,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
- for am_cv_pathless_PYTHON in python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
+ for am_cv_pathless_PYTHON in python python2 python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
@@ -13256,7 +13256,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
- for am_cv_pathless_PYTHON in python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
+ for am_cv_pathless_PYTHON in python python2 python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
3 years, 6 months
stable-2.02 - configure: update help
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3b5d51e821143202742...
Commit: 3b5d51e821143202742c5ed7b1c57d48fe305913
Parent: 7d6dfe901984aeeed23299ab3e6271432061f3be
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 28 18:51:32 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 18:09:54 2020 +0200
configure: update help
Help shows new defaults.
---
configure | 6 +++---
configure.ac | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index fe0e8e29c..df27701ab 100755
--- a/configure
+++ b/configure
@@ -1766,11 +1766,11 @@ Optional Packages:
--with-ocfdir=DIR install OCF files in
[PREFIX/lib/ocf/resource.d/lvm2]
--with-default-pid-dir=PID_DIR
- Default directory to keep PID files in. [autodetect]
+ default directory to keep PID files in [autodetect]
--with-default-dm-run-dir=DM_RUN_DIR
- Default DM run directory. [autodetect]
+ default DM run directory [autodetect]
--with-default-run-dir=RUN_DIR
- Default LVM run directory. [autodetect_run_dir/lvm]
+ default LVM run directory [autodetect_run_dir/lvm]
--with-clvmd=TYPE build cluster LVM Daemon
The following cluster manager combinations are valid:
* cman (RHEL5 or equivalent)
diff --git a/configure.ac b/configure.ac
index 379d37f15..0e9de09f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -650,7 +650,7 @@ dnl -- Set up pidfile and run directory
AH_TEMPLATE(DEFAULT_PID_DIR)
AC_ARG_WITH(default-pid-dir,
AC_HELP_STRING([--with-default-pid-dir=PID_DIR],
- [Default directory to keep PID files in. [autodetect]]),
+ [default directory to keep PID files in [autodetect]]),
DEFAULT_PID_DIR="$withval", DEFAULT_PID_DIR=$RUN_DIR)
AC_DEFINE_UNQUOTED(DEFAULT_PID_DIR, ["$DEFAULT_PID_DIR"],
[Default directory to keep PID files in.])
@@ -658,7 +658,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_PID_DIR, ["$DEFAULT_PID_DIR"],
AH_TEMPLATE(DEFAULT_DM_RUN_DIR, [Name of default DM run directory.])
AC_ARG_WITH(default-dm-run-dir,
AC_HELP_STRING([--with-default-dm-run-dir=DM_RUN_DIR],
- [ Default DM run directory. [autodetect]]),
+ [default DM run directory [autodetect]]),
DEFAULT_DM_RUN_DIR="$withval", DEFAULT_DM_RUN_DIR=$RUN_DIR)
AC_DEFINE_UNQUOTED(DEFAULT_DM_RUN_DIR, ["$DEFAULT_DM_RUN_DIR"],
[Default DM run directory.])
@@ -666,7 +666,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_DM_RUN_DIR, ["$DEFAULT_DM_RUN_DIR"],
AH_TEMPLATE(DEFAULT_RUN_DIR, [Name of default LVM run directory.])
AC_ARG_WITH(default-run-dir,
AC_HELP_STRING([--with-default-run-dir=RUN_DIR],
- [Default LVM run directory. [autodetect_run_dir/lvm]]),
+ [default LVM run directory [autodetect_run_dir/lvm]]),
DEFAULT_RUN_DIR="$withval", DEFAULT_RUN_DIR="$RUN_DIR/lvm")
AC_DEFINE_UNQUOTED(DEFAULT_RUN_DIR, ["$DEFAULT_RUN_DIR"],
[Default LVM run directory.])
3 years, 6 months
stable-2.02 - active: fix compilation without devmapper
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7d6dfe901984aeeed23...
Commit: 7d6dfe901984aeeed23299ab3e6271432061f3be
Parent: 0a825734161d2c90a5dfea091bf5e94e7002382a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 28 18:56:58 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 18:09:54 2020 +0200
active: fix compilation without devmapper
Better support for compilation without device-mapper.
---
lib/activate/activate.c | 22 ++++++++--------------
lib/metadata/lv_manip.c | 8 ++++----
lib/metadata/thin_manip.c | 6 +++---
lib/raid/raid.c | 34 +++++++++++++++++-----------------
4 files changed, 32 insertions(+), 38 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 97486ebf0..0e06e358f 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -186,8 +186,8 @@ void set_activation(int act, int silent)
if (warned || !act)
return;
- log_error("Compiled without libdevmapper support. "
- "Can't enable activation.");
+ log_warn("WARNING: Compiled without libdevmapper support. "
+ "Can't enable activation.");
warned = 1;
}
@@ -222,23 +222,13 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
{
return 0;
}
-int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer,
- struct lvinfo *info, int with_open_count, int with_read_ahead)
-{
- return 0;
-}
-int lv_info_with_seg_status(struct cmd_context *cmd, const struct logical_volume *lv,
- const struct lv_segment *lv_seg, int use_layer,
+int lv_info_with_seg_status(struct cmd_context *cmd,
+ const struct lv_segment *lv_seg,
struct lv_with_info_and_seg_status *status,
int with_open_count, int with_read_ahead)
{
return 0;
}
-int lv_status(struct cmd_context *cmd, const struct lv_segment *lv_seg,
- int use_layer, struct lv_seg_status *lv_seg_status)
-{
- return 0;
-}
int lv_cache_status(const struct logical_volume *cache_lv,
struct lv_status_cache **status)
{
@@ -285,6 +275,10 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
{
return 0;
}
+int lv_writecache_message(const struct logical_volume *lv, const char *msg)
+{
+ return 0;
+}
int lv_thin_pool_status(const struct logical_volume *lv, int flush,
struct lv_status_thin_pool **thin_pool_status)
{
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 399ac0774..e4ea30d12 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7559,10 +7559,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
return NULL;
}
/* Does LV need to be zeroed? */
- if (lp->zero && !seg_is_thin(lp)) {
- log_error("Can't wipe start of new LV without using "
- "device-mapper kernel driver.");
- return NULL;
+ if (lp->zero) {
+ log_warn("WARNING: Skipping zeroing and wipping, compiled without activation support.");
+ lp->zero = 0;
+ lp->wipe_signatures = 0;
}
}
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 9fb12cfa7..695aff101 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -544,9 +544,9 @@ int update_pool_lv(struct logical_volume *lv, int activate)
return_0;
}
if (!lv_is_active(lv)) {
- init_dmeventd_monitor(monitored);
- log_error("Cannot activate thin pool %s, perhaps skipped in lvm.conf volume_list?",
- display_lvname(lv));
+ (void) init_dmeventd_monitor(monitored);
+ log_error("Cannot activate thin pool %s%s", display_lvname(lv),
+ activation() ? ", perhaps skipped in lvm.conf volume_list?" : ".");
return 0;
}
} else
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index e926ae116..28340a0ca 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -24,10 +24,6 @@
#include "metadata.h"
#include "lv_alloc.h"
-static int _raid_target_present(struct cmd_context *cmd,
- const struct lv_segment *seg __attribute__((unused)),
- unsigned *attributes);
-
static void _raid_display(const struct lv_segment *seg)
{
unsigned s;
@@ -239,6 +235,22 @@ static int _raid_text_export(const struct lv_segment *seg, struct formatter *f)
return _raid_text_export_raid(seg, f);
}
+static int _raid_target_status_compatible(const char *type)
+{
+ return (strstr(type, "raid") != NULL);
+}
+
+static void _raid_destroy(struct segment_type *segtype)
+{
+ dm_free((void *) segtype->dso);
+ dm_free(segtype);
+}
+
+#ifdef DEVMAPPER_SUPPORT
+static int _raid_target_present(struct cmd_context *cmd,
+ const struct lv_segment *seg __attribute__((unused)),
+ unsigned *attributes);
+
static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
struct dm_pool *mem __attribute__((unused)),
struct cmd_context *cmd __attribute__((unused)),
@@ -356,18 +368,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
return add_areas_line(dm, seg, node, 0u, seg->area_count);
}
-static int _raid_target_status_compatible(const char *type)
-{
- return (strstr(type, "raid") != NULL);
-}
-
-static void _raid_destroy(struct segment_type *segtype)
-{
- dm_free((void *) segtype->dso);
- dm_free(segtype);
-}
-
-#ifdef DEVMAPPER_SUPPORT
static int _raid_target_percent(void **target_state,
dm_percent_t *percent,
struct dm_pool *mem,
@@ -568,9 +568,9 @@ static struct segtype_handler _raid_ops = {
.text_import_area_count = _raid_text_import_area_count,
.text_import = _raid_text_import,
.text_export = _raid_text_export,
- .add_target_line = _raid_add_target_line,
.target_status_compatible = _raid_target_status_compatible,
#ifdef DEVMAPPER_SUPPORT
+ .add_target_line = _raid_add_target_line,
.target_percent = _raid_target_percent,
.target_present = _raid_target_present,
.check_transient_status = _raid_transient_status,
3 years, 6 months
stable-2.02 - thin: use lv_status_thin and lv_status_thin_pool
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0a825734161d2c90a5d...
Commit: 0a825734161d2c90a5dfea091bf5e94e7002382a
Parent: 45121aafe9f7623b7ca26678a9fa8ff659aaf1b0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 27 01:11:47 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 18:09:54 2020 +0200
thin: use lv_status_thin and lv_status_thin_pool
Introduce structures lv_status_thin_pool and
lv_status_thin (pair to lv_status_cache, lv_status_vdo)
Convert lv_thin_percent() -> lv_thin_status()
and lv_thin_pool_percent() + lv_thin_pool_transaction_id() ->
lv_thin_pool_status().
This way a function user can see not only percentages, but also
other important status info about thin-pool.
TODO:
This patch tries to not change too many other things,
but pool_below_threshold() now uses new thin-pool info to return
failure if thin-pool cannot be actually modified.
This should be handle separately in a better way.
---
lib/activate/activate.c | 83 ++++++++-------------------
lib/activate/activate.h | 10 ++--
lib/activate/dev_manager.c | 118 +++++++++++++++++++++++++--------------
lib/activate/dev_manager.h | 16 ++----
lib/display/display.c | 22 +++++---
lib/metadata/lv_manip.c | 38 ++++++++-----
lib/metadata/metadata-exported.h | 14 +++++
lib/metadata/thin_manip.c | 75 +++++++++++++++++++------
lib/report/properties.c | 60 ++++++++++++--------
9 files changed, 255 insertions(+), 181 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 0bd769cdc..97486ebf0 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -285,18 +285,13 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
{
return 0;
}
-int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
- dm_percent_t *percent)
+int lv_thin_pool_status(const struct logical_volume *lv, int flush,
+ struct lv_status_thin_pool **thin_pool_status)
{
return 0;
}
-int lv_thin_percent(const struct logical_volume *lv, int mapped,
- dm_percent_t *percent)
-{
- return 0;
-}
-int lv_thin_pool_transaction_id(const struct logical_volume *lv,
- uint64_t *transaction_id)
+int lv_thin_status(const struct logical_volume *lv, int flush,
+ struct lv_status_thin **thin_status)
{
return 0;
}
@@ -1256,86 +1251,52 @@ int lv_cache_status(const struct logical_volume *cache_lv,
return 1;
}
-/*
- * Returns data or metadata percent usage, depends on metadata 0/1.
- * Returns 1 if percent set, else 0 on failure.
- */
-int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
- dm_percent_t *percent)
+int lv_thin_pool_status(const struct logical_volume *lv, int flush,
+ struct lv_status_thin_pool **thin_pool_status)
{
- int r;
struct dev_manager *dm;
if (!lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0))
return 0;
- log_debug_activation("Checking thin %sdata percent for LV %s.",
- (metadata) ? "meta" : "", display_lvname(lv));
+ log_debug_activation("Checking thin pool status for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
- if (!(r = dev_manager_thin_pool_percent(dm, lv, metadata, percent)))
- stack;
+ if (!dev_manager_thin_pool_status(dm, lv, flush, thin_pool_status)) {
+ dev_manager_destroy(dm);
+ return_0;
+ }
- dev_manager_destroy(dm);
+ /* User has to call dm_pool_destroy(thin_pool_status->mem)! */
- return r;
+ return 1;
}
-/*
- * Returns 1 if percent set, else 0 on failure.
- */
-int lv_thin_percent(const struct logical_volume *lv,
- int mapped, dm_percent_t *percent)
+int lv_thin_status(const struct logical_volume *lv, int flush,
+ struct lv_status_thin **thin_status)
{
- int r;
struct dev_manager *dm;
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking thin percent for LV %s.",
+ log_debug_activation("Checking thin status for LV %s.",
display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
- if (!(r = dev_manager_thin_percent(dm, lv, mapped, percent)))
- stack;
-
- dev_manager_destroy(dm);
-
- return r;
-}
-
-/*
- * Returns 1 if transaction_id set, else 0 on failure.
- */
-int lv_thin_pool_transaction_id(const struct logical_volume *lv,
- uint64_t *transaction_id)
-{
- int r;
- struct dev_manager *dm;
- struct dm_status_thin_pool *status;
-
- if (!lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0))
- return 0;
-
- log_debug_activation("Checking thin-pool transaction id for LV %s.",
- display_lvname(lv));
-
- if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
+ if (!dev_manager_thin_status(dm, lv, flush, thin_status)) {
+ dev_manager_destroy(dm);
return_0;
+ }
- if (!(r = dev_manager_thin_pool_status(dm, lv, &status, 0)))
- stack;
- else
- *transaction_id = status->transaction_id;
-
- dev_manager_destroy(dm);
+ /* User has to call dm_pool_destroy(thin_status->mem)! */
- return r;
+ return 1;
}
int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id)
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 71392765b..6eecbde17 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -178,13 +178,11 @@ int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action);
int lv_raid_message(const struct logical_volume *lv, const char *msg);
int lv_cache_status(const struct logical_volume *cache_lv,
struct lv_status_cache **status);
-int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
- dm_percent_t *percent);
-int lv_thin_percent(const struct logical_volume *lv, int mapped,
- dm_percent_t *percent);
-int lv_thin_pool_transaction_id(const struct logical_volume *lv,
- uint64_t *transaction_id);
int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id);
+int lv_thin_status(const struct logical_volume *lv, int flush,
+ struct lv_status_thin **status);
+int lv_thin_pool_status(const struct logical_volume *lv, int flush,
+ struct lv_status_thin_pool **status);
/*
* Return number of LVs in the VG that are active.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 7acb3e9f7..7d9cb917e 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1472,9 +1472,6 @@ int dev_manager_cache_status(struct dev_manager *dm,
if (!(dlid = build_dm_uuid(dm->mem, lv, lv_layer(lv))))
return_0;
- if (!(*status = dm_pool_zalloc(dm->mem, sizeof(struct lv_status_cache))))
- return_0;
-
if (!(dmt = _setup_task_run(DM_DEVICE_STATUS, &info, NULL, dlid, 0, 0, 0, 0, 0, 0)))
return_0;
@@ -1497,8 +1494,11 @@ int dev_manager_cache_status(struct dev_manager *dm,
if (!dm_get_status_cache(dm->mem, params, &c))
goto_out;
- (*status)->cache = c;
+ if (!(*status = dm_pool_zalloc(dm->mem, sizeof(struct lv_status_cache))))
+ goto_out;
+
(*status)->mem = dm->mem; /* User has to destroy this mem pool later */
+ (*status)->cache = c;
if (c->fail || c->error) {
(*status)->data_usage =
(*status)->metadata_usage =
@@ -1520,10 +1520,10 @@ out:
}
int dev_manager_thin_pool_status(struct dev_manager *dm,
- const struct logical_volume *lv,
- struct dm_status_thin_pool **status,
- int flush)
+ const struct logical_volume *lv, int flush,
+ struct lv_status_thin_pool **status)
{
+ struct dm_status_thin_pool *dm_status;
const char *dlid;
struct dm_task *dmt;
struct dm_info info;
@@ -1544,11 +1544,31 @@ int dev_manager_thin_pool_status(struct dev_manager *dm,
dm_get_next_target(dmt, NULL, &start, &length, &type, ¶ms);
- /* FIXME Check for thin and check there's exactly one target */
+ if (!type || strcmp(type, TARGET_NAME_THIN_POOL)) {
+ log_error("Expected %s segment type but got %s instead.",
+ TARGET_NAME_THIN_POOL, type ? type : "NULL");
+ goto out;
+ }
- if (!dm_get_status_thin_pool(dm->mem, params, status))
+ if (!dm_get_status_thin_pool(dm->mem, params, &dm_status))
goto_out;
+ if (!(*status = dm_pool_zalloc(dm->mem, sizeof(struct lv_status_thin_pool))))
+ goto_out;
+
+ (*status)->mem = dm->mem;
+ (*status)->thin_pool = dm_status;
+
+ if (dm_status->fail || dm_status->error) {
+ (*status)->data_usage =
+ (*status)->metadata_usage = DM_PERCENT_INVALID;
+ } else {
+ (*status)->data_usage = dm_make_percent(dm_status->used_data_blocks,
+ dm_status->total_data_blocks);
+ (*status)->metadata_usage = dm_make_percent(dm_status->used_metadata_blocks,
+ dm_status->total_metadata_blocks);
+ }
+
r = 1;
out:
dm_task_destroy(dmt);
@@ -1556,52 +1576,68 @@ out:
return r;
}
-int dev_manager_thin_pool_percent(struct dev_manager *dm,
- const struct logical_volume *lv,
- int metadata, dm_percent_t *percent)
+int dev_manager_thin_status(struct dev_manager *dm,
+ const struct logical_volume *lv, int flush,
+ struct lv_status_thin **status)
{
- char *name;
+ struct dm_status_thin *dm_status;
const char *dlid;
- const char *layer = lv_layer(lv);
+ struct dm_task *dmt;
+ struct dm_info info;
+ uint64_t start, length;
+ char *type = NULL;
+ char *params = NULL;
+ uint64_t csize;
+ int r = 0;
- /* Build a name for the top layer */
- if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
+ if (!(dlid = build_dm_uuid(dm->mem, lv, lv_layer(lv))))
return_0;
- if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
+ if (!(dmt = _setup_task_run(DM_DEVICE_STATUS, &info, NULL, dlid, 0, 0, 0, 0, flush, 0)))
return_0;
- log_debug_activation("Getting device status percentage for %s.", name);
-
- if (!(_percent(dm, name, dlid, TARGET_NAME_THIN_POOL, 0,
- (metadata) ? lv : NULL, percent, NULL, 1)))
- return_0;
+ if (!info.exists)
+ goto_out;
- return 1;
-}
+ dm_get_next_target(dmt, NULL, &start, &length, &type, ¶ms);
-int dev_manager_thin_percent(struct dev_manager *dm,
- const struct logical_volume *lv,
- int mapped, dm_percent_t *percent)
-{
- char *name;
- const char *dlid;
- const char *layer = lv_layer(lv);
+ if (!type || strcmp(type, TARGET_NAME_THIN)) {
+ log_error("Expected %s segment type but got %s instead.",
+ TARGET_NAME_THIN, type ? type : "NULL");
+ goto out;
+ }
- /* Build a name for the top layer */
- if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
- return_0;
+ if (!dm_get_status_thin(dm->mem, params, &dm_status))
+ goto_out;
- if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
- return_0;
+ if (!(*status = dm_pool_zalloc(dm->mem, sizeof(struct lv_status_thin))))
+ goto_out;
- log_debug_activation("Getting device status percentage for %s", name);
+ (*status)->mem = dm->mem;
+ (*status)->thin = dm_status;
+
+ if (dm_status->fail)
+ (*status)->usage = DM_PERCENT_INVALID;
+ else {
+ /* Pool allocates whole chunk so round-up to nearest one */
+ csize = first_seg(first_seg(lv)->pool_lv)->chunk_size;
+ csize = ((lv->size + csize - 1) / csize) * csize;
+ if (dm_status->mapped_sectors > csize) {
+ log_warn("WARNING: LV %s maps %s while the size is only %s.",
+ display_lvname(lv),
+ display_size(dm->cmd, dm_status->mapped_sectors),
+ display_size(dm->cmd, csize));
+ /* Don't show nonsense numbers like i.e. 1000% full */
+ dm_status->mapped_sectors = csize;
+ }
+ (*status)->usage = dm_make_percent(dm_status->mapped_sectors, csize);
+ }
- if (!(_percent(dm, name, dlid, TARGET_NAME_THIN, 0,
- (mapped) ? NULL : lv, percent, NULL, 1)))
- return_0;
+ r = 1;
+out:
+ dm_task_destroy(dmt);
- return 1;
+ return r;
}
/*
diff --git a/lib/activate/dev_manager.h b/lib/activate/dev_manager.h
index 20b6a26d1..1a3d5f98c 100644
--- a/lib/activate/dev_manager.h
+++ b/lib/activate/dev_manager.h
@@ -66,19 +66,15 @@ int dev_manager_raid_message(struct dev_manager *dm,
int dev_manager_cache_status(struct dev_manager *dm,
const struct logical_volume *lv,
struct lv_status_cache **status);
-int dev_manager_thin_pool_status(struct dev_manager *dm,
- const struct logical_volume *lv,
- struct dm_status_thin_pool **status,
- int flush);
-int dev_manager_thin_pool_percent(struct dev_manager *dm,
- const struct logical_volume *lv,
- int metadata, dm_percent_t *percent);
-int dev_manager_thin_percent(struct dev_manager *dm,
- const struct logical_volume *lv,
- int mapped, dm_percent_t *percent);
+int dev_manager_thin_status(struct dev_manager *dm,
+ const struct logical_volume *lv, int flush,
+ struct lv_status_thin **status);
int dev_manager_thin_device_id(struct dev_manager *dm,
const struct logical_volume *lv,
uint32_t *device_id);
+int dev_manager_thin_pool_status(struct dev_manager *dm,
+ const struct logical_volume *lv, int flush,
+ struct lv_status_thin_pool **status);
int dev_manager_suspend(struct dev_manager *dm, const struct logical_volume *lv,
struct lv_activate_opts *laopts, int lockfs, int flush_required);
int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv,
diff --git a/lib/display/display.c b/lib/display/display.c
index 9b4be8833..d8220397b 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -406,10 +406,12 @@ int lvdisplay_full(struct cmd_context *cmd,
struct lv_segment *seg = NULL;
int lvm1compat;
dm_percent_t snap_percent;
- int thin_data_active = 0, thin_metadata_active = 0;
+ int thin_pool_active = 0;
dm_percent_t thin_data_percent, thin_metadata_percent;
int thin_active = 0;
dm_percent_t thin_percent;
+ struct lv_status_thin *thin_status = NULL;
+ struct lv_status_thin_pool *thin_pool_status = NULL;
struct lv_status_cache *cache_status = NULL;
if (lv_is_historical(lv))
@@ -502,15 +504,18 @@ int lvdisplay_full(struct cmd_context *cmd,
if (seg->merge_lv)
log_print("LV merging to %s",
seg->merge_lv->name);
- if (inkernel)
- thin_active = lv_thin_percent(lv, 0, &thin_percent);
+ if (inkernel && (thin_active = lv_thin_status(lv, 0, &thin_status))) {
+ thin_percent = thin_status->usage;
+ dm_pool_destroy(thin_status->mem);
+ }
if (lv_is_merging_origin(lv))
log_print("LV merged with %s",
find_snapshot(lv)->lv->name);
} else if (lv_is_thin_pool(lv)) {
- if (lv_info(cmd, lv, 1, &info, 1, 1) && info.exists) {
- thin_data_active = lv_thin_pool_percent(lv, 0, &thin_data_percent);
- thin_metadata_active = lv_thin_pool_percent(lv, 1, &thin_metadata_percent);
+ if ((thin_pool_active = lv_thin_pool_status(lv, 0, &thin_pool_status))) {
+ thin_data_percent = thin_pool_status->data_usage;
+ thin_metadata_percent = thin_pool_status->metadata_usage;
+ dm_pool_destroy(thin_pool_status->mem);
}
/* FIXME: display thin_pool targets transid for activated LV as well */
seg = first_seg(lv);
@@ -569,13 +574,12 @@ int lvdisplay_full(struct cmd_context *cmd,
dm_pool_destroy(cache_status->mem);
}
- if (thin_data_active)
+ if (thin_pool_active) {
log_print("Allocated pool data %s%%",
display_percent(cmd, thin_data_percent));
-
- if (thin_metadata_active)
log_print("Allocated metadata %s%%",
display_percent(cmd, thin_metadata_percent));
+ }
if (thin_active)
log_print("Mapped size %s%%",
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 341cbbff4..399ac0774 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4674,6 +4674,7 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
dm_percent_t percent;
dm_percent_t min_threshold;
int policy_threshold, policy_amount;
+ struct lv_status_thin_pool *thin_pool_status;
*amount = *meta_amount = 0;
@@ -4717,21 +4718,26 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
}
if (lv_is_thin_pool(lv)) {
- if (!lv_thin_pool_percent(lv, 1, &percent))
- return_0;
+ if (!lv_thin_pool_status(lv, 0, &thin_pool_status))
+ goto_bad;
/* Resize below the minimal usable value */
min_threshold = pool_metadata_min_threshold(first_seg(lv)) / DM_PERCENT_1;
- *meta_amount = _adjust_amount(percent, (min_threshold < policy_threshold) ?
+ *meta_amount = _adjust_amount(thin_pool_status->metadata_usage,
+ (min_threshold < policy_threshold) ?
min_threshold : policy_threshold, policy_amount);
if (*meta_amount)
/* Compensate possible extra space consumption by kernel on resize */
(*meta_amount)++;
- if (!lv_thin_pool_percent(lv, 0, &percent))
- return_0;
- } else {
- if (!lv_snapshot_percent(lv, &percent))
- return_0;
+ percent = thin_pool_status->data_usage;
+ dm_pool_destroy(thin_pool_status->mem);
+ } else if (!lv_snapshot_percent(lv, &percent))
+ goto_bad;
+ else if (!lv_is_active(lv)) {
+ bad:
+ log_error("Can't read state of locally inactive LV %s.",
+ display_lvname(lv));
+ return 0;
}
*amount = _adjust_amount(percent, policy_threshold, policy_amount);
@@ -7996,17 +8002,21 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
* and needs to be restored to the state from this canceled segment.
* TODO: there is low chance actual suspend has failed
*/
- if (!lv_thin_pool_transaction_id(pool_lv, &transaction_id)) {
+ struct lv_status_thin_pool *tpstatus;
+ if (!lv_thin_pool_status(pool_lv, 1, &tpstatus))
log_error("Aborting. Failed to read transaction_id from thin pool %s.",
display_lvname(pool_lv)); /* Can't even get thin pool transaction id ??? */
- } else if (transaction_id != first_seg(pool_lv)->transaction_id) {
- if (transaction_id == seg->transaction_id)
- log_debug_metadata("Reverting back transaction_id " FMTu64 " for thin pool %s.",
- seg->transaction_id, display_lvname(pool_lv));
- else
+ else {
+ transaction_id = tpstatus->thin_pool->transaction_id;
+ dm_pool_destroy(tpstatus->mem);
+
+ if ((transaction_id != first_seg(pool_lv)->transaction_id) &&
+ (transaction_id != seg->transaction_id))
log_warn("WARNING: Metadata for thin pool %s have transaction_id " FMTu64
", but active pool has " FMTu64 ".",
display_lvname(pool_lv), seg->transaction_id, transaction_id);
+ log_debug_metadata("Restoring previous transaction_id " FMTu64 " for thin pool %s.",
+ seg->transaction_id, display_lvname(pool_lv));
first_seg(pool_lv)->transaction_id = seg->transaction_id;
first_seg(lv)->device_id = 0; /* no delete of never existing thin device */
}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index bd0eb6ca9..4833d59d1 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -861,6 +861,20 @@ int update_thin_pool_params(struct cmd_context *cmd,
uint32_t *pool_metadata_extents,
int *chunk_size_calc_method, uint32_t *chunk_size,
thin_discards_t *discards, thin_zero_t *zero_new_blocks);
+
+struct lv_status_thin_pool {
+ struct dm_pool *mem;
+ struct dm_status_thin_pool *thin_pool;
+ dm_percent_t data_usage;
+ dm_percent_t metadata_usage;
+};
+
+struct lv_status_thin {
+ struct dm_pool *mem;
+ struct dm_status_thin *thin;
+ dm_percent_t usage;
+};
+
const char *get_pool_discards_name(thin_discards_t discards);
int set_pool_discards(thin_discards_t *discards, const char *str);
struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index db2644a05..9fb12cfa7 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -243,51 +243,86 @@ int pool_metadata_min_threshold(const struct lv_segment *pool_seg)
int pool_below_threshold(const struct lv_segment *pool_seg)
{
struct cmd_context *cmd = pool_seg->lv->vg->cmd;
- dm_percent_t percent;
+ struct lv_status_thin_pool *thin_pool_status = NULL;
dm_percent_t min_threshold = pool_metadata_min_threshold(pool_seg);
dm_percent_t threshold = DM_PERCENT_1 *
find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG,
lv_config_profile(pool_seg->lv));
+ int ret = 1;
- /* Data */
- if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent))
+ if (threshold > DM_PERCENT_100)
+ threshold = DM_PERCENT_100;
+
+ /* FIXME: currently with FLUSH - this may block pool while holding VG lock
+ * maybe try 2-phase version - 1st. check without commit
+ * 2nd. quickly following with commit */
+ if (!lv_thin_pool_status(pool_seg->lv, 1, &thin_pool_status))
return_0;
- if (percent > threshold || percent >= DM_PERCENT_100) {
+ if (thin_pool_status->thin_pool->fail |
+ thin_pool_status->thin_pool->out_of_data_space |
+ thin_pool_status->thin_pool->needs_check |
+ thin_pool_status->thin_pool->error |
+ thin_pool_status->thin_pool->read_only) {
+ log_warn("WARNING: Thin pool %s%s%s%s%s%s.",
+ display_lvname(pool_seg->lv),
+ thin_pool_status->thin_pool->fail ? " is failed" : "",
+ thin_pool_status->thin_pool->out_of_data_space ? " is out of data space" : "",
+ thin_pool_status->thin_pool->needs_check ? " needs check" : "",
+ thin_pool_status->thin_pool->error ? " is erroring" : "",
+ thin_pool_status->thin_pool->read_only ? " has read-only metadata" : "");
+ ret = 0;
+ if (thin_pool_status->thin_pool->fail)
+ goto out;
+ }
+
+ /* Data */
+
+ if (thin_pool_status->data_usage > threshold) {
log_debug("Threshold configured for free data space in "
"thin pool %s has been reached (%s%% >= %s%%).",
display_lvname(pool_seg->lv),
- display_percent(cmd, percent),
+ display_percent(cmd, thin_pool_status->data_usage),
display_percent(cmd, threshold));
- return 0;
+ ret = 0;
}
/* Metadata */
- if (!lv_thin_pool_percent(pool_seg->lv, 1, &percent))
- return_0;
-
- if (percent >= min_threshold) {
+ if (thin_pool_status->metadata_usage >= min_threshold) {
log_warn("WARNING: Remaining free space in metadata of thin pool %s "
"is too low (%s%% >= %s%%). "
"Resize is recommended.",
display_lvname(pool_seg->lv),
- display_percent(cmd, percent),
+ display_percent(cmd, thin_pool_status->metadata_usage),
display_percent(cmd, min_threshold));
- return 0;
+ ret = 0;
}
-
- if (percent > threshold) {
+ if (thin_pool_status->metadata_usage > threshold) {
log_debug("Threshold configured for free metadata space in "
"thin pool %s has been reached (%s%% > %s%%).",
display_lvname(pool_seg->lv),
- display_percent(cmd, percent),
+ display_percent(cmd, thin_pool_status->metadata_usage),
display_percent(cmd, threshold));
- return 0;
+ ret = 0;
}
- return 1;
+ if ((thin_pool_status->thin_pool->transaction_id != pool_seg->transaction_id) &&
+ (dm_list_empty(&pool_seg->thin_messages) ||
+ ((thin_pool_status->thin_pool->transaction_id + 1) != pool_seg->transaction_id))) {
+ log_warn("WARNING: Thin pool %s has unexpected transaction id " FMTu64
+ ", expecting " FMTu64 "%s.",
+ display_lvname(pool_seg->lv),
+ thin_pool_status->thin_pool->transaction_id,
+ pool_seg->transaction_id,
+ dm_list_empty(&pool_seg->thin_messages) ? "" : " or lower by 1");
+ ret = 0;
+ }
+out:
+ dm_pool_destroy(thin_pool_status->mem);
+
+ return ret;
}
/*
@@ -855,6 +890,7 @@ int check_new_thin_pool(const struct logical_volume *pool_lv)
{
struct cmd_context *cmd = pool_lv->vg->cmd;
uint64_t transaction_id;
+ struct lv_status_thin_pool *status = NULL;
/* For transaction_id check LOCAL activation is required */
if (!activate_lv_excl_local(cmd, pool_lv)) {
@@ -864,12 +900,15 @@ int check_new_thin_pool(const struct logical_volume *pool_lv)
}
/* With volume lists, check pool really is locally active */
- if (!lv_thin_pool_transaction_id(pool_lv, &transaction_id)) {
+ if (!lv_thin_pool_status(pool_lv, 1, &status)) {
log_error("Cannot read thin pool %s transaction id locally, perhaps skipped in lvm.conf volume_list?",
display_lvname(pool_lv));
return 0;
}
+ transaction_id = status->thin_pool->transaction_id;
+ dm_pool_destroy(status->mem);
+
/* Require pool to have same transaction_id as new */
if (first_seg(pool_lv)->transaction_id != transaction_id) {
log_error("Cannot use thin pool %s with transaction id "
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 72c8f3236..c37e97721 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -103,47 +103,63 @@ static dm_percent_t _snap_percent(const struct logical_volume *lv)
static dm_percent_t _data_percent(const struct logical_volume *lv)
{
- dm_percent_t percent;
- struct lv_status_cache *status;
+ dm_percent_t percent = DM_PERCENT_INVALID;
+ struct lv_status_cache *cache_status;
+ struct lv_status_thin *thin_status;
+ struct lv_status_thin_pool *thin_pool_status;
if (lv_is_cow(lv))
return _snap_percent(lv);
if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
- if (!lv_cache_status(lv, &status)) {
+ if (!lv_cache_status(lv, &cache_status))
+ stack;
+ else {
+ percent = cache_status->data_usage;
+ dm_pool_destroy(cache_status->mem);
+ }
+ } else if (lv_is_thin_volume(lv)) {
+ if (!lv_thin_status(lv, 0, &thin_status))
stack;
- return DM_PERCENT_INVALID;
+ else {
+ percent = thin_status->usage;
+ dm_pool_destroy(thin_status->mem);
+ }
+ } else if (lv_is_thin_pool(lv)) {
+ if (!lv_thin_pool_status(lv, 0, &thin_pool_status))
+ stack;
+ else {
+ percent = thin_pool_status->data_usage;
+ dm_pool_destroy(thin_pool_status->mem);
}
- percent = status->data_usage;
- dm_pool_destroy(status->mem);
- return percent;
}
- if (lv_is_thin_volume(lv))
- return lv_thin_percent(lv, 0, &percent) ? percent : DM_PERCENT_INVALID;
-
- return lv_thin_pool_percent(lv, 0, &percent) ? percent : DM_PERCENT_INVALID;
+ return percent;
}
static dm_percent_t _metadata_percent(const struct logical_volume *lv)
{
- dm_percent_t percent;
- struct lv_status_cache *status;
+ dm_percent_t percent = DM_PERCENT_INVALID;
+ struct lv_status_cache *cache_status;
+ struct lv_status_thin_pool *thin_pool_status;
if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
- if (!lv_cache_status(lv, &status)) {
+ if (!lv_cache_status(lv, &cache_status))
+ stack;
+ else {
+ percent = cache_status->metadata_usage;
+ dm_pool_destroy(cache_status->mem);
+ }
+ } else if (lv_is_thin_pool(lv)) {
+ if (!lv_thin_pool_status(lv, 0, &thin_pool_status))
stack;
- return DM_PERCENT_INVALID;
+ else {
+ percent = thin_pool_status->metadata_usage;
+ dm_pool_destroy(thin_pool_status->mem);
}
- percent = status->metadata_usage;
- dm_pool_destroy(status->mem);
- return percent;
}
- if (lv_is_thin_pool(lv))
- return lv_thin_pool_percent(lv, 1, &percent) ? percent : DM_PERCENT_INVALID;
-
- return DM_PERCENT_INVALID;
+ return percent;
}
/* PV */
3 years, 6 months
stable-2.02 - thin: remove unneeded code test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=45121aafe9f7623b7ca...
Commit: 45121aafe9f7623b7ca26678a9fa8ff659aaf1b0
Parent: 3094c423a0832c703406be3847d561226c19ea10
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 27 02:20:50 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
thin: remove unneeded code test
Since we detect already transaction if before starting
to build dm tree - this extra check is a duplicate
that would only capture very tiny 'race' and we later
validate transaction_id with suspended snapshot origin.
---
lib/thin/thin.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 69317a8e5..b7c80bcd2 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -264,8 +264,6 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
char *metadata_dlid, *pool_dlid;
const struct lv_thin_message *lmsg;
const struct logical_volume *origin;
- struct lvinfo info;
- uint64_t transaction_id = 0;
unsigned attr;
uint64_t low_water_mark;
int threshold;
@@ -350,24 +348,6 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
case DM_THIN_MESSAGE_CREATE_THIN:
origin = first_seg(lmsg->u.lv)->origin;
/* Check if the origin is suspended */
- if (origin && lv_info(cmd, origin, 1, &info, 0, 0) &&
- info.exists && !info.suspended) {
- /* Origin is not suspended, but the transaction may have been
- * already transfered, so test for transaction_id and
- * allow to pass in the message for dmtree processing
- * so it will skip all messages later.
- */
- if (!lv_thin_pool_transaction_id(seg->lv, &transaction_id))
- return_0; /* Thin pool should exist and work */
- if ((transaction_id + 1) != seg->transaction_id) {
- log_error("Omitting suspend of thin snapshot origin %s with expected "
- "transaction_id " FMTu64 ", but active pool has " FMTu64 ".",
- display_lvname(origin),
- !seg->transaction_id ? 0 : seg->transaction_id - 1,
- transaction_id);
- return 0;
- }
- }
log_debug_activation("Thin pool create_%s %s.", (!origin) ? "thin" : "snap", lmsg->u.lv->name);
if (!dm_tree_node_add_thin_pool_message(node,
(!origin) ? lmsg->type : DM_THIN_MESSAGE_CREATE_SNAP,
3 years, 6 months
stable-2.02 - cleanup: avoid unneeded check
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3094c423a0832c70340...
Commit: 3094c423a0832c703406be3847d561226c19ea10
Parent: 6373a8497776909b548fb5dcfb332b6502868f99
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 26 19:32:52 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
cleanup: avoid unneeded check
Since creation of thin snapshot already makes sure,
the message list is empty, there is no need to check
this again.
---
lib/metadata/lv_manip.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index dbfb306de..341cbbff4 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8017,8 +8017,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
stack;
goto revert_new_lv;
}
- }
- if (!dm_list_empty(&first_seg(pool_lv)->thin_messages)) {
+ } else if (!dm_list_empty(&first_seg(pool_lv)->thin_messages)) {
/* Send message so that table preload knows new thin */
if (!lv_is_active(pool_lv)) {
/* Avoid multiple thin-pool activations in this case */
3 years, 6 months
stable-2.02 - activation: move locking of critical section
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6373a8497776909b548...
Commit: 6373a8497776909b548fb5dcfb332b6502868f99
Parent: d4d3ff352f7d6bef57ffd724f1714c49b8811b66
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 26 14:56:44 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
activation: move locking of critical section
Move begining of 'suspending' critical section closer to _lv_suspend_lv()
for better correctness of error paths.
---
lib/activate/activate.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 3f3adafba..0bd769cdc 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2365,8 +2365,6 @@ skip_read:
if (laopts->origin_only && lv_is_thin_volume(lv) && lv_is_thin_volume(lv_pre))
lockfs = 1;
- critical_section_inc(cmd, "suspending");
-
if (!lv_is_locked(lv) && lv_is_locked(lv_pre) &&
(pvmove_lv = find_pvmove_lv_in_lv(lv_pre))) {
/*
@@ -2408,16 +2406,23 @@ skip_read:
}
dm_list_add(&suspend_lvs, &lvl->list);
}
+
+ critical_section_inc(cmd, "suspending");
+
dm_list_iterate_items(lvl, &suspend_lvs)
if (!_lv_suspend_lv(lvl->lv, laopts, lockfs, 1)) {
critical_section_dec(cmd, "failed suspend");
goto_out; /* FIXME: resume on recovery path? */
}
- } else /* Standard suspend */
+
+ } else { /* Standard suspend */
+ critical_section_inc(cmd, "suspending");
+
if (!_lv_suspend_lv(lv, laopts, lockfs, flush_required)) {
critical_section_dec(cmd, "failed suspend");
goto_out;
}
+ }
r = 1;
out:
3 years, 6 months
stable-2.02 - makefiles: document supported var in make help
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d4d3ff352f7d6bef57f...
Commit: d4d3ff352f7d6bef57ffd724f1714c49b8811b66
Parent: 8a0f9537f14267bae4153deb9160ae2d75623829
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 24 15:14:44 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
makefiles: document supported var in make help
---
test/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/Makefile.in b/test/Makefile.in
index 2b115b478..97e680020 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -126,6 +126,7 @@ help:
@echo " LVM_VALGRIND_CLVMD Enable valgrind testing of clvmd (1)."
@echo " LVM_VALGRIND_DMEVENTD Enable valgrind testing of dmeventd (1)."
@echo " LVM_VALGRIND_LVMETAD Enable valgrind testing of lvmetad (1)."
+ @echo " LVM_VALGRIND_LVMPOLLD Enable valgrind testing of lvmpolld (1)."
@echo " LVM_STRACE Enable strace logging."
@echo " LVM_DEBUG_LEVEL Sets debuging level for valgrind/strace (use > 0)."
@echo " LVM_VERIFY_UDEV Default verify state for lvm.conf."
3 years, 6 months
stable-2.02 - tests: use DIRECT io for zeroing whenver we can
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=05ba12350c8530395d6...
Commit: 05ba12350c8530395d675538b8b3b741274e041d
Parent: 688c72411e206008d5cd7553ed0b126549b7f987
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 19 23:25:11 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
tests: use DIRECT io for zeroing whenver we can
Performance with direct I/O here is noticable better,
so use it instead of buffered write whenever we can.
---
test/shell/lvchange-cache-mode.sh | 4 ++--
test/shell/lvcreate-thin-big.sh | 2 +-
test/shell/pvcreate-operation.sh | 2 +-
test/shell/select-report.sh | 4 ++--
test/shell/snapshot-maxsize.sh | 2 +-
test/shell/snapshot-merge-thin.sh | 2 +-
test/shell/thin-dmeventd-warns.sh | 8 ++++----
test/shell/thin-flags.sh | 4 ++--
test/shell/thin-many-dmeventd.sh | 17 +++++++++++------
test/shell/vg-check-devs-used.sh | 4 ++--
10 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/test/shell/lvchange-cache-mode.sh b/test/shell/lvchange-cache-mode.sh
index a34e51750..a50dfd450 100644
--- a/test/shell/lvchange-cache-mode.sh
+++ b/test/shell/lvchange-cache-mode.sh
@@ -32,9 +32,9 @@ lvcreate -H -L14 -n $lv1 --cachemode writeback --cachesettings migration_thresho
for i in $(seq 1 10) ; do
echo 3 >/proc/sys/vm/drop_caches
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=64K count=20 conv=fdatasync || true
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=64K count=20 oflag=direct || true
echo 3 >/proc/sys/vm/drop_caches
-dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=64K count=20 || true
+dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=64K count=20 oflag=direct || true
done
lvs -o+cache_dirty_blocks,cache_read_hits,cache_read_misses,cache_write_hits,cache_write_misses $vg/$lv1
diff --git a/test/shell/lvcreate-thin-big.sh b/test/shell/lvcreate-thin-big.sh
index 595b8a937..0b622b7a9 100644
--- a/test/shell/lvcreate-thin-big.sh
+++ b/test/shell/lvcreate-thin-big.sh
@@ -49,7 +49,7 @@ lvcreate -V10G $vg/pool3 -n $lv1
lvcreate -V2G $vg/pool3 -n $lv2
dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=512b count=1 conv=fdatasync
# ...excercise write speed to 'zero' device ;)
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=64K count=32767 conv=fdatasync
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=64K count=32767 oflag=direct
lvs -a $vg
# Check the percentage is not shown as 0.00
check lv_field $vg/$lv1 data_percent "0.01"
diff --git a/test/shell/pvcreate-operation.sh b/test/shell/pvcreate-operation.sh
index c449438e6..5cf4fd675 100644
--- a/test/shell/pvcreate-operation.sh
+++ b/test/shell/pvcreate-operation.sh
@@ -181,7 +181,7 @@ grep "Not enough space available for metadata area with index 1 on PV $dev1" err
rm -f "$backupfile"
# pvcreate wipes swap signature when forced
-dd if=/dev/zero of="$dev1" bs=1024 count=64
+dd if=/dev/zero of="$dev1" bs=64k count=1 oflag=direct
mkswap "$dev1"
blkid -c /dev/null "$dev1" | grep "swap"
pvcreate -f "$dev1"
diff --git a/test/shell/select-report.sh b/test/shell/select-report.sh
index f404be58b..b717c1031 100644
--- a/test/shell/select-report.sh
+++ b/test/shell/select-report.sh
@@ -152,11 +152,11 @@ if aux target_at_least dm-snapshot 1 10 0; then
# Before 1.10.0, the snap percent included metadata size.
sel lv 'snap_percent=0' snap
fi
-dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=1 conv=fdatasync
+dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=1 oflag=direct
sel lv 'snap_percent<50' snap
sel lv 'snap_percent>50'
# overflow snapshot -> invalidated, but still showing 100%
-not dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=4 conv=fdatasync
+not dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=4 oflag=direct
sel lv 'snap_percent=100' snap
# % char is accepted as suffix for percent values
sel lv 'snap_percent=100%' snap
diff --git a/test/shell/snapshot-maxsize.sh b/test/shell/snapshot-maxsize.sh
index 9427566d5..43d4db1f1 100644
--- a/test/shell/snapshot-maxsize.sh
+++ b/test/shell/snapshot-maxsize.sh
@@ -27,7 +27,7 @@ lvcreate -aey -L1 -n $lv1 $vg
# Snapshot should be large enough to handle any writes
lvcreate -L2 -s $vg/$lv1 -n $lv2
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 conv=fdatasync
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 oflag=direct
# Snapshot must not be 'I'nvalid here
check lv_attr_bit state $vg/$lv2 "a"
diff --git a/test/shell/snapshot-merge-thin.sh b/test/shell/snapshot-merge-thin.sh
index 80969d146..26fae904d 100644
--- a/test/shell/snapshot-merge-thin.sh
+++ b/test/shell/snapshot-merge-thin.sh
@@ -23,7 +23,7 @@ aux prepare_vg 2
lvcreate -T -L1 -V1 -n $lv1 $vg/pool "$dev1"
lvcreate -s -n $lv2 -L2 $vg/$lv1 "$dev2"
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 conv=fdatasync
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 oflag=direct
# Initiate background merge
lvconvert -b --merge $vg/$lv2
diff --git a/test/shell/thin-dmeventd-warns.sh b/test/shell/thin-dmeventd-warns.sh
index a8002ae99..f7b1475b2 100644
--- a/test/shell/thin-dmeventd-warns.sh
+++ b/test/shell/thin-dmeventd-warns.sh
@@ -46,19 +46,19 @@ aux prepare_vg
lvcreate -L8 -V8 -T $vg/pool -n $lv1
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=26 oflag=direct
test "$(percent_)" -gt 80
# Give it some time to dmeventd to log WARNING
wait_warn_ 1
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 oflag=direct
test "$(percent_)" -gt 90
# Give it some time to dmeventd to log WARNING
wait_warn_ 2
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=8 oflag=direct
test "$(percent_)" -eq 100
wait_warn_ 3
@@ -73,7 +73,7 @@ sleep 11
# below 'WARNED' threshold.
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=256K count=30 oflag=direct
test "$(percent_)" -gt 90
lvs -a $vg
diff --git a/test/shell/thin-flags.sh b/test/shell/thin-flags.sh
index 12b1b75dd..df139b211 100644
--- a/test/shell/thin-flags.sh
+++ b/test/shell/thin-flags.sh
@@ -47,7 +47,7 @@ lvchange -an $vg
# Overfill data area
lvchange -ay $vg
-dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=1M count=2
+dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=1M count=2 oflag=direct
check lv_attr_bit health $vg/pool "D"
# TODO use spaces ??
check lv_field $vg/pool lv_health_status "out_of_data"
@@ -78,7 +78,7 @@ lvchange -ay $vg
lvchange -ay $vg/$lv2
# Provisiong and last free bits in metadata
-dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=32K count=1
+dd if=/dev/zero of="$DM_DEV_DIR/mapper/$vg-$lv2" bs=32K count=1 oflag=direct
check lv_attr_bit health $vg/pool "M"
# TODO - use spaces ??
diff --git a/test/shell/thin-many-dmeventd.sh b/test/shell/thin-many-dmeventd.sh
index 2a1fe7445..dc873e893 100644
--- a/test/shell/thin-many-dmeventd.sh
+++ b/test/shell/thin-many-dmeventd.sh
@@ -35,7 +35,7 @@ for i in $(seq 1 5)
do
lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
# Fill thin-pool to some capacity >50%
- dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync
+ dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 oflag=direct
done
lvs -a $vg
@@ -55,11 +55,16 @@ sleep 9
# new thin-pool registration.
for i in $(seq 11 15)
do
- "$TIME" -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
- read -r t < TM
- test ${t%%.*} -lt 8 || die "Creation of thin pool took more then 8 second! ($t seconds)"
- # Fill thin-pool to some capacity >50%
- dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync
+ #/usr/bin/time -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+ #read -r t < TM
+ #test ${t%%.*} -lt 8 || die "Creation of thin pool took more then 8 second! ($t seconds)"
+ START=$(date +%s)
+ lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+ END=$(date +%s)
+ DIFF=$(( END - START ))
+ test "$DIFF" -lt 8 || die "Creation of thin pool took more then 8 second! ($DIFF seconds)"
+ # Fill thin-pool to some capacity >50%
+ dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 oflag=direct
done
vgremove -f $vg
diff --git a/test/shell/vg-check-devs-used.sh b/test/shell/vg-check-devs-used.sh
index f62799e20..3b911bc10 100644
--- a/test/shell/vg-check-devs-used.sh
+++ b/test/shell/vg-check-devs-used.sh
@@ -22,11 +22,11 @@ aux prepare_devs 3 8
vgcreate $SHARED "$vg" "$dev1" "$dev2"
lvcreate -l100%FREE -n $lv $vg
-dd if="$dev1" of="$dev3" bs=1M
+dd if="$dev1" of="$dev3" bs=1M oflag=direct
pvs --config "devices/global_filter = [ \"a|$dev2|\", \"a|$dev3|\", \"r|.*|\" ]" 2>err
grep "WARNING: Device mismatch detected for $vg/$lv which is accessing $dev1 instead of $dev3" err
-dd if=/dev/zero of="$dev3" bs=1M count=8
+dd if=/dev/zero of="$dev3" bs=1M count=8 oflag=direct
lvremove -ff $vg
# Also test if sub LVs with suffixes are correctly processed.
3 years, 6 months