master - libdm: export DM_UDEV_SUBSYSTEM_FLAG names for subystem udev flags
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=23ce3352d7e6ad...
Commit: 23ce3352d7e6ad122b3b173ffb739848bec6a7bd
Parent: ec9b3dcecc8fe153a8838419f3ad9f0f7b7d5ad3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Sep 30 11:19:09 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Sep 30 11:19:09 2013 +0200
libdm: export DM_UDEV_SUBSYSTEM_FLAG names for subystem udev flags
Just like we have symbolic names assigned to general DM udev flags
(DM_UDEV_* flags), we have the same for any subsystem flags now
(DM_SUBSYSTEM_UDEV_FLAG*), making it easier to use.
---
WHATS_NEW_DM | 1 +
libdm/libdevmapper.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 8456edd..dfc2d89 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.82 -
=====================================
+ Define symbolic names for subsystem udev flags in libdevmapper for easier use.
Make subsystem udev rules responsible for importing DM_SUBSYSTEM_UDEV_FLAG*.
Version 1.02.81 - 23rd September 2013
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index b287eef..aaf00b2 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1753,6 +1753,18 @@ struct dm_pool *dm_config_memory(struct dm_config_tree *cft);
*/
#define DM_UDEV_PRIMARY_SOURCE_FLAG 0x0040
+/*
+ * Udev flags reserved for use by any device-mapper subsystem.
+ */
+#define DM_SUBSYSTEM_UDEV_FLAG0 0x0100
+#define DM_SUBSYSTEM_UDEV_FLAG1 0x0200
+#define DM_SUBSYSTEM_UDEV_FLAG2 0x0400
+#define DM_SUBSYSTEM_UDEV_FLAG3 0x0800
+#define DM_SUBSYSTEM_UDEV_FLAG4 0x1000
+#define DM_SUBSYSTEM_UDEV_FLAG5 0x2000
+#define DM_SUBSYSTEM_UDEV_FLAG6 0x4000
+#define DM_SUBSSYTEM_UDEV_FLAG7 0x8000
+
int dm_cookie_supported(void);
/*
10 years
master - udev: make subsystem rules responsible for importing subsystem flags
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec9b3dcecc8fe1...
Commit: ec9b3dcecc8fe153a8838419f3ad9f0f7b7d5ad3
Parent: 24ffd5244feca36ef26d4c1453ee680508466475
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Sep 30 11:11:18 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Sep 30 11:11:18 2013 +0200
udev: make subsystem rules responsible for importing subsystem flags
Each subsystem rule that needs to import any of DM_SUBSYSTEM_UDEV_FLAG*
flags is responsible for doing so. This simply moves control of these
flags from general 10-dm.rules to any subsystem rule using these flags
as each subsystem knows better how to handle these flags on its own.
---
WHATS_NEW_DM | 1 +
udev/10-dm.rules.in | 8 --------
2 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index e0ad76c..8456edd 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.82 -
=====================================
+ Make subsystem udev rules responsible for importing DM_SUBSYSTEM_UDEV_FLAG*.
Version 1.02.81 - 23rd September 2013
=====================================
diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index bc9681f..f7088f1 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -54,14 +54,6 @@ IMPORT{db}="DM_UDEV_LOW_PRIORITY_FLAG"
IMPORT{db}="DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG"
IMPORT{db}="DM_UDEV_PRIMARY_SOURCE_FLAG"
IMPORT{db}="DM_UDEV_FLAG7"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG0"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG2"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG3"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG4"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG5"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG6"
-IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7"
IMPORT{db}="DM_UDEV_RULES_VSN"
LABEL="dm_flags_done"
10 years
master - thin: better dbg msgs and avoid uninit. value on chunk size recalc
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=24ffd5244feca3...
Commit: 24ffd5244feca36ef26d4c1453ee680508466475
Parent: e02ff3226021ddaf0861f65637d9be65d855506b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Sep 30 08:58:57 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Sep 30 08:58:57 2013 +0200
thin: better dbg msgs and avoid uninit. value on chunk size recalc
---
lib/metadata/lv_manip.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3789566..71b5278 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5539,7 +5539,7 @@ static int _recalculate_thin_pool_chunk_size_with_dev_hints(struct lvcreate_para
struct lv_segment *seg;
struct physical_volume *pv;
struct cmd_context *cmd = pool_lv->vg->cmd;
- unsigned long previous_hint = 0, hint;
+ unsigned long previous_hint = 0, hint = 0;
uint32_t chunk_size = lp->chunk_size;
uint32_t default_chunk_size = lp->thin_chunk_size_calc_method == THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE ?
DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE*2 : DEFAULT_THIN_POOL_CHUNK_SIZE*2;
@@ -5564,11 +5564,18 @@ static int _recalculate_thin_pool_chunk_size_with_dev_hints(struct lvcreate_para
previous_hint = hint;
}
+ if (!hint) {
+ log_debug_alloc("No usable device hint found while recalculating "
+ "thin pool chunk size for %s.", pool_lv->name);
+ goto out;
+ }
+
if (hint < DM_THIN_MIN_DATA_BLOCK_SIZE ||
hint > DM_THIN_MAX_DATA_BLOCK_SIZE) {
- log_debug_alloc("Calculated value of %ld sectors for thin pool "
- "chunk size is out of allowed range (%d-%d).",
- hint, DM_THIN_MIN_DATA_BLOCK_SIZE, DM_THIN_MAX_DATA_BLOCK_SIZE);
+ log_debug_alloc("Calculated chunk size value of %ld sectors "
+ "for thin pool %s is out of allowed range (%d-%d).",
+ hint, pool_lv->name, DM_THIN_MIN_DATA_BLOCK_SIZE,
+ DM_THIN_MAX_DATA_BLOCK_SIZE);
} else
chunk_size = hint >= default_chunk_size ? hint : default_chunk_size;
out:
10 years
master - fix: also make commit b4637 work without dmeventd
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e02ff3226021dd...
Commit: e02ff3226021ddaf0861f65637d9be65d855506b
Parent: e4c7236c07056ddc9af3ba6ad2314d649d6814f9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Sep 30 08:17:56 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Sep 30 08:17:56 2013 +0200
fix: also make commit b4637 work without dmeventd
---
lib/raid/raid.c | 44 ++++++++++++++++++++++----------------------
lib/thin/thin.c | 53 +++++++++++++++++++++++++++--------------------------
2 files changed, 49 insertions(+), 48 deletions(-)
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 20e8c1a..c963fd2 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -282,28 +282,6 @@ static void _raid_destroy(struct segment_type *segtype)
}
#ifdef DEVMAPPER_SUPPORT
-#ifdef DMEVENTD
-static const char *_get_raid_dso_path(struct cmd_context *cmd)
-{
- const char *config_str = find_config_tree_str(cmd, dmeventd_raid_library_CFG, NULL);
- return get_monitor_dso_path(cmd, config_str);
-}
-
-static int _raid_target_present(struct cmd_context *cmd,
- const struct lv_segment *seg __attribute__((unused)),
- unsigned *attributes __attribute__((unused)))
-{
- static int _raid_checked = 0;
- static int _raid_present = 0;
-
- if (!_raid_checked)
- _raid_present = target_present(cmd, "raid", 1);
-
- _raid_checked = 1;
-
- return _raid_present;
-}
-
static int _raid_target_percent(void **target_state,
percent_t *percent,
struct dm_pool *mem,
@@ -346,6 +324,28 @@ static int _raid_target_percent(void **target_state,
return 1;
}
+static int _raid_target_present(struct cmd_context *cmd,
+ const struct lv_segment *seg __attribute__((unused)),
+ unsigned *attributes __attribute__((unused)))
+{
+ static int _raid_checked = 0;
+ static int _raid_present = 0;
+
+ if (!_raid_checked)
+ _raid_present = target_present(cmd, "raid", 1);
+
+ _raid_checked = 1;
+
+ return _raid_present;
+}
+
+#ifdef DMEVENTD
+static const char *_get_raid_dso_path(struct cmd_context *cmd)
+{
+ const char *config_str = find_config_tree_str(cmd, dmeventd_raid_library_CFG, NULL);
+ return get_monitor_dso_path(cmd, config_str);
+}
+
static int _raid_target_monitored(struct lv_segment *seg, int *pending)
{
struct cmd_context *cmd = seg->lv->vg->cmd;
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 531e546..8477aac 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -224,6 +224,33 @@ static int _thin_target_present(struct cmd_context *cmd,
const struct lv_segment *seg,
unsigned *attributes);
+static int _thin_pool_modules_needed(struct dm_pool *mem,
+ const struct lv_segment *seg __attribute__((unused)),
+ struct dm_list *modules)
+{
+ if (!str_list_add(mem, modules, _thin_pool_module)) {
+ log_error("String list allocation failed for thin_pool.");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int _thin_modules_needed(struct dm_pool *mem,
+ const struct lv_segment *seg,
+ struct dm_list *modules)
+{
+ if (!_thin_pool_modules_needed(mem, seg, modules))
+ return_0;
+
+ if (!str_list_add(mem, modules, _thin_module)) {
+ log_error("String list allocation failed for thin.");
+ return 0;
+ }
+
+ return 1;
+}
+
static int _thin_pool_add_target_line(struct dev_manager *dm,
struct dm_pool *mem,
struct cmd_context *cmd,
@@ -416,32 +443,6 @@ static int _target_unregister_events(struct lv_segment *seg,
return _target_set_events(seg, events, 0);
}
-static int _thin_pool_modules_needed(struct dm_pool *mem,
- const struct lv_segment *seg __attribute__((unused)),
- struct dm_list *modules)
-{
- if (!str_list_add(mem, modules, _thin_pool_module)) {
- log_error("String list allocation failed for thin_pool.");
- return 0;
- }
-
- return 1;
-}
-
-static int _thin_modules_needed(struct dm_pool *mem,
- const struct lv_segment *seg,
- struct dm_list *modules)
-{
- if (!_thin_pool_modules_needed(mem, seg, modules))
- return_0;
-
- if (!str_list_add(mem, modules, _thin_module)) {
- log_error("String list allocation failed for thin.");
- return 0;
- }
-
- return 1;
-}
# endif /* DMEVENTD */
#endif /* DEVMAPPER_SUPPORT */
10 years
master - udev: fix 3min udev timeout so that it is applied for all LVM volumes
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e4c7236c07056d...
Commit: e4c7236c07056ddc9af3ba6ad2314d649d6814f9
Parent: b4637bd298a7a12e0ce9f15104d41158b96cb642
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Sep 27 15:37:16 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Sep 27 15:37:16 2013 +0200
udev: fix 3min udev timeout so that it is applied for all LVM volumes
The timeout should be set before any volume skipping.
---
WHATS_NEW | 1 +
udev/11-dm-lvm.rules.in | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3a307c9..b813eb6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.103 -
======================================
+ Fix 3min udev timeout so that it is applied for all LVM volumes.
Fix RAID calculation for sufficient allocatable space.
Conversion from linear to mirror or RAID1 now honors mirror_segtype_default.
Add thin-performance configuration profile.
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index 90804f3..f21d0aa 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -22,6 +22,8 @@ IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows
ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
+OPTIONS+="event_timeout=180"
+
# Do not create symlinks for inappropriate subdevices.
ENV{DM_LV_NAME}=="pvmove?*|?*_vorigin", GOTO="lvm_disable"
ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
@@ -29,8 +31,6 @@ ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
# Create symlinks for top-level devices only.
ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}", GOTO="lvm_end"
-OPTIONS+="event_timeout=180"
-
LABEL="lvm_disable"
ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
10 years
master - fix: make it possible to compile with --disable-devmapper again
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b4637bd298a7a1...
Commit: b4637bd298a7a12e0ce9f15104d41158b96cb642
Parent: acdc731e83f7ba646a5e3c55398032464605ee58
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Sep 27 13:58:55 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Sep 27 13:58:55 2013 +0200
fix: make it possible to compile with --disable-devmapper again
Some code has been added recently which makes it impossible to compile
when "configure --disable-devmapper" is used. This patch just shuffles
the code around so it's under proper #ifdef DEVMAPPER_SUPPORT.
---
lib/activate/activate.c | 201 ++++++++++++++++++++++++-----------------------
lib/config/defaults.h | 7 +-
lib/raid/raid.c | 81 +++++++++----------
lib/thin/thin.c | 66 ++++++++--------
4 files changed, 179 insertions(+), 176 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index c9d2c1a..28549fc 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -111,6 +111,97 @@ int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
return 1;
}
+static int _lv_passes_volumes_filter(struct cmd_context *cmd, struct logical_volume *lv,
+ const struct dm_config_node *cn, const int cfg_id)
+{
+ const struct dm_config_value *cv;
+ const char *str;
+ static char config_path[PATH_MAX];
+ static char path[PATH_MAX];
+
+ config_def_get_path(config_path, sizeof(config_path), cfg_id);
+ log_verbose("%s configuration setting defined: "
+ "Checking the list to match %s/%s",
+ config_path, lv->vg->name, lv->name);
+
+ for (cv = cn->v; cv; cv = cv->next) {
+ if (cv->type == DM_CFG_EMPTY_ARRAY)
+ goto out;
+ if (cv->type != DM_CFG_STRING) {
+ log_error("Ignoring invalid string in config file %s",
+ config_path);
+ continue;
+ }
+ str = cv->v.str;
+ if (!*str) {
+ log_error("Ignoring empty string in config file %s",
+ config_path);
+ continue;
+ }
+
+
+ /* Tag? */
+ if (*str == '@') {
+ str++;
+ if (!*str) {
+ log_error("Ignoring empty tag in config file "
+ "%s", config_path);
+ continue;
+ }
+ /* If any host tag matches any LV or VG tag, activate */
+ if (!strcmp(str, "*")) {
+ if (str_list_match_list(&cmd->tags, &lv->tags, NULL)
+ || str_list_match_list(&cmd->tags,
+ &lv->vg->tags, NULL))
+ return 1;
+ else
+ continue;
+ }
+ /* If supplied tag matches LV or VG tag, activate */
+ if (str_list_match_item(&lv->tags, str) ||
+ str_list_match_item(&lv->vg->tags, str))
+ return 1;
+ else
+ continue;
+ }
+ if (!strchr(str, '/')) {
+ /* vgname supplied */
+ if (!strcmp(str, lv->vg->name))
+ return 1;
+ else
+ continue;
+ }
+ /* vgname/lvname */
+ if (dm_snprintf(path, sizeof(path), "%s/%s", lv->vg->name,
+ lv->name) < 0) {
+ log_error("dm_snprintf error from %s/%s", lv->vg->name,
+ lv->name);
+ continue;
+ }
+ if (!strcmp(path, str))
+ return 1;
+ }
+
+out:
+ log_verbose("No item supplied in %s configuration setting "
+ "matches %s/%s", config_path, lv->vg->name, lv->name);
+
+ return 0;
+}
+
+int lv_passes_auto_activation_filter(struct cmd_context *cmd, struct logical_volume *lv)
+{
+ const struct dm_config_node *cn;
+
+ if (!(cn = find_config_tree_node(cmd, activation_auto_activation_volume_list_CFG, NULL))) {
+ log_verbose("activation/auto_activation_volume_list configuration setting "
+ "not defined: All logical volumes will be auto-activated.");
+ return 1;
+ }
+
+ return _lv_passes_volumes_filter(cmd, lv, cn, activation_auto_activation_volume_list_CFG);
+}
+
#ifndef DEVMAPPER_SUPPORT
void set_activation(int act)
{
@@ -223,33 +314,35 @@ int lv_suspend(struct cmd_context *cmd, const char *lvid_s)
return 1;
}
*******/
-int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive)
+int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
+ struct logical_volume *ondisk_lv, struct logical_volume *incore_lv)
{
return 1;
}
-int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only)
+int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, struct logical_volume *lv)
{
return 1;
}
-int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
- unsigned origin_only, unsigned exclusive, unsigned revert)
+int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only,
+ unsigned exclusive, unsigned revert, struct logical_volume *lv)
{
return 1;
}
-int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
+int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_volume *lv)
{
return 1;
}
int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
- int *activate_lv)
+ int *activate_lv, struct logical_volume *lv)
{
return 1;
}
-int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive)
+int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive, struct logical_volume *lv)
{
return 1;
}
-int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s, int exclusive)
+int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s, int exclusive,
+ struct logical_volume *lv)
{
return 1;
}
@@ -347,84 +440,6 @@ int activation(void)
return _activation;
}
-static int _lv_passes_volumes_filter(struct cmd_context *cmd, struct logical_volume *lv,
- const struct dm_config_node *cn, const int cfg_id)
-{
- const struct dm_config_value *cv;
- const char *str;
- static char config_path[PATH_MAX];
- static char path[PATH_MAX];
-
- config_def_get_path(config_path, sizeof(config_path), cfg_id);
- log_verbose("%s configuration setting defined: "
- "Checking the list to match %s/%s",
- config_path, lv->vg->name, lv->name);
-
- for (cv = cn->v; cv; cv = cv->next) {
- if (cv->type == DM_CFG_EMPTY_ARRAY)
- goto out;
- if (cv->type != DM_CFG_STRING) {
- log_error("Ignoring invalid string in config file %s",
- config_path);
- continue;
- }
- str = cv->v.str;
- if (!*str) {
- log_error("Ignoring empty string in config file %s",
- config_path);
- continue;
- }
-
-
- /* Tag? */
- if (*str == '@') {
- str++;
- if (!*str) {
- log_error("Ignoring empty tag in config file "
- "%s", config_path);
- continue;
- }
- /* If any host tag matches any LV or VG tag, activate */
- if (!strcmp(str, "*")) {
- if (str_list_match_list(&cmd->tags, &lv->tags, NULL)
- || str_list_match_list(&cmd->tags,
- &lv->vg->tags, NULL))
- return 1;
- else
- continue;
- }
- /* If supplied tag matches LV or VG tag, activate */
- if (str_list_match_item(&lv->tags, str) ||
- str_list_match_item(&lv->vg->tags, str))
- return 1;
- else
- continue;
- }
- if (!strchr(str, '/')) {
- /* vgname supplied */
- if (!strcmp(str, lv->vg->name))
- return 1;
- else
- continue;
- }
- /* vgname/lvname */
- if (dm_snprintf(path, sizeof(path), "%s/%s", lv->vg->name,
- lv->name) < 0) {
- log_error("dm_snprintf error from %s/%s", lv->vg->name,
- lv->name);
- continue;
- }
- if (!strcmp(path, str))
- return 1;
- }
-
-out:
- log_verbose("No item supplied in %s configuration setting "
- "matches %s/%s", config_path, lv->vg->name, lv->name);
-
- return 0;
-}
-
static int _passes_activation_filter(struct cmd_context *cmd,
struct logical_volume *lv)
{
@@ -465,20 +480,6 @@ static int _passes_readonly_filter(struct cmd_context *cmd,
return _lv_passes_volumes_filter(cmd, lv, cn, activation_read_only_volume_list_CFG);
}
-
-int lv_passes_auto_activation_filter(struct cmd_context *cmd, struct logical_volume *lv)
-{
- const struct dm_config_node *cn;
-
- if (!(cn = find_config_tree_node(cmd, activation_auto_activation_volume_list_CFG, NULL))) {
- log_verbose("activation/auto_activation_volume_list configuration setting "
- "not defined: All logical volumes will be auto-activated.");
- return 1;
- }
-
- return _lv_passes_volumes_filter(cmd, lv, cn, activation_auto_activation_volume_list_CFG);
-}
-
int library_version(char *version, size_t size)
{
if (!activation())
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 5aacea1..cd3b5f9 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -137,13 +137,14 @@
#ifdef DEVMAPPER_SUPPORT
# define DEFAULT_ACTIVATION 1
-# define DEFAULT_RESERVED_MEMORY 8192
-# define DEFAULT_RESERVED_STACK 64 /* KB */
-# define DEFAULT_PROCESS_PRIORITY -18
#else
# define DEFAULT_ACTIVATION 0
#endif
+# define DEFAULT_RESERVED_MEMORY 8192
+# define DEFAULT_RESERVED_STACK 64 /* KB */
+# define DEFAULT_PROCESS_PRIORITY -18
+
#define DEFAULT_AUTO_SET_ACTIVATION_SKIP 1
#define DEFAULT_USE_LINEAR_TARGET 1
#define DEFAULT_STRIPE_FILLER "error"
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 6d627fe..20e8c1a 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -264,6 +264,46 @@ static int _raid_target_status_compatible(const char *type)
return (strstr(type, "raid") != NULL);
}
+static int _raid_modules_needed(struct dm_pool *mem,
+ const struct lv_segment *seg __attribute__((unused)),
+ struct dm_list *modules)
+{
+ if (!str_list_add(mem, modules, "raid")) {
+ log_error("raid module string list allocation failed");
+ return 0;
+ }
+
+ return 1;
+}
+
+static void _raid_destroy(struct segment_type *segtype)
+{
+ dm_free((void *) segtype);
+}
+
+#ifdef DEVMAPPER_SUPPORT
+#ifdef DMEVENTD
+static const char *_get_raid_dso_path(struct cmd_context *cmd)
+{
+ const char *config_str = find_config_tree_str(cmd, dmeventd_raid_library_CFG, NULL);
+ return get_monitor_dso_path(cmd, config_str);
+}
+
+static int _raid_target_present(struct cmd_context *cmd,
+ const struct lv_segment *seg __attribute__((unused)),
+ unsigned *attributes __attribute__((unused)))
+{
+ static int _raid_checked = 0;
+ static int _raid_present = 0;
+
+ if (!_raid_checked)
+ _raid_present = target_present(cmd, "raid", 1);
+
+ _raid_checked = 1;
+
+ return _raid_present;
+}
+
static int _raid_target_percent(void **target_state,
percent_t *percent,
struct dm_pool *mem,
@@ -306,47 +346,6 @@ static int _raid_target_percent(void **target_state,
return 1;
}
-
-static int _raid_target_present(struct cmd_context *cmd,
- const struct lv_segment *seg __attribute__((unused)),
- unsigned *attributes __attribute__((unused)))
-{
- static int _raid_checked = 0;
- static int _raid_present = 0;
-
- if (!_raid_checked)
- _raid_present = target_present(cmd, "raid", 1);
-
- _raid_checked = 1;
-
- return _raid_present;
-}
-
-static int _raid_modules_needed(struct dm_pool *mem,
- const struct lv_segment *seg __attribute__((unused)),
- struct dm_list *modules)
-{
- if (!str_list_add(mem, modules, "raid")) {
- log_error("raid module string list allocation failed");
- return 0;
- }
-
- return 1;
-}
-
-static void _raid_destroy(struct segment_type *segtype)
-{
- dm_free((void *) segtype);
-}
-
-#ifdef DEVMAPPER_SUPPORT
-#ifdef DMEVENTD
-static const char *_get_raid_dso_path(struct cmd_context *cmd)
-{
- const char *config_str = find_config_tree_str(cmd, dmeventd_raid_library_CFG, NULL);
- return get_monitor_dso_path(cmd, config_str);
-}
-
static int _raid_target_monitored(struct lv_segment *seg, int *pending)
{
struct cmd_context *cmd = seg->lv->vg->cmd;
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index d559219..531e546 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -41,10 +41,6 @@ static const char _thin_module[] = "thin";
/* TODO: using static field here, maybe should be a part of segment_type */
static unsigned _feature_mask;
-static int _thin_target_present(struct cmd_context *cmd,
- const struct lv_segment *seg,
- unsigned *attributes);
-
static const char *_thin_pool_name(const struct lv_segment *seg)
{
return seg->segtype->name;
@@ -224,6 +220,10 @@ static int _thin_pool_text_export(const struct lv_segment *seg, struct formatter
}
#ifdef DEVMAPPER_SUPPORT
+static int _thin_target_present(struct cmd_context *cmd,
+ const struct lv_segment *seg,
+ unsigned *attributes);
+
static int _thin_pool_add_target_line(struct dev_manager *dm,
struct dm_pool *mem,
struct cmd_context *cmd,
@@ -381,18 +381,6 @@ static int _thin_pool_target_percent(void **target_state __attribute__((unused))
return 1;
}
-static int _thin_pool_modules_needed(struct dm_pool *mem,
- const struct lv_segment *seg __attribute__((unused)),
- struct dm_list *modules)
-{
- if (!str_list_add(mem, modules, _thin_pool_module)) {
- log_error("String list allocation failed for thin_pool.");
- return 0;
- }
-
- return 1;
-}
-
# ifdef DMEVENTD
static const char *_get_thin_dso_path(struct cmd_context *cmd)
{
@@ -427,6 +415,33 @@ static int _target_unregister_events(struct lv_segment *seg,
{
return _target_set_events(seg, events, 0);
}
+
+static int _thin_pool_modules_needed(struct dm_pool *mem,
+ const struct lv_segment *seg __attribute__((unused)),
+ struct dm_list *modules)
+{
+ if (!str_list_add(mem, modules, _thin_pool_module)) {
+ log_error("String list allocation failed for thin_pool.");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int _thin_modules_needed(struct dm_pool *mem,
+ const struct lv_segment *seg,
+ struct dm_list *modules)
+{
+ if (!_thin_pool_modules_needed(mem, seg, modules))
+ return_0;
+
+ if (!str_list_add(mem, modules, _thin_module)) {
+ log_error("String list allocation failed for thin.");
+ return 0;
+ }
+
+ return 1;
+}
# endif /* DMEVENTD */
#endif /* DEVMAPPER_SUPPORT */
@@ -652,21 +667,6 @@ static int _thin_target_present(struct cmd_context *cmd,
}
#endif
-static int _thin_modules_needed(struct dm_pool *mem,
- const struct lv_segment *seg,
- struct dm_list *modules)
-{
- if (!_thin_pool_modules_needed(mem, seg, modules))
- return_0;
-
- if (!str_list_add(mem, modules, _thin_module)) {
- log_error("String list allocation failed for thin.");
- return 0;
- }
-
- return 1;
-}
-
static void _thin_destroy(struct segment_type *segtype)
{
dm_free(segtype);
@@ -687,7 +687,9 @@ static struct segtype_handler _thin_pool_ops = {
.target_unmonitor_events = _target_unregister_events,
# endif /* DMEVENTD */
#endif
+#ifdef DEVMAPPER_SUPPORT
.modules_needed = _thin_pool_modules_needed,
+#endif
.destroy = _thin_destroy,
};
@@ -699,8 +701,8 @@ static struct segtype_handler _thin_ops = {
.add_target_line = _thin_add_target_line,
.target_percent = _thin_target_percent,
.target_present = _thin_target_present,
-#endif
.modules_needed = _thin_modules_needed,
+#endif
.destroy = _thin_destroy,
};
10 years
master - RAID: Fix _sufficient_pes_free calculation for RAID
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=acdc731e83f7ba...
Commit: acdc731e83f7ba646a5e3c55398032464605ee58
Parent: d6516d2f7900aa233c2a96e171b355bec7e54395
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Sep 26 11:30:07 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Sep 26 11:30:07 2013 -0500
RAID: Fix _sufficient_pes_free calculation for RAID
lib/metadata/lv_manip.c:_sufficient_pes_free() was calculating the
required space for RAID allocations incorrectly due to double
accounting. This resulted in failure to allocate when available
space was tight.
When RAID data and metadata areas are allocated together, the total
amount is stored in ah->new_extents and ah->alloc_and_split_meta is
set. '_sufficient_pes_free' was adding the necessary metadata extents
to ah->new_extents without ever checking ah->alloc_and_split_meta.
This often led to double accounting of the metadata extents. This
patch checks 'ah->alloc_and_split_meta' to perform proper calculations
for RAID.
This error is only present in the function that checks for the needed
space, not in the functions that do the actual allocation.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7750d2e..3a307c9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.103 -
======================================
+ Fix RAID calculation for sufficient allocatable space.
Conversion from linear to mirror or RAID1 now honors mirror_segtype_default.
Add thin-performance configuration profile.
Add lvm.conf allocation/thin_pool_chunk_size_calculation option.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f945b79..3789566 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1162,7 +1162,7 @@ static int _sufficient_pes_free(struct alloc_handle *ah, struct dm_list *pvms,
{
uint32_t area_extents_needed = (extents_still_needed - allocated) * ah->area_count / ah->area_multiple;
uint32_t parity_extents_needed = (extents_still_needed - allocated) * ah->parity_count / ah->area_multiple;
- uint32_t metadata_extents_needed = ah->metadata_area_count * RAID_METADATA_AREA_LEN; /* One each */
+ uint32_t metadata_extents_needed = (ah->alloc_and_split_meta) ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN; /* One each */
uint32_t total_extents_needed = area_extents_needed + parity_extents_needed + metadata_extents_needed;
uint32_t free_pes = pv_maps_size(pvms);
10 years
master - WHATS_NEW: description for previous commit
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d6516d2f7900aa...
Commit: d6516d2f7900aa233c2a96e171b355bec7e54395
Parent: 098896fb2905cd02d02b7271be489e32d86c073d
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Sep 25 22:35:52 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Sep 25 22:35:52 2013 -0500
WHATS_NEW: description for previous commit
commit 098896fb2905cd02d02b7271be489e32d86c073d failed to include
description of what was fixed.
"Conversion from linear to mirror or RAID1 now honors
mirror_segtype_default."
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 14ae12e..7750d2e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.103 -
======================================
+ Conversion from linear to mirror or RAID1 now honors mirror_segtype_default.
Add thin-performance configuration profile.
Add lvm.conf allocation/thin_pool_chunk_size_calculation option.
Fix contiguous & cling allocation policies for parity RAID. (2.02.100)
10 years
master - mirror/RAID: Honor mirror_segtype_default when converting from linear
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=098896fb2905cd...
Commit: 098896fb2905cd02d02b7271be489e32d86c073d
Parent: dd796d6a9485287973e61c427ee45694965203a0
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Sep 25 22:25:43 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Sep 25 22:25:43 2013 -0500
mirror/RAID: Honor mirror_segtype_default when converting from linear
1) When converting from an x-way mirror/raid1 to a y-way mirror/raid1,
the default behaviour should be to stay the same segment type.
2) When converting from linear to mirror or raid1, the default behaviour
should honor the mirror_segtype_default.
3) When converting and the '--type' argument is specified, the '--type'
argument should be honored.
catch such conditions, but errors in the tests caused the issue to go
unnoticed. The code has been fixed to perform #2 properly, the tests
have been corrected to properly test for #2, and a few other tests
were changed to explicitly specify the '--type mirror' when necessary.
---
test/shell/lvconvert-mirror-basic.sh | 2 +-
test/shell/lvconvert-mirror.sh | 21 +++++++++++----------
test/shell/lvconvert-raid.sh | 4 ++--
tools/lvconvert.c | 14 +++++++++++++-
4 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh
index caee9db..28258b2 100644
--- a/test/shell/lvconvert-mirror-basic.sh
+++ b/test/shell/lvconvert-mirror-basic.sh
@@ -92,7 +92,7 @@ test_lvconvert() {
alloc="--alloc anywhere"
fi
- lvconvert -m $finish_count --mirrorlog $finish_log_type \
+ lvconvert --type mirror -m $finish_count --mirrorlog $finish_log_type \
$vg/$lv1 $alloc
test $active || lvchange -aey $vg/$lv1
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 600bbec..911e022 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -20,14 +20,14 @@ vgcreate -s 32k $vg $(cat DEVICES)
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
lvconvert -i1 -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" \
--config 'global { mirror_segtype_default = "mirror" }'
-check mirror $vg $lv1 "$dev3"
+lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*m'
lvremove -ff $vg
# convert from linear to 2-way mirror (override "raid1" default type)
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
lvconvert -i1 --type mirror -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" \
--config 'global { mirror_segtype_default = "raid1" }'
-check mirror $vg $lv1 "$dev3"
+lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*m'
lvremove -ff $vg
# convert from linear to 2-way mirror - with tags and volume_list (bz683270)
@@ -204,16 +204,17 @@ lvconvert -m0 $vg/$lv1 "$dev1"
check linear $vg $lv1
lvremove -ff $vg
-# "rhbz264241: lvm mirror doesn't lose it's "M" --nosync attribute after being down and the up converted"
+# "rhbz264241: lvm mirror doesn't lose it's "M" --nosync attribute
+# after being down and the up converted"
lvcreate -aey -l2 --type mirror -m1 -n $lv1 --nosync $vg
lvconvert -m0 $vg/$lv1
-lvconvert -m1 $vg/$lv1
-lvs --noheadings -o attr $vg/$lv1 | grep '^ *m'
+lvconvert --type mirror -m1 $vg/$lv1
+lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*m'
lvremove -ff $vg
# lvconvert from linear (on multiple PVs) to mirror
lvcreate -aey -l 8 -n $lv1 $vg "$dev1:0-3" "$dev2:0-3"
-lvconvert -m1 $vg/$lv1
+lvconvert --type mirror -m1 $vg/$lv1
should check mirror $vg $lv1
check mirror_legs $vg $lv1 2
@@ -222,7 +223,7 @@ lvremove -ff $vg
# BZ 463272: disk log mirror convert option is lost if downconvert option is also given
lvcreate -aey -l1 --type mirror -m2 --corelog -n $lv1 $vg "$dev1" "$dev2" "$dev3"
aux wait_for_sync $vg $lv1
-lvconvert -m1 --mirrorlog disk $vg/$lv1
+lvconvert --type mirror -m1 --mirrorlog disk $vg/$lv1
check mirror $vg $lv1
not check mirror $vg $lv1 core
lvremove -ff $vg
@@ -243,14 +244,14 @@ lvremove -ff $vg
# simple mirrored stripe
lvcreate -aey -i2 -l10 -n $lv1 $vg
-lvconvert -m1 -i1 $vg/$lv1
+lvconvert --type mirror -m1 -i1 $vg/$lv1
lvreduce -f -l1 $vg/$lv1
lvextend -f -l10 $vg/$lv1
lvremove -ff $vg/$lv1
# extents must be divisible
lvcreate -aey -l15 -n $lv1 $vg
-not lvconvert -m1 --corelog --stripes 2 $vg/$lv1
+not lvconvert --type mirror -m1 --corelog --stripes 2 $vg/$lv1
lvremove -ff $vg
test -e LOCAL_CLVMD && exit 0
@@ -258,7 +259,7 @@ test -e LOCAL_CLVMD && exit 0
# FIXME - cases which needs to be fixed to work in cluster
# Linear to mirror with mirrored log using --alloc anywhere
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
-lvconvert -m +1 --mirrorlog mirrored --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
+lvconvert --type mirror -m +1 --mirrorlog mirrored --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
should check mirror $vg $lv1
lvremove -ff $vg
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 6762db2..680710e 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -142,7 +142,7 @@ lvremove -ff $vg
lvcreate -aey -l 2 -n $lv1 $vg
lvconvert -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "raid1" }'
-lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
+lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r'
lvremove -ff $vg
###########################################
@@ -151,7 +151,7 @@ lvremove -ff $vg
lvcreate -aey -l 2 -n $lv1 $vg
lvconvert --type raid1 -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "mirror" }'
-lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
+lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r'
lvremove -ff $vg
###########################################
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index bbcfff7..ebb5138 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2570,9 +2570,21 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED;
}
- if (!lp->segtype)
+ if (!lp->segtype) {
+ /* segtype not explicitly set in _read_params */
lp->segtype = first_seg(lv)->segtype;
+ /*
+ * If we are converting to mirror/raid1 and
+ * the segtype was not specified, then we need
+ * to consult the default.
+ */
+ if (arg_count(cmd, mirrors_ARG) && !lv_is_mirrored(lv)) {
+ lp->segtype = get_segtype_from_string(cmd, find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL));
+ if (!lp->segtype)
+ return_0;
+ }
+ }
if (lp->merge) {
if (!lv_is_cow(lv)) {
log_error("\"%s\" is not a mergeable logical volume",
10 years
master - profile: add thin-performance.profile
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dd796d6a948528...
Commit: dd796d6a9485287973e61c427ee45694965203a0
Parent: 78cba8eb3fa262c2c4e1a5c5a3db3e4e0d7e6900
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Sep 25 16:02:38 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Sep 25 16:07:35 2013 +0200
profile: add thin-performance.profile
Define a "performance" profile for thin pools which is exactly:
- allocation/thin_pool_zero = 0
- thin_pool_chunk_size_calculation = "performance"
---
WHATS_NEW | 1 +
conf/Makefile.in | 2 +-
conf/thin-performance.profile | 4 ++++
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 04906f0..14ae12e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.103 -
======================================
+ Add thin-performance configuration profile.
Add lvm.conf allocation/thin_pool_chunk_size_calculation option.
Fix contiguous & cling allocation policies for parity RAID. (2.02.100)
Set use_lvmetad=0 on lvmconf --enable-cluster, reset to default on --disable-cluster.
diff --git a/conf/Makefile.in b/conf/Makefile.in
index f9947b1..8b5238a 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -19,7 +19,7 @@ CONFSRC=example.conf
CONFDEST=lvm.conf
DEFAULT_PROFILE=default.profile
-PROFILES=$(DEFAULT_PROFILE)
+PROFILES=$(DEFAULT_PROFILE) thin-performance.profile
include $(top_builddir)/make.tmpl
diff --git a/conf/thin-performance.profile b/conf/thin-performance.profile
new file mode 100644
index 0000000..fbd46aa
--- /dev/null
+++ b/conf/thin-performance.profile
@@ -0,0 +1,4 @@
+allocation {
+ thin_pool_chunk_size_calculation = "performance"
+ thin_pool_zero = 0
+}
10 years