master - libdm: typo
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fe3b9bb7d47ef168c16...
Commit: fe3b9bb7d47ef168c16cc35e306a41cbb38e869c
Parent: 6471bb2c41cf0e692a8fe7ea00033327359d42fc
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 24 00:12:41 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 24 00:12:41 2017 +0100
libdm: typo
---
libdm/libdm-deptree.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 9bc7674..3551592 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2378,7 +2378,7 @@ static int _get_params_count(uint64_t *bits)
/*
* Get target version (major, minor and patchlevel) for @target_name
*
- * FIXEM: this function is derived from liblvm.
+ * FIXME: this function is derived from liblvm.
* Integrate with move of liblvm functions
* to libdm in future library layer purge
* (e.g. expose as API dm_target_version()?)
7 years, 1 month
master - commands: improve error message for unknown command
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6471bb2c41cf0e692a8...
Commit: 6471bb2c41cf0e692a8fe7ea00033327359d42fc
Parent: 0dabe7237c531459792de953879a5c4c6de41c65
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Mar 23 03:35:06 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Mar 23 03:35:06 2017 -0500
commands: improve error message for unknown command
when running "lvm foo".
---
tools/lvmcmdline.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4f0610d..9cb506a 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2674,7 +2674,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
return_ECMD_FAILED;
if (!_process_command_line(cmd, &argc, &argv)) {
- log_error("Error during parsing of command line.");
+ log_error("Command name not found.");
return EINVALID_CMD_LINE;
}
7 years, 1 month
master - commands: fix commands with run with path basename
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0dabe7237c531459792...
Commit: 0dabe7237c531459792de953879a5c4c6de41c65
Parent: e8362b4cb7fcb4575d843f5b1f6e5c8b66fa99c0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Mar 23 03:06:07 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Mar 23 03:06:07 2017 -0500
commands: fix commands with run with path basename
The recent command definitions commit took the command
name from argv[0] without applying basename to the value,
so a pathname, e.g. /usr/sbin, would cause lvm to not
recognize the command name.
---
tools/lvmcmdline.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index f339928..4f0610d 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2632,7 +2632,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
/* each command should start out with sigint flag cleared */
sigint_clear();
- cmd->name = dm_pool_strdup(cmd->mem, argv[0]);
+ cmd->name = dm_pool_strdup(cmd->mem, dm_basename(argv[0]));
configure_command_option_values(cmd->name);
@@ -3356,7 +3356,7 @@ int lvm2_main(int argc, char **argv)
if (!alias && argc == 1)
name = NULL;
else if (alias)
- name = argv[0];
+ name = (char *)dm_basename(argv[0]);
else
name = argv[1];
7 years, 1 month
master - tools: Show configuration command line in lvm version.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e8362b4cb7fcb4575d8...
Commit: e8362b4cb7fcb4575d843f5b1f6e5c8b66fa99c0
Parent: b84bf3e8cd95e74bc39c7e661a6e010fdccb5078
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Mar 23 01:00:49 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Mar 23 01:01:35 2017 +0000
tools: Show configuration command line in lvm version.
Also update configure.in with some items recently added to the tree.
---
WHATS_NEW | 1 +
configure | 29 ++++++++++++++++++++++++++++-
configure.in | 6 +++++-
include/configure.h.in | 6 ++++++
tools/lvmcmdline.c | 1 +
5 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 99a0bda..b06effe 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ Add configuration command line to 'lvm version' output.
Adjust to misordered raid parameters
Conditionally reject raid convert to striped/raid0* after reshape
Ensure raid6 upconversion restrictions
diff --git a/configure b/configure
index 4798d5e..c3901d4 100755
--- a/configure
+++ b/configure
@@ -3015,6 +3015,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+CONFIGURE_LINE="$0 $@"
ac_config_headers="$ac_config_headers include/configure.h"
@@ -6078,7 +6079,7 @@ fi
done
-for ac_header in termios.h sys/statvfs.h sys/timerfd.h linux/magic.h linux/fiemap.h
+for ac_header in termios.h sys/statvfs.h sys/timerfd.h sys/vfs.h linux/magic.h linux/fiemap.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -6271,6 +6272,26 @@ _ACEOF
fi
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLOCKS 1
+_ACEOF
+
+
+$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" fileblocks.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
+ ;;
+esac
+
+fi
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
if ${ac_cv_struct_tm+:} false; then :
@@ -15473,6 +15494,12 @@ LVM_MINOR=`echo "$VER" | $AWK -F '.' '{print $2}'`
LVM_PATCHLEVEL=`echo "$VER" | $AWK -F '[(.]' '{print $3}'`
LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
+
+cat >>confdefs.h <<_ACEOF
+#define LVM_CONFIGURE_LINE "$CONFIGURE_LINE"
+_ACEOF
+
+
################################################################################
diff --git a/configure.in b/configure.in
index 9dfb836..42ec52f 100644
--- a/configure.in
+++ b/configure.in
@@ -15,6 +15,7 @@ AC_PREREQ(2.69)
################################################################################
dnl -- Process this file with autoconf to produce a configure script.
AC_INIT
+CONFIGURE_LINE="$0 $@"
AC_CONFIG_SRCDIR([lib/device/dev-cache.h])
AC_CONFIG_HEADERS([include/configure.h])
@@ -105,7 +106,7 @@ AC_CHECK_HEADERS([assert.h ctype.h dirent.h errno.h fcntl.h float.h \
sys/time.h sys/types.h sys/utsname.h sys/wait.h time.h \
unistd.h], , [AC_MSG_ERROR(bailing out)])
-AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h linux/magic.h linux/fiemap.h)
+AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h sys/vfs.h linux/magic.h linux/fiemap.h)
case "$host_os" in
linux*)
@@ -120,6 +121,7 @@ AC_C_CONST
AC_C_INLINE
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_CHECK_TYPES([ptrdiff_t])
+AC_STRUCT_ST_BLOCKS
AC_STRUCT_TM
AC_TYPE_OFF_T
AC_TYPE_PID_T
@@ -2001,6 +2003,8 @@ LVM_MINOR=`echo "$VER" | $AWK -F '.' '{print $2}'`
LVM_PATCHLEVEL=`echo "$VER" | $AWK -F '[[(.]]' '{print $3}'`
LVM_LIBAPI=`echo "$VER" | $AWK -F '[[()]]' '{print $2}'`
+AC_DEFINE_UNQUOTED(LVM_CONFIGURE_LINE, "$CONFIGURE_LINE", [configure command line used])
+
################################################################################
AC_SUBST(APPLIB)
AC_SUBST(AWK)
diff --git a/include/configure.h.in b/include/configure.h.in
index 89a5e48..04e7f4b 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -491,6 +491,9 @@
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
+/* Define to 1 if you have the <sys/inotify.h> header file. */
+#undef HAVE_SYS_INOTIFY_H
+
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
@@ -626,6 +629,9 @@
/* Define to 1 to include code that uses lvmpolld. */
#undef LVMPOLLD_SUPPORT
+/* configure command line used */
+#undef LVM_CONFIGURE_LINE
+
/* Path to lvm binary. */
#undef LVM_PATH
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 5386bf3..f339928 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2139,6 +2139,7 @@ int version(struct cmd_context *cmd __attribute__((unused)),
log_print("Library version: %s", vsn);
if (driver_version(vsn, sizeof(vsn)))
log_print("Driver version: %s", vsn);
+ log_print("Configuration: %s", LVM_CONFIGURE_LINE);
return ECMD_PROCESSED;
}
7 years, 1 month
master - raid: adjust to misordered raid table line output
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b84bf3e8cd95e74bc39...
Commit: b84bf3e8cd95e74bc39c7e661a6e010fdccb5078
Parent: 1bf90dac77765fa742964adab4aec3f0a58241de
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 23 01:20:00 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 23 01:20:00 2017 +0100
raid: adjust to misordered raid table line output
This commit supersedes reverted 1e4462dbfbd2bbe3590936df24b3ccd83110b158
to avoid changes to liblvm and the libdm API completely.
The libdevmapper interface compares existing table line retrieved from
the kernel to new table line created to decide if it can suppress a reload.
Any difference between input and output of the table line is taken to be a
change thus causing a table reload.
The dm-raid target started to misorder the raid parameters (e.g. 'raid10_copies')
starting with dm-raid target version 1.9.0 up to (excluding) 1.11.0. This causes
runtime failures (limited to raid10 as of tests) and needs to be reversed to allow
e.g. old lvm2 uspace to run properly.
Check for the aforementioned version range in libdm and adjust creation of the table line
to the respective (mis)ordered sequence inside and correct order outside the range
(as described for the raid target in the kernels Documentation/device-mapper/dm-raid.txt).
---
libdm/libdm-deptree.c | 152 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 120 insertions(+), 32 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 832d8de..9bc7674 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2375,6 +2375,51 @@ static int _get_params_count(uint64_t *bits)
return r;
}
+/*
+ * Get target version (major, minor and patchlevel) for @target_name
+ *
+ * FIXEM: this function is derived from liblvm.
+ * Integrate with move of liblvm functions
+ * to libdm in future library layer purge
+ * (e.g. expose as API dm_target_version()?)
+ */
+static int _target_version(const char *target_name, uint32_t *maj,
+ uint32_t *min, uint32_t *patchlevel)
+{
+ int r = 0;
+ struct dm_task *dmt;
+ struct dm_versions *target, *last_target = NULL;
+
+ log_very_verbose("Getting target version for %s", target_name);
+ if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
+ return_0;
+
+ if (!dm_task_run(dmt)) {
+ log_debug_activation("Failed to get %s target versions", target_name);
+ /* Assume this was because LIST_VERSIONS isn't supported */
+ maj = min = patchlevel = 0;
+ r = 1;
+
+ } else
+ for (target = dm_task_get_versions(dmt);
+ target != last_target;
+ last_target = target, target = (struct dm_versions *)((char *) target + target->next))
+ if (!strcmp(target_name, target->name)) {
+ *maj = target->version[0];
+ *min = target->version[1];
+ *patchlevel = target->version[2];
+ log_very_verbose("Found %s target "
+ "v%" PRIu32 ".%" PRIu32 ".%" PRIu32 ".",
+ target_name, *maj, *min, *patchlevel);
+ r = 1;
+ break;
+ }
+
+ dm_task_destroy(dmt);
+
+ return r;
+}
+
static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
uint32_t minor, struct load_segment *seg,
uint64_t *seg_start, char *params,
@@ -2382,6 +2427,7 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
{
uint32_t i;
uint32_t area_count = seg->area_count / 2;
+ uint32_t maj, min, patchlevel;
int param_count = 1; /* mandatory 'chunk size'/'stripe size' arg */
int pos = 0;
unsigned type;
@@ -2425,53 +2471,95 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
type == SEG_RAID10 ? "raid10" : _dm_segtypes[type].target,
param_count, seg->stripe_size);
+ if (!_target_version("raid", &maj, &min, &patchlevel))
+ return_0;
+
+ /*
+ * Target version prior to 1.9.0 and >= 1.11.0 emit
+ * order of parameters as of kernel target documentation
+ */
+ if (maj > 1 || (maj == 1 && (min < 9 || min >= 11))) {
+ if (seg->flags & DM_NOSYNC)
+ EMIT_PARAMS(pos, " nosync");
+ else if (seg->flags & DM_FORCESYNC)
+ EMIT_PARAMS(pos, " sync");
+
+ for (i = 0; i < area_count; i++)
+ if (seg->rebuilds[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " rebuild %u", i);
+
+ if (seg->min_recovery_rate)
+ EMIT_PARAMS(pos, " min_recovery_rate %u",
+ seg->min_recovery_rate);
+
+ if (seg->max_recovery_rate)
+ EMIT_PARAMS(pos, " max_recovery_rate %u",
+ seg->max_recovery_rate);
+
+ for (i = 0; i < area_count; i++)
+ if (seg->writemostly[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " write_mostly %u", i);
+
+ if (seg->writebehind)
+ EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
+
+ if (seg->region_size)
+ EMIT_PARAMS(pos, " region_size %u", seg->region_size);
+
+ if (seg->data_copies > 1 && type == SEG_RAID10)
+ EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
#if 0
if (seg->type == SEG_RAID10_FAR)
EMIT_PARAMS(pos, " raid10_format far");
else if (seg->type == SEG_RAID10_OFFSET)
EMIT_PARAMS(pos, " raid10_format offset");
#endif
+ if (seg->delta_disks)
+ EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
- if (seg->data_copies > 1 && type == SEG_RAID10)
- EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
+ /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
+ if (seg->data_offset)
+ EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
- if (seg->flags & DM_NOSYNC)
- EMIT_PARAMS(pos, " nosync");
- else if (seg->flags & DM_FORCESYNC)
- EMIT_PARAMS(pos, " sync");
+ /* Target version >= 1.9.0 && < 1.11.0 had a table line parameter ordering flaw */
+ } else {
+ if (seg->data_copies > 1 && type == SEG_RAID10)
+ EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
- if (seg->region_size)
- EMIT_PARAMS(pos, " region_size %u", seg->region_size);
+ if (seg->flags & DM_NOSYNC)
+ EMIT_PARAMS(pos, " nosync");
+ else if (seg->flags & DM_FORCESYNC)
+ EMIT_PARAMS(pos, " sync");
- /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
- if (seg->data_offset)
- EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
+ if (seg->region_size)
+ EMIT_PARAMS(pos, " region_size %u", seg->region_size);
- if (seg->delta_disks)
- EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
+ /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
+ if (seg->data_offset)
+ EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
- for (i = 0; i < area_count; i++)
- if (seg->rebuilds[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " rebuild %u", i);
+ if (seg->delta_disks)
+ EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
- for (i = 0; i < area_count; i++)
- if (seg->writemostly[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " write_mostly %u", i);
+ for (i = 0; i < area_count; i++)
+ if (seg->rebuilds[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " rebuild %u", i);
- if (seg->writebehind)
- EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
+ for (i = 0; i < area_count; i++)
+ if (seg->writemostly[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " write_mostly %u", i);
- /*
- * Has to be before "min_recovery_rate" or the kernels
- * check will fail when both set and min > previous max
- */
- if (seg->max_recovery_rate)
- EMIT_PARAMS(pos, " max_recovery_rate %u",
- seg->max_recovery_rate);
+ if (seg->writebehind)
+ EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
- if (seg->min_recovery_rate)
- EMIT_PARAMS(pos, " min_recovery_rate %u",
- seg->min_recovery_rate);
+ if (seg->max_recovery_rate)
+ EMIT_PARAMS(pos, " max_recovery_rate %u",
+ seg->max_recovery_rate);
+
+ if (seg->min_recovery_rate)
+ EMIT_PARAMS(pos, " min_recovery_rate %u",
+ seg->min_recovery_rate);
+ }
/* Print number of metadata/data device pairs */
EMIT_PARAMS(pos, " %u", area_count);
@@ -2742,7 +2830,7 @@ static int _emit_segment(struct dm_task *dmt, uint32_t major, uint32_t minor,
struct load_segment *seg, uint64_t *seg_start)
{
char *params;
- size_t paramsize = 4096;
+ size_t paramsize = 4096; /* FIXME: too small for long RAID lines when > 64 devices supported */
int ret;
do {
7 years, 1 month
master - Revert "raid: adjust to misordered raid table line output"
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1bf90dac77765fa7429...
Commit: 1bf90dac77765fa742964adab4aec3f0a58241de
Parent: 14c4d32247808fc0c32944a09ea06611244fdb3d
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Mar 22 17:50:51 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 23 01:19:41 2017 +0100
Revert "raid: adjust to misordered raid table line output"
This reverts commit 1e4462dbfbd2bbe3590936df24b3ccd83110b158
in favour of an enhanced solution avoiding changes in liblvm
completetly by checking the target versions in libdm and emitting
the respective parameter lines.
---
lib/metadata/segtype.h | 1 -
lib/raid/raid.c | 23 +----------
libdm/libdevmapper.h | 10 -----
libdm/libdm-deptree.c | 102 +++++++++++++++---------------------------------
4 files changed, 33 insertions(+), 103 deletions(-)
diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h
index 2be9eac..421c6f9 100644
--- a/lib/metadata/segtype.h
+++ b/lib/metadata/segtype.h
@@ -288,7 +288,6 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd,
#define RAID_FEATURE_RAID4 (1U << 3) /* ! version 1.8 or 1.9.0 */
#define RAID_FEATURE_SHRINK (1U << 4) /* version 1.9.0 */
#define RAID_FEATURE_RESHAPE (1U << 5) /* version 1.10.1 */
-#define RAID_FEATURE_PROPER_TABLE_ORDER (1U << 6) /* version >= 1.9.0 and < 1.11.0 had wrong parameter order */
#ifdef RAID_INTERNAL
int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 7e9f0d3..df9796d 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -228,9 +228,6 @@ static int _raid_text_export(const struct lv_segment *seg, struct formatter *f)
return _raid_text_export_raid(seg, f);
}
-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)),
@@ -241,7 +238,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
uint32_t *pvmove_mirror_count __attribute__((unused)))
{
int delta_disks = 0, delta_disks_minus = 0, delta_disks_plus = 0, data_offset = 0;
- unsigned attrs;
uint32_t s;
uint64_t flags = 0;
uint64_t rebuilds[RAID_BITMAP_SIZE];
@@ -304,13 +300,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
flags = DM_NOSYNC;
}
- if (!_raid_target_present(seg->lv->vg->cmd, seg, &attrs))
- return_0;
-
- /* RAID target line parameters are in kernel documented order */
- if (attrs & RAID_FEATURE_PROPER_TABLE_ORDER)
- flags |= DM_RAID_TABLE_ORDERED;
-
params.raid_type = lvseg_name(seg);
if (seg->segtype->parity_devs) {
@@ -490,7 +479,7 @@ static int _raid_target_present(struct cmd_context *cmd,
static int _raid_checked = 0;
static int _raid_present = 0;
- static unsigned _raid_attrs;
+ static unsigned _raid_attrs = 0;
uint32_t maj, min, patchlevel;
unsigned i;
@@ -499,7 +488,6 @@ static int _raid_target_present(struct cmd_context *cmd,
if (!_raid_checked) {
_raid_checked = 1;
- _raid_attrs = RAID_FEATURE_PROPER_TABLE_ORDER;
if (!(_raid_present = target_present(cmd, TARGET_NAME_RAID, 1)))
return 0;
@@ -526,15 +514,6 @@ static int _raid_target_present(struct cmd_context *cmd,
else
log_very_verbose("Target raid does not support %s.",
SEG_TYPE_NAME_RAID4);
-
- /*
- * Target version range check:
- *
- * raid target line parameters were misordered (e.g. 'raid10_copies')
- * in target version >= 1.9.0 and < 1.11.0
- */
- if (maj == 1 && min >= 9 && min < 11)
- _raid_attrs &= ~RAID_FEATURE_PROPER_TABLE_ORDER;
}
if (attributes)
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index ff84785..4bd32b4 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1775,16 +1775,6 @@ int dm_tree_node_add_mirror_target(struct dm_tree_node *node,
#define DM_BLOCK_ON_ERROR 0x00000004 /* On error, suspend I/O */
#define DM_CORELOG 0x00000008 /* In-memory log */
-/*
- * RAID flag: table line is in kernel documented order.
- *
- * Target version >= 1.9.0 and < 1.11.0 misordered e.g. 'raid10_copies'
- *
- * Keep distinct from mirror log ones above because it
- * can be passed together with those in load segment flags!
- */
-#define DM_RAID_TABLE_ORDERED 0x00000010
-
int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node,
uint32_t region_size,
unsigned clustered,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 2dced75..832d8de 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2432,84 +2432,46 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
EMIT_PARAMS(pos, " raid10_format offset");
#endif
- if (seg->flags & DM_RAID_TABLE_ORDERED) {
- /* Emit order of paramters as of kernel target documentation */
- if (seg->flags & DM_NOSYNC)
- EMIT_PARAMS(pos, " nosync");
- else if (seg->flags & DM_FORCESYNC)
- EMIT_PARAMS(pos, " sync");
+ if (seg->data_copies > 1 && type == SEG_RAID10)
+ EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
- for (i = 0; i < area_count; i++)
- if (seg->rebuilds[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " rebuild %u", i);
-
- if (seg->min_recovery_rate)
- EMIT_PARAMS(pos, " min_recovery_rate %u",
- seg->min_recovery_rate);
-
- if (seg->max_recovery_rate)
- EMIT_PARAMS(pos, " max_recovery_rate %u",
- seg->max_recovery_rate);
-
- for (i = 0; i < area_count; i++)
- if (seg->writemostly[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " write_mostly %u", i);
-
- if (seg->writebehind)
- EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
-
- if (seg->region_size)
- EMIT_PARAMS(pos, " region_size %u", seg->region_size);
-
- if (seg->data_copies > 1 && type == SEG_RAID10)
- EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
-
- if (seg->delta_disks)
- EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
-
- /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
- if (seg->data_offset)
- EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
-
- } else {
- /* Target version >= 1.9.0 && < 1.11.0 had a table line parameter ordering flaw */
- if (seg->data_copies > 1 && type == SEG_RAID10)
- EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
-
- if (seg->flags & DM_NOSYNC)
- EMIT_PARAMS(pos, " nosync");
- else if (seg->flags & DM_FORCESYNC)
- EMIT_PARAMS(pos, " sync");
+ if (seg->flags & DM_NOSYNC)
+ EMIT_PARAMS(pos, " nosync");
+ else if (seg->flags & DM_FORCESYNC)
+ EMIT_PARAMS(pos, " sync");
- if (seg->region_size)
- EMIT_PARAMS(pos, " region_size %u", seg->region_size);
+ if (seg->region_size)
+ EMIT_PARAMS(pos, " region_size %u", seg->region_size);
- /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
- if (seg->data_offset)
- EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
+ /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
+ if (seg->data_offset)
+ EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
- if (seg->delta_disks)
- EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
+ if (seg->delta_disks)
+ EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
- for (i = 0; i < area_count; i++)
- if (seg->rebuilds[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " rebuild %u", i);
+ for (i = 0; i < area_count; i++)
+ if (seg->rebuilds[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " rebuild %u", i);
- for (i = 0; i < area_count; i++)
- if (seg->writemostly[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " write_mostly %u", i);
+ for (i = 0; i < area_count; i++)
+ if (seg->writemostly[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " write_mostly %u", i);
- if (seg->writebehind)
- EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
+ if (seg->writebehind)
+ EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
- if (seg->max_recovery_rate)
- EMIT_PARAMS(pos, " max_recovery_rate %u",
- seg->max_recovery_rate);
+ /*
+ * Has to be before "min_recovery_rate" or the kernels
+ * check will fail when both set and min > previous max
+ */
+ if (seg->max_recovery_rate)
+ EMIT_PARAMS(pos, " max_recovery_rate %u",
+ seg->max_recovery_rate);
- if (seg->min_recovery_rate)
- EMIT_PARAMS(pos, " min_recovery_rate %u",
- seg->min_recovery_rate);
- }
+ if (seg->min_recovery_rate)
+ EMIT_PARAMS(pos, " min_recovery_rate %u",
+ seg->min_recovery_rate);
/* Print number of metadata/data device pairs */
EMIT_PARAMS(pos, " %u", area_count);
@@ -2780,7 +2742,7 @@ static int _emit_segment(struct dm_task *dmt, uint32_t major, uint32_t minor,
struct load_segment *seg, uint64_t *seg_start)
{
char *params;
- size_t paramsize = 4096; /* FIXME: too small for long RAID lines when > 64 devices supported */
+ size_t paramsize = 4096;
int ret;
do {
7 years, 1 month
master - raid: adjust to misordered raid table line output
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=de79c1937135026d2f5...
Commit: de79c1937135026d2f5738d1c2a91cab503d2f99
Parent: 735425eb9d513cf9293c77a0e618a9c248af14bc
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Mar 23 01:14:19 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 23 01:14:19 2017 +0100
raid: adjust to misordered raid table line output
This commit supersedes reverted 1e4462dbfbd2bbe3590936df24b3ccd83110b158
to avoid changes to liblvm and the libdm API completely.
The libdevmapper interface compares existing table line retrieved from
the kernel to new table line created to decide if it can suppress a reload.
Any difference between input and output of the table line is taken to be a
change thus causing a table reload.
The dm-raid target started to misorder the raid parameters (e.g. 'raid10_copies')
starting with dm-raid target version 1.9.0 up to (excluding) 1.11.0. This causes
runtime failures (limited to raid10 as of tests) and needs to be reversed to allow
e.g. old lvm2 uspace to run properly.
Check for the aforementioned version range in libdm and adjust creation of the table line
to the respective (mis)ordered sequence inside and correct order outside the range
(as described for the raid target in the kernels Documentation/device-mapper/dm-raid.txt).
---
libdm/libdm-deptree.c | 152 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 120 insertions(+), 32 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 832d8de..9bc7674 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2375,6 +2375,51 @@ static int _get_params_count(uint64_t *bits)
return r;
}
+/*
+ * Get target version (major, minor and patchlevel) for @target_name
+ *
+ * FIXEM: this function is derived from liblvm.
+ * Integrate with move of liblvm functions
+ * to libdm in future library layer purge
+ * (e.g. expose as API dm_target_version()?)
+ */
+static int _target_version(const char *target_name, uint32_t *maj,
+ uint32_t *min, uint32_t *patchlevel)
+{
+ int r = 0;
+ struct dm_task *dmt;
+ struct dm_versions *target, *last_target = NULL;
+
+ log_very_verbose("Getting target version for %s", target_name);
+ if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
+ return_0;
+
+ if (!dm_task_run(dmt)) {
+ log_debug_activation("Failed to get %s target versions", target_name);
+ /* Assume this was because LIST_VERSIONS isn't supported */
+ maj = min = patchlevel = 0;
+ r = 1;
+
+ } else
+ for (target = dm_task_get_versions(dmt);
+ target != last_target;
+ last_target = target, target = (struct dm_versions *)((char *) target + target->next))
+ if (!strcmp(target_name, target->name)) {
+ *maj = target->version[0];
+ *min = target->version[1];
+ *patchlevel = target->version[2];
+ log_very_verbose("Found %s target "
+ "v%" PRIu32 ".%" PRIu32 ".%" PRIu32 ".",
+ target_name, *maj, *min, *patchlevel);
+ r = 1;
+ break;
+ }
+
+ dm_task_destroy(dmt);
+
+ return r;
+}
+
static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
uint32_t minor, struct load_segment *seg,
uint64_t *seg_start, char *params,
@@ -2382,6 +2427,7 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
{
uint32_t i;
uint32_t area_count = seg->area_count / 2;
+ uint32_t maj, min, patchlevel;
int param_count = 1; /* mandatory 'chunk size'/'stripe size' arg */
int pos = 0;
unsigned type;
@@ -2425,53 +2471,95 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
type == SEG_RAID10 ? "raid10" : _dm_segtypes[type].target,
param_count, seg->stripe_size);
+ if (!_target_version("raid", &maj, &min, &patchlevel))
+ return_0;
+
+ /*
+ * Target version prior to 1.9.0 and >= 1.11.0 emit
+ * order of parameters as of kernel target documentation
+ */
+ if (maj > 1 || (maj == 1 && (min < 9 || min >= 11))) {
+ if (seg->flags & DM_NOSYNC)
+ EMIT_PARAMS(pos, " nosync");
+ else if (seg->flags & DM_FORCESYNC)
+ EMIT_PARAMS(pos, " sync");
+
+ for (i = 0; i < area_count; i++)
+ if (seg->rebuilds[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " rebuild %u", i);
+
+ if (seg->min_recovery_rate)
+ EMIT_PARAMS(pos, " min_recovery_rate %u",
+ seg->min_recovery_rate);
+
+ if (seg->max_recovery_rate)
+ EMIT_PARAMS(pos, " max_recovery_rate %u",
+ seg->max_recovery_rate);
+
+ for (i = 0; i < area_count; i++)
+ if (seg->writemostly[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " write_mostly %u", i);
+
+ if (seg->writebehind)
+ EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
+
+ if (seg->region_size)
+ EMIT_PARAMS(pos, " region_size %u", seg->region_size);
+
+ if (seg->data_copies > 1 && type == SEG_RAID10)
+ EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
#if 0
if (seg->type == SEG_RAID10_FAR)
EMIT_PARAMS(pos, " raid10_format far");
else if (seg->type == SEG_RAID10_OFFSET)
EMIT_PARAMS(pos, " raid10_format offset");
#endif
+ if (seg->delta_disks)
+ EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
- if (seg->data_copies > 1 && type == SEG_RAID10)
- EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
+ /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
+ if (seg->data_offset)
+ EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
- if (seg->flags & DM_NOSYNC)
- EMIT_PARAMS(pos, " nosync");
- else if (seg->flags & DM_FORCESYNC)
- EMIT_PARAMS(pos, " sync");
+ /* Target version >= 1.9.0 && < 1.11.0 had a table line parameter ordering flaw */
+ } else {
+ if (seg->data_copies > 1 && type == SEG_RAID10)
+ EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
- if (seg->region_size)
- EMIT_PARAMS(pos, " region_size %u", seg->region_size);
+ if (seg->flags & DM_NOSYNC)
+ EMIT_PARAMS(pos, " nosync");
+ else if (seg->flags & DM_FORCESYNC)
+ EMIT_PARAMS(pos, " sync");
- /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
- if (seg->data_offset)
- EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
+ if (seg->region_size)
+ EMIT_PARAMS(pos, " region_size %u", seg->region_size);
- if (seg->delta_disks)
- EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
+ /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
+ if (seg->data_offset)
+ EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
- for (i = 0; i < area_count; i++)
- if (seg->rebuilds[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " rebuild %u", i);
+ if (seg->delta_disks)
+ EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
- for (i = 0; i < area_count; i++)
- if (seg->writemostly[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " write_mostly %u", i);
+ for (i = 0; i < area_count; i++)
+ if (seg->rebuilds[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " rebuild %u", i);
- if (seg->writebehind)
- EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
+ for (i = 0; i < area_count; i++)
+ if (seg->writemostly[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " write_mostly %u", i);
- /*
- * Has to be before "min_recovery_rate" or the kernels
- * check will fail when both set and min > previous max
- */
- if (seg->max_recovery_rate)
- EMIT_PARAMS(pos, " max_recovery_rate %u",
- seg->max_recovery_rate);
+ if (seg->writebehind)
+ EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
- if (seg->min_recovery_rate)
- EMIT_PARAMS(pos, " min_recovery_rate %u",
- seg->min_recovery_rate);
+ if (seg->max_recovery_rate)
+ EMIT_PARAMS(pos, " max_recovery_rate %u",
+ seg->max_recovery_rate);
+
+ if (seg->min_recovery_rate)
+ EMIT_PARAMS(pos, " min_recovery_rate %u",
+ seg->min_recovery_rate);
+ }
/* Print number of metadata/data device pairs */
EMIT_PARAMS(pos, " %u", area_count);
@@ -2742,7 +2830,7 @@ static int _emit_segment(struct dm_task *dmt, uint32_t major, uint32_t minor,
struct load_segment *seg, uint64_t *seg_start)
{
char *params;
- size_t paramsize = 4096;
+ size_t paramsize = 4096; /* FIXME: too small for long RAID lines when > 64 devices supported */
int ret;
do {
7 years, 1 month
master - Revert "raid: adjust to misordered raid table line output"
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=735425eb9d513cf9293...
Commit: 735425eb9d513cf9293c77a0e618a9c248af14bc
Parent: 14c4d32247808fc0c32944a09ea06611244fdb3d
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Mar 22 17:50:51 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Mar 23 01:13:52 2017 +0100
Revert "raid: adjust to misordered raid table line output"
This reverts commit 1e4462dbfbd2bbe3590936df24b3ccd83110b158
in favoour of an enhanced solution avoiding changes in liblvm
completetly by checking the target versions in libdm and emitting
the respective paramter lines.
---
lib/metadata/segtype.h | 1 -
lib/raid/raid.c | 23 +----------
libdm/libdevmapper.h | 10 -----
libdm/libdm-deptree.c | 102 +++++++++++++++---------------------------------
4 files changed, 33 insertions(+), 103 deletions(-)
diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h
index 2be9eac..421c6f9 100644
--- a/lib/metadata/segtype.h
+++ b/lib/metadata/segtype.h
@@ -288,7 +288,6 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd,
#define RAID_FEATURE_RAID4 (1U << 3) /* ! version 1.8 or 1.9.0 */
#define RAID_FEATURE_SHRINK (1U << 4) /* version 1.9.0 */
#define RAID_FEATURE_RESHAPE (1U << 5) /* version 1.10.1 */
-#define RAID_FEATURE_PROPER_TABLE_ORDER (1U << 6) /* version >= 1.9.0 and < 1.11.0 had wrong parameter order */
#ifdef RAID_INTERNAL
int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 7e9f0d3..df9796d 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -228,9 +228,6 @@ static int _raid_text_export(const struct lv_segment *seg, struct formatter *f)
return _raid_text_export_raid(seg, f);
}
-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)),
@@ -241,7 +238,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
uint32_t *pvmove_mirror_count __attribute__((unused)))
{
int delta_disks = 0, delta_disks_minus = 0, delta_disks_plus = 0, data_offset = 0;
- unsigned attrs;
uint32_t s;
uint64_t flags = 0;
uint64_t rebuilds[RAID_BITMAP_SIZE];
@@ -304,13 +300,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
flags = DM_NOSYNC;
}
- if (!_raid_target_present(seg->lv->vg->cmd, seg, &attrs))
- return_0;
-
- /* RAID target line parameters are in kernel documented order */
- if (attrs & RAID_FEATURE_PROPER_TABLE_ORDER)
- flags |= DM_RAID_TABLE_ORDERED;
-
params.raid_type = lvseg_name(seg);
if (seg->segtype->parity_devs) {
@@ -490,7 +479,7 @@ static int _raid_target_present(struct cmd_context *cmd,
static int _raid_checked = 0;
static int _raid_present = 0;
- static unsigned _raid_attrs;
+ static unsigned _raid_attrs = 0;
uint32_t maj, min, patchlevel;
unsigned i;
@@ -499,7 +488,6 @@ static int _raid_target_present(struct cmd_context *cmd,
if (!_raid_checked) {
_raid_checked = 1;
- _raid_attrs = RAID_FEATURE_PROPER_TABLE_ORDER;
if (!(_raid_present = target_present(cmd, TARGET_NAME_RAID, 1)))
return 0;
@@ -526,15 +514,6 @@ static int _raid_target_present(struct cmd_context *cmd,
else
log_very_verbose("Target raid does not support %s.",
SEG_TYPE_NAME_RAID4);
-
- /*
- * Target version range check:
- *
- * raid target line parameters were misordered (e.g. 'raid10_copies')
- * in target version >= 1.9.0 and < 1.11.0
- */
- if (maj == 1 && min >= 9 && min < 11)
- _raid_attrs &= ~RAID_FEATURE_PROPER_TABLE_ORDER;
}
if (attributes)
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index ff84785..4bd32b4 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1775,16 +1775,6 @@ int dm_tree_node_add_mirror_target(struct dm_tree_node *node,
#define DM_BLOCK_ON_ERROR 0x00000004 /* On error, suspend I/O */
#define DM_CORELOG 0x00000008 /* In-memory log */
-/*
- * RAID flag: table line is in kernel documented order.
- *
- * Target version >= 1.9.0 and < 1.11.0 misordered e.g. 'raid10_copies'
- *
- * Keep distinct from mirror log ones above because it
- * can be passed together with those in load segment flags!
- */
-#define DM_RAID_TABLE_ORDERED 0x00000010
-
int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node,
uint32_t region_size,
unsigned clustered,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 2dced75..832d8de 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2432,84 +2432,46 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
EMIT_PARAMS(pos, " raid10_format offset");
#endif
- if (seg->flags & DM_RAID_TABLE_ORDERED) {
- /* Emit order of paramters as of kernel target documentation */
- if (seg->flags & DM_NOSYNC)
- EMIT_PARAMS(pos, " nosync");
- else if (seg->flags & DM_FORCESYNC)
- EMIT_PARAMS(pos, " sync");
+ if (seg->data_copies > 1 && type == SEG_RAID10)
+ EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
- for (i = 0; i < area_count; i++)
- if (seg->rebuilds[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " rebuild %u", i);
-
- if (seg->min_recovery_rate)
- EMIT_PARAMS(pos, " min_recovery_rate %u",
- seg->min_recovery_rate);
-
- if (seg->max_recovery_rate)
- EMIT_PARAMS(pos, " max_recovery_rate %u",
- seg->max_recovery_rate);
-
- for (i = 0; i < area_count; i++)
- if (seg->writemostly[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " write_mostly %u", i);
-
- if (seg->writebehind)
- EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
-
- if (seg->region_size)
- EMIT_PARAMS(pos, " region_size %u", seg->region_size);
-
- if (seg->data_copies > 1 && type == SEG_RAID10)
- EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
-
- if (seg->delta_disks)
- EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
-
- /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
- if (seg->data_offset)
- EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
-
- } else {
- /* Target version >= 1.9.0 && < 1.11.0 had a table line parameter ordering flaw */
- if (seg->data_copies > 1 && type == SEG_RAID10)
- EMIT_PARAMS(pos, " raid10_copies %u", seg->data_copies);
-
- if (seg->flags & DM_NOSYNC)
- EMIT_PARAMS(pos, " nosync");
- else if (seg->flags & DM_FORCESYNC)
- EMIT_PARAMS(pos, " sync");
+ if (seg->flags & DM_NOSYNC)
+ EMIT_PARAMS(pos, " nosync");
+ else if (seg->flags & DM_FORCESYNC)
+ EMIT_PARAMS(pos, " sync");
- if (seg->region_size)
- EMIT_PARAMS(pos, " region_size %u", seg->region_size);
+ if (seg->region_size)
+ EMIT_PARAMS(pos, " region_size %u", seg->region_size);
- /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
- if (seg->data_offset)
- EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
+ /* If seg-data_offset == 1, kernel needs a zero offset to adjust to it */
+ if (seg->data_offset)
+ EMIT_PARAMS(pos, " data_offset %d", seg->data_offset == 1 ? 0 : seg->data_offset);
- if (seg->delta_disks)
- EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
+ if (seg->delta_disks)
+ EMIT_PARAMS(pos, " delta_disks %d", seg->delta_disks);
- for (i = 0; i < area_count; i++)
- if (seg->rebuilds[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " rebuild %u", i);
+ for (i = 0; i < area_count; i++)
+ if (seg->rebuilds[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " rebuild %u", i);
- for (i = 0; i < area_count; i++)
- if (seg->writemostly[i/64] & (1ULL << (i%64)))
- EMIT_PARAMS(pos, " write_mostly %u", i);
+ for (i = 0; i < area_count; i++)
+ if (seg->writemostly[i/64] & (1ULL << (i%64)))
+ EMIT_PARAMS(pos, " write_mostly %u", i);
- if (seg->writebehind)
- EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
+ if (seg->writebehind)
+ EMIT_PARAMS(pos, " max_write_behind %u", seg->writebehind);
- if (seg->max_recovery_rate)
- EMIT_PARAMS(pos, " max_recovery_rate %u",
- seg->max_recovery_rate);
+ /*
+ * Has to be before "min_recovery_rate" or the kernels
+ * check will fail when both set and min > previous max
+ */
+ if (seg->max_recovery_rate)
+ EMIT_PARAMS(pos, " max_recovery_rate %u",
+ seg->max_recovery_rate);
- if (seg->min_recovery_rate)
- EMIT_PARAMS(pos, " min_recovery_rate %u",
- seg->min_recovery_rate);
- }
+ if (seg->min_recovery_rate)
+ EMIT_PARAMS(pos, " min_recovery_rate %u",
+ seg->min_recovery_rate);
/* Print number of metadata/data device pairs */
EMIT_PARAMS(pos, " %u", area_count);
@@ -2780,7 +2742,7 @@ static int _emit_segment(struct dm_task *dmt, uint32_t major, uint32_t minor,
struct load_segment *seg, uint64_t *seg_start)
{
char *params;
- size_t paramsize = 4096; /* FIXME: too small for long RAID lines when > 64 devices supported */
+ size_t paramsize = 4096;
int ret;
do {
7 years, 1 month
master - commands: fix combined thin pool and vol create defs
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=14c4d32247808fc0c32...
Commit: 14c4d32247808fc0c32944a09ea06611244fdb3d
Parent: 3be2e61c9fd775c03636937001a3f5e593096c85
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Mar 20 21:48:22 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 21 22:04:01 2017 -0500
commands: fix combined thin pool and vol create defs
Fixes command defs related to creating a new thin pool and
then a new thin lv in the new pool.
1. lvcreate --size --virtualsize --thinpool
Needs a cmd def, it was missing.
The def is unique by the three required
options: size, virtualsize and thinpool.
2. lvcreate --size --virtualsize --thinpool VG
Needs a cmd def, it was missing.
The def is unique by the three required
options: size, virtualsize and thinpool,
and one required positional arg: VG.
3. lvcreate --thin --virtualsize --size LV_new|VG
This existing def should not accept an optional
--type thin, which if used makes it indistinct
from another def.
4. lvcreate --size --virtualsize VG
This existing def should not accept an optional
--type thin or --thin, which if used makes it
indistinct from other defs (e.g. 3)
---
tools/command-lines.in | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 2fec553..f8a5e57 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1016,8 +1016,21 @@ DESC: Create a thin LV, first creating a thin pool for it,
DESC: where the new thin pool is named by the --thinpool arg.
# alternate form of lvcreate --type thin
-lvcreate --thin --virtualsize SizeMB --size SizeMB --thinpool LV_new
-OO: --type thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
+lvcreate --virtualsize SizeMB --size SizeMB --thinpool LV_new
+OO: --thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
+--stripes Number, --stripesize SizeKB
+OP: PV ...
+IO: --mirrors 0
+ID: lvcreate_thin_vol_and_thinpool
+DESC: Create a thin LV, first creating a thin pool for it,
+DESC: where the new thin pool is named by the --thinpool arg
+DESC: (variant, infers --type thin).
+FLAGS: SECONDARY_SYNTAX
+
+# same as prev but accepts VG pos arg
+# alternate form of lvcreate --type thin
+lvcreate --virtualsize SizeMB --size SizeMB --thinpool LV_new VG
+OO: --thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
--stripes Number, --stripesize SizeKB
OP: PV ...
IO: --mirrors 0
@@ -1042,7 +1055,7 @@ FLAGS: SECONDARY_SYNTAX
# alternate form of lvcreate --type thin
lvcreate --thin --virtualsize SizeMB --size SizeMB LV_new|VG
-OO: --type thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
+OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
--stripes Number, --stripesize SizeKB
OP: PV ...
IO: --mirrors 0
@@ -1056,7 +1069,7 @@ FLAGS: SECONDARY_SYNTAX
---
lvcreate --size SizeMB --virtualsize SizeMB VG
-OO: --type thin, --type snapshot, --thin, --snapshot, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
+OO: --type snapshot, --snapshot, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
--stripes Number, --stripesize SizeKB
OP: PV ...
IO: --mirrors 0
7 years, 1 month
master - Revert "lvcreate: continue to accept --thinpool with -L and -V but not -T"
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3be2e61c9fd775c0363...
Commit: 3be2e61c9fd775c03636937001a3f5e593096c85
Parent: 7126fb13e7d4f9fbdf10663a5d04b52a3f5dba0c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 21 20:38:47 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 21 22:01:19 2017 -0500
Revert "lvcreate: continue to accept --thinpool with -L and -V but not -T"
This reverts commit 642d682d8ddcc3152f68b3ec8518902a0ef448ac.
Using the thinpool option with this cmd def makes it
indistinct from other cmd defs where thinpool is a
required option.
---
tools/command-lines.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/command-lines.in b/tools/command-lines.in
index a4d1f38..2fec553 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1056,7 +1056,7 @@ FLAGS: SECONDARY_SYNTAX
---
lvcreate --size SizeMB --virtualsize SizeMB VG
-OO: --type thin, --type snapshot, --thin, --snapshot, --thinpool LV_new, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
+OO: --type thin, --type snapshot, --thin, --snapshot, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
--stripes Number, --stripesize SizeKB
OP: PV ...
IO: --mirrors 0
7 years, 1 month