master - debug: show LV name where dlid creation failed
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4afe43e1a326d5...
Commit: 4afe43e1a326d50296b6ad4a7ed836d4b0ae6b26
Parent: 922fccc6560706f5026d59e383b694f9d7f85945
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 26 21:52:05 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 21:52:05 2015 +0100
debug: show LV name where dlid creation failed
---
lib/misc/lvm-string.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index 5d63858..605e8d5 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -16,6 +16,7 @@
#include "lib.h"
#include "lvm-string.h"
#include "metadata-exported.h"
+#include "display.h"
#include <ctype.h>
#include <stdarg.h>
@@ -211,6 +212,7 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
const char *layer)
{
const char *lvid = lv->lvid.s;
+ char *dlid;
if (!layer) {
/*
@@ -235,5 +237,9 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
NULL;
}
- return dm_build_dm_uuid(mem, UUID_PREFIX, lvid, layer);
+ if (!(dlid = dm_build_dm_uuid(mem, UUID_PREFIX, lvid, layer)))
+ log_error("Failed to build LVM dlid for %s.",
+ display_lvname(lv));
+
+ return dlid;
}
8 years, 5 months
master - cleanup: clean gcc shadow declaration of version warning
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0a00efb0bee2e2...
Commit: 0a00efb0bee2e251a4532d0fdb77da7df0215598
Parent: 82ec3e5e93f5017d7c9a83197e34f05e783fa7bf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 26 21:26:55 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 21:26:55 2015 +0100
cleanup: clean gcc shadow declaration of version warning
---
tools/dumpconfig.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index 72129c2..85cd619 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -17,17 +17,17 @@
static int _get_vsn(struct cmd_context *cmd, uint16_t *version_int)
{
- const char *version;
+ const char *vsn;
unsigned int major, minor, patchlevel;
if (arg_count(cmd, atversion_ARG))
- version = arg_str_value(cmd, atversion_ARG, NULL);
+ vsn = arg_str_value(cmd, atversion_ARG, NULL);
else if (arg_count(cmd, sinceversion_ARG))
- version = arg_str_value(cmd, sinceversion_ARG, NULL);
+ vsn = arg_str_value(cmd, sinceversion_ARG, NULL);
else
- version = LVM_VERSION;
+ vsn = LVM_VERSION;
- if (sscanf(version, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
+ if (sscanf(vsn, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
log_error("Incorrect version format.");
return 0;
}
8 years, 5 months
master - debug: show LV name where dlid creation failed
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=82ec3e5e93f501...
Commit: 82ec3e5e93f5017d7c9a83197e34f05e783fa7bf
Parent: 922fccc6560706f5026d59e383b694f9d7f85945
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 26 21:20:33 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 21:20:33 2015 +0100
debug: show LV name where dlid creation failed
---
lib/misc/lvm-string.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index 5d63858..5bdb549 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -211,6 +211,7 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
const char *layer)
{
const char *lvid = lv->lvid.s;
+ const char *dlid;
if (!layer) {
/*
@@ -235,5 +236,9 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
NULL;
}
- return dm_build_dm_uuid(mem, UUID_PREFIX, lvid, layer);
+ if (!(dlid = dm_build_dm_uuid(mem, UUID_PREFIX, lvid, layer)))
+ log_error("Failed to build LVM dlid for %s.",
+ display_lvname(lv));
+
+ return dlid;
}
8 years, 5 months
master - cleanup: using display_lvname
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=922fccc6560706...
Commit: 922fccc6560706f5026d59e383b694f9d7f85945
Parent: b7b59ad9323cd38889e78068813c311170920d9d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 25 16:06:31 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 09:27:37 2015 +0100
cleanup: using display_lvname
Use for showing vgname/lvname in messages.
No functional change.
---
lib/activate/activate.c | 154 +++++++++++++++++++++++---------------------
lib/activate/dev_manager.c | 79 +++++++++++++---------
2 files changed, 127 insertions(+), 106 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 47c675c..8f5b72b 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -118,8 +118,8 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic
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);
+ "Checking the list to match %s.",
+ config_path, display_lvname(lv));
for (cv = cn->v; cv; cv = cv->next) {
if (cv->type == DM_CFG_EMPTY_ARRAY)
@@ -170,8 +170,8 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic
}
out:
- log_verbose("No item supplied in %s configuration setting "
- "matches %s/%s", config_path, lv->vg->name, lv->name);
+ log_verbose("No item supplied in %s configuration setting matches %s.",
+ config_path, display_lvname(lv));
return 0;
}
@@ -469,8 +469,8 @@ static int _passes_activation_filter(struct cmd_context *cmd,
if (!(cn = find_config_tree_array(cmd, activation_volume_list_CFG, NULL))) {
log_verbose("activation/volume_list configuration setting "
- "not defined: Checking only host tags for %s/%s",
- lv->vg->name, lv->name);
+ "not defined: Checking only host tags for %s.",
+ display_lvname(lv));
/* If no host tags defined, activate */
if (dm_list_empty(&cmd->tags))
@@ -481,8 +481,7 @@ static int _passes_activation_filter(struct cmd_context *cmd,
str_list_match_list(&cmd->tags, &lv->vg->tags, NULL))
return 1;
- log_verbose("No host tag matches %s/%s",
- lv->vg->name, lv->name);
+ log_verbose("No host tag matches %s", display_lvname(lv));
/* Don't activate */
return 0;
@@ -771,14 +770,14 @@ int lv_check_not_in_use(const struct logical_volume *lv)
/* If sysfs is not used, use open_count information only. */
if (dm_sysfs_dir()) {
if (dm_device_has_holders(info.major, info.minor)) {
- log_error("Logical volume %s/%s is used by another device.",
- lv->vg->name, lv->name);
+ log_error("Logical volume %s is used by another device.",
+ display_lvname(lv));
return 0;
}
if (dm_device_has_mounted_fs(info.major, info.minor)) {
- log_error("Logical volume %s/%s contains a filesystem in use.",
- lv->vg->name, lv->name);
+ log_error("Logical volume %s contains a filesystem in use.",
+ display_lvname(lv));
return 0;
}
}
@@ -786,14 +785,14 @@ int lv_check_not_in_use(const struct logical_volume *lv)
open_count_check_retries = retry_deactivation() ? OPEN_COUNT_CHECK_RETRIES : 1;
while (info.open_count > 0 && open_count_check_retries--) {
if (!open_count_check_retries) {
- log_error("Logical volume %s/%s in use.",
- lv->vg->name, lv->name);
+ log_error("Logical volume %s in use.",
+ display_lvname(lv));
return 0;
}
usleep(OPEN_COUNT_CHECK_USLEEP_DELAY);
- log_debug_activation("Retrying open_count check for %s/%s.",
- lv->vg->name, lv->name);
+ log_debug_activation("Retrying open_count check for %s.",
+ display_lvname(lv));
if (!lv_info(lv->vg->cmd, lv, 0, &info, 1, 0)) {
stack; /* device dissappeared? */
break;
@@ -814,7 +813,8 @@ int lv_check_transient(struct logical_volume *lv)
if (!activation())
return 0;
- log_debug_activation("Checking transient status for LV %s/%s", lv->vg->name, lv->name);
+ log_debug_activation("Checking transient status for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -838,7 +838,8 @@ int lv_snapshot_percent(const struct logical_volume *lv, dm_percent_t *percent)
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking snapshot percent for LV %s/%s", lv->vg->name, lv->name);
+ log_debug_activation("Checking snapshot percent for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -868,7 +869,8 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
if (!lv_info(cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking mirror percent for LV %s/%s", lv->vg->name, lv->name);
+ log_debug_activation("Checking mirror percent for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -897,8 +899,8 @@ int lv_raid_dev_health(const struct logical_volume *lv, char **dev_health)
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking raid device health for LV %s/%s",
- lv->vg->name, lv->name);
+ log_debug_activation("Checking raid device health for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -925,8 +927,8 @@ int lv_raid_mismatch_count(const struct logical_volume *lv, uint64_t *cnt)
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking raid mismatch count for LV %s/%s",
- lv->vg->name, lv->name);
+ log_debug_activation("Checking raid mismatch count for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -953,8 +955,8 @@ int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action)
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking raid sync_action for LV %s/%s",
- lv->vg->name, lv->name);
+ log_debug_activation("Checking raid sync_action for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -990,12 +992,12 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
(lv_is_raid(seg_lv(first_seg(lv), 0)) ||
lv_is_raid(first_seg(lv)->metadata_lv))) {
log_error("Thin pool data or metadata volume "
- "must be specified. (E.g. \"%s/%s_tdata\")",
- lv->vg->name, lv->name);
+ "must be specified. (E.g. \"%s_tdata\")",
+ display_lvname(lv));
return 0;
}
- log_error("%s/%s must be a RAID logical volume to"
- " perform this action.", lv->vg->name, lv->name);
+ log_error("%s must be a RAID logical volume to perform this action.",
+ display_lvname(lv));
return 0;
}
@@ -1008,8 +1010,8 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
return_0;
if (!(r = dev_manager_raid_status(dm, lv, &status))) {
- log_error("Failed to retrieve status of %s/%s",
- lv->vg->name, lv->name);
+ log_error("Failed to retrieve status of %s.",
+ display_lvname(lv));
goto out;
}
@@ -1036,8 +1038,8 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
goto out;
}
if (strcmp(status->sync_action, "idle")) {
- log_error("%s/%s state is currently \"%s\". Unable to switch to \"%s\".",
- lv->vg->name, lv->name, status->sync_action, msg);
+ log_error("%s state is currently \"%s\". Unable to switch to \"%s\".",
+ display_lvname(lv), status->sync_action, msg);
goto out;
}
@@ -1101,8 +1103,8 @@ int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
if (!lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0))
return 0;
- log_debug_activation("Checking thin %sdata percent for LV %s/%s",
- (metadata) ? "meta" : "", lv->vg->name, lv->name);
+ log_debug_activation("Checking thin %sdata percent for LV %s.",
+ (metadata) ? "meta" : "", display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -1127,8 +1129,8 @@ int lv_thin_percent(const struct logical_volume *lv,
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking thin percent for LV %s/%s",
- lv->vg->name, lv->name);
+ log_debug_activation("Checking thin percent for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -1154,8 +1156,8 @@ int lv_thin_pool_transaction_id(const struct logical_volume *lv,
if (!lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0))
return 0;
- log_debug_activation("Checking thin percent for LV %s/%s",
- lv->vg->name, lv->name);
+ log_debug_activation("Checking thin percent for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -1178,8 +1180,8 @@ int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id)
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
- log_debug_activation("Checking device id for LV %s/%s",
- lv->vg->name, lv->name);
+ log_debug_activation("Checking device id for LV %s.",
+ display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -1381,7 +1383,7 @@ static int _lv_is_active(const struct logical_volume *lv,
* New users of this function who specifically ask for 'exclusive'
* will be given an error message.
*/
- log_error("Unable to determine exclusivity of %s", lv->name);
+ log_error("Unable to determine exclusivity of %s.", display_lvname(lv));
e = 0;
@@ -1396,8 +1398,8 @@ out:
if (exclusive)
*exclusive = e;
- log_very_verbose("%s/%s is %sactive%s%s",
- lv->vg->name, lv->name,
+ log_very_verbose("%s is %sactive%s%s",
+ display_lvname(lv),
(r || l) ? "" : "not ",
(exclusive && e) ? " exclusive" : "",
e ? (l ? " locally" : " remotely") : "");
@@ -1606,14 +1608,14 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (laopts->skip_in_use && lv_is_thin_pool(lv) &&
lv_info(lv->vg->cmd, lv, 1, &info, 1, 0) && (info.open_count > 1)) {
log_debug_activation("Skipping unmonitor of opened %s (open:%d)",
- lv->name, info.open_count);
+ display_lvname(lv), info.open_count);
return 1;
}
/* Do not monitor snapshot that already covers origin */
if (monitor && lv_is_cow_covering_origin(lv)) {
log_debug_activation("Skipping monitor of snapshot larger "
- "then origin %s.", lv->name);
+ "then origin %s.", display_lvname(lv));
return 1;
}
@@ -1661,7 +1663,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
monitor)) {
log_error("Failed to %smonitor %s",
monitor ? "" : "un",
- seg_lv(seg, s)->name);
+ display_lvname(seg_lv(seg, s)));
r = 0;
}
}
@@ -1698,12 +1700,12 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (monitor) {
if (monitored)
- log_verbose("%s/%s already monitored.", lv->vg->name, lv->name);
+ log_verbose("%s already monitored.", display_lvname(lv));
else if (seg->segtype->ops->target_monitor_events)
monitor_fn = seg->segtype->ops->target_monitor_events;
} else {
if (!monitored)
- log_verbose("%s/%s already not monitored.", lv->vg->name, lv->name);
+ log_verbose("%s already not monitored.", display_lvname(lv));
else if (seg->segtype->ops->target_unmonitor_events)
monitor_fn = seg->segtype->ops->target_unmonitor_events;
}
@@ -1712,7 +1714,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (!monitor_fn)
continue;
- log_verbose("%sonitoring %s/%s%s", monitor ? "M" : "Not m", lv->vg->name, lv->name,
+ log_verbose("%sonitoring %s%s", monitor ? "M" : "Not m", display_lvname(lv),
test_mode() ? " [Test mode: skipping this]" : "");
/* FIXME Test mode should really continue a bit further. */
@@ -1721,8 +1723,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
/* FIXME specify events */
if (!monitor_fn(seg, 0)) {
- log_error("%s/%s: %s segment monitoring function failed.",
- lv->vg->name, lv->name, seg->segtype->name);
+ log_error("%s: %s segment monitoring function failed.",
+ display_lvname(lv), seg->segtype->name);
return 0;
}
@@ -1734,8 +1736,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (pending ||
(!monitored && monitor) ||
(monitored && !monitor))
- log_very_verbose("%s/%s %smonitoring still pending: waiting...",
- lv->vg->name, lv->name, monitor ? "" : "un");
+ log_very_verbose("%s %smonitoring still pending: waiting...",
+ display_lvname(lv), monitor ? "" : "un");
else
break;
usleep(10000 * i);
@@ -1746,8 +1748,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
}
if (!r && !error_message_produced())
- log_error("%sonitoring %s/%s failed.", monitor ? "M" : "Not m",
- lv->vg->name, lv->name);
+ log_error("%sonitoring %s failed.", monitor ? "M" : "Not m",
+ display_lvname(lv));
return r;
#else
return 1;
@@ -1858,7 +1860,8 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
/* Preload all the LVs above the PVMOVE LV */
dm_list_iterate_items(sl, &pvmove_lv->segs_using_this_lv) {
if (!(lv_pre_tmp = find_lv(lv_pre->vg, sl->seg->lv->name))) {
- log_error(INTERNAL_ERROR "LV %s missing from preload metadata", sl->seg->lv->name);
+ log_error(INTERNAL_ERROR "LV %s missing from preload metadata.",
+ display_lvname(sl->seg->lv));
goto out;
}
if (!_lv_preload(lv_pre_tmp, laopts, &flush_required))
@@ -1866,7 +1869,8 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
}
/* Now preload the PVMOVE LV itself */
if (!(lv_pre_tmp = find_lv(lv_pre->vg, pvmove_lv->name))) {
- log_error(INTERNAL_ERROR "LV %s missing from preload metadata", pvmove_lv->name);
+ log_error(INTERNAL_ERROR "LV %s missing from preload metadata.",
+ display_lvname(pvmove_lv));
goto out;
}
if (!_lv_preload(lv_pre_tmp, laopts, &flush_required))
@@ -1892,8 +1896,9 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
if (!laopts->origin_only && lv_is_origin(lv)) {
dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) {
if (!(lv_pre_tmp = find_lv_in_vg_by_lvid(lv_pre->vg, &snap_seg->cow->lvid))) {
- log_error(INTERNAL_ERROR "LV %s (%s) missing from preload metadata",
- snap_seg->cow->name, snap_seg->cow->lvid.id[1].uuid);
+ log_error(INTERNAL_ERROR "LV %s (%s) missing from preload metadata.",
+ display_lvname(snap_seg->cow),
+ snap_seg->cow->lvid.id[1].uuid);
goto out;
}
if (!lv_is_cow(lv_pre_tmp) &&
@@ -1996,13 +2001,14 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
laopts->origin_only = 0;
if (test_mode()) {
- _skip("Resuming %s%s%s.", lv->name, laopts->origin_only ? " without snapshots" : "",
+ _skip("Resuming %s%s%s.", display_lvname(lv),
+ laopts->origin_only ? " without snapshots" : "",
laopts->revert ? " (reverting)" : "");
r = 1;
goto out;
}
- log_debug_activation("Resuming LV %s/%s%s%s%s.", lv->vg->name, lv->name,
+ log_debug_activation("Resuming LV %s%s%s%s.", display_lvname(lv),
error_if_not_active ? "" : " if active",
laopts->origin_only ?
(lv_is_thin_pool(lv) ? " pool only" :
@@ -2080,8 +2086,8 @@ static int _lv_has_open_snapshots(const struct logical_volume *lv)
r++;
if (r)
- log_error("LV %s/%s has open %d snapshot(s), not deactivating.",
- lv->vg->name, lv->name, r);
+ log_error("LV %s has open %d snapshot(s), not deactivating.",
+ display_lvname(lv), r);
return r;
}
@@ -2101,12 +2107,12 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logi
goto out;
if (test_mode()) {
- _skip("Deactivating '%s'.", lv->name);
+ _skip("Deactivating %s.", display_lvname(lv));
r = 1;
goto out;
}
- log_debug_activation("Deactivating %s/%s.", lv->vg->name, lv->name);
+ log_debug_activation("Deactivating %s.", display_lvname(lv));
if (!lv_info(cmd, lv, 0, &info, 0, 0))
goto_out;
@@ -2175,11 +2181,11 @@ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
}
if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0)))
- goto out;
+ goto_out;
if (!_passes_activation_filter(cmd, lv)) {
- log_verbose("Not activating %s/%s since it does not pass "
- "activation filter.", lv->vg->name, lv->name);
+ log_verbose("Not activating %s since it does not pass "
+ "activation filter.", display_lvname(lv));
*activate_lv = 0;
} else
*activate_lv = 1;
@@ -2206,8 +2212,8 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
goto out;
if (filter && !_passes_activation_filter(cmd, lv)) {
- log_verbose("Not activating %s/%s since it does not pass "
- "activation filter.", lv->vg->name, lv->name);
+ log_verbose("Not activating %s since it does not pass "
+ "activation filter.", display_lvname(lv));
r = 1;
goto out;
}
@@ -2230,7 +2236,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
if (lv_has_unknown_segments(lv)) {
log_error("Refusing activation of LV %s containing "
- "an unrecognised segment.", lv->name);
+ "an unrecognised segment.", display_lvname(lv));
goto out;
}
@@ -2245,7 +2251,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
}
if (test_mode()) {
- _skip("Activating '%s'.", lv->name);
+ _skip("Activating %s.", display_lvname(lv));
r = 1;
goto out;
}
@@ -2253,7 +2259,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
if (filter)
laopts->read_only = _passes_readonly_filter(cmd, lv);
- log_debug_activation("Activating %s/%s%s%s%s%s.", lv->vg->name, lv->name,
+ log_debug_activation("Activating %s%s%s%s%s.", display_lvname(lv),
laopts->exclusive ? " exclusively" : "",
laopts->read_only ? " read-only" : "",
laopts->noscan ? " noscan" : "",
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 328d8ac..4b37845 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -827,7 +827,8 @@ static const struct dm_info *_cached_dm_info(struct dm_pool *mem,
goto_out;
if (!(dinfo = dm_tree_node_get_info(dnode))) {
- log_error("Failed to get info from tree node for %s.", lv->name);
+ log_error("Failed to get info from tree node for %s.",
+ display_lvname(lv));
goto out;
}
@@ -983,7 +984,8 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (lv) {
if (!(segh = dm_list_next(&lv->segments, segh))) {
log_error("Number of segments in active LV %s "
- "does not match metadata", lv->name);
+ "does not match metadata.",
+ display_lvname(lv));
goto out;
}
seg = dm_list_item(segh, struct lv_segment);
@@ -1023,7 +1025,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (lv && dm_list_next(&lv->segments, segh)) {
log_error("Number of segments in active LV %s does not "
- "match metadata", lv->name);
+ "match metadata.", display_lvname(lv));
goto out;
}
@@ -1098,7 +1100,7 @@ int dev_manager_transient(struct dev_manager *dm, const struct logical_volume *l
if (!(segh = dm_list_next(&lv->segments, segh))) {
log_error("Number of segments in active LV %s "
- "does not match metadata", lv->name);
+ "does not match metadata.", display_lvname(lv));
goto out;
}
seg = dm_list_item(segh, struct lv_segment);
@@ -1119,7 +1121,7 @@ int dev_manager_transient(struct dev_manager *dm, const struct logical_volume *l
if (dm_list_next(&lv->segments, segh)) {
log_error("Number of segments in active LV %s does not "
- "match metadata", lv->name);
+ "match metadata.", display_lvname(lv));
goto out;
}
@@ -1318,8 +1320,8 @@ int dev_manager_raid_message(struct dev_manager *dm,
const char *layer = lv_layer(lv);
if (!lv_is_raid(lv)) {
- log_error(INTERNAL_ERROR "%s/%s is not a RAID logical volume",
- lv->vg->name, lv->name);
+ log_error(INTERNAL_ERROR "%s is not a RAID logical volume",
+ display_lvname(lv));
return 0;
}
@@ -1528,17 +1530,20 @@ int dev_manager_thin_device_id(struct dev_manager *dm,
if (dm_get_next_target(dmt, NULL, &start, &length,
&target_type, ¶ms)) {
- log_error("More then one table line found for %s.", lv->name);
+ log_error("More then one table line found for %s.",
+ display_lvname(lv));
goto out;
}
if (!target_type || strcmp(target_type, "thin")) {
- log_error("Unexpected target type %s found for thin %s.", target_type, lv->name);
+ log_error("Unexpected target type %s found for thin %s.",
+ target_type, display_lvname(lv));
goto out;
}
if (!params || sscanf(params, "%*u:%*u %u", device_id) != 1) {
- log_error("Cannot parse table like parameters %s for %s.", params, lv->name);
+ log_error("Cannot parse table like parameters %s for %s.",
+ params, display_lvname(lv));
goto out;
}
@@ -1559,7 +1564,7 @@ static int _dev_manager_lv_mknodes(const struct logical_volume *lv)
char *name;
if (!(name = dm_build_dm_name(lv->vg->cmd->mem, lv->vg->name,
- lv->name, NULL)))
+ lv->name, NULL)))
return_0;
return fs_add_lv(lv, name);
@@ -1738,7 +1743,8 @@ static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
log_error("Volume %s (%" PRIu32 ":%" PRIu32")"
" differs from already active device "
"(%" PRIu32 ":%" PRIu32")",
- lv->name, lv->major, lv->minor, info.major, info.minor);
+ display_lvname(lv), lv->major, lv->minor,
+ info.major, info.minor);
return 0;
}
if (!info.exists && _info_by_dev(lv->major, lv->minor, &info2) &&
@@ -1758,7 +1764,8 @@ static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
}
if (info.exists && dm->track_pending_delete) {
- log_debug_activation("Tracking pending delete for %s (%s).", lv->name, dlid);
+ log_debug_activation("Tracking pending delete for %s (%s).",
+ display_lvname(lv), dlid);
if (!str_list_add(dm->mem, &dm->pending_delete, dlid))
return_0;
}
@@ -2194,7 +2201,8 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, const struc
struct dm_tree *dtree;
if (!(dtree = dm_tree_create())) {
- log_debug_activation("Partial dtree creation failed for %s.", lv->name);
+ log_debug_activation("Partial dtree creation failed for %s.",
+ display_lvname(lv));
return NULL;
}
@@ -2238,7 +2246,7 @@ static char *_add_error_device(struct dev_manager *dm, struct dm_tree *dtree,
return_NULL;
if (!(name = dm_build_dm_name(dm->mem, seg->lv->vg->name,
- seg->lv->name, errid)))
+ seg->lv->name, errid)))
return_NULL;
log_debug_activation("Getting device info for %s [%s]", name, dlid);
@@ -2311,7 +2319,8 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
if (!seg->lv->vg->cmd->degraded_activation ||
!lv_is_raid_type(seg->lv)) {
log_error("Aborting. LV %s is now incomplete "
- "and '--activationmode partial' was not specified.", seg->lv->name);
+ "and '--activationmode partial' was not specified.",
+ display_lvname(seg->lv));
return 0;
}
}
@@ -2362,7 +2371,7 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
return_0;
} else {
log_error(INTERNAL_ERROR "Unassigned area found in LV %s.",
- seg->lv->name);
+ display_lvname(seg->lv));
return 0;
}
}
@@ -2370,8 +2379,8 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
if (num_error_areas) {
/* Thins currently do not support partial activation */
if (lv_is_thin_type(seg->lv)) {
- log_error("Cannot activate %s%s: pool incomplete.",
- seg->lv->vg->name, seg->lv->name);
+ log_error("Cannot activate %s: pool incomplete.",
+ display_lvname(seg->lv));
return 0;
}
}
@@ -2421,7 +2430,8 @@ static int _add_snapshot_merge_target_to_dtree(struct dev_manager *dm,
struct lv_segment *merging_snap_seg = find_snapshot(lv);
if (!lv_is_merging_origin(lv)) {
- log_error(INTERNAL_ERROR "LV %s is not merging snapshot.", lv->name);
+ log_error(INTERNAL_ERROR "LV %s is not merging snapshot.",
+ display_lvname(lv));
return 0;
}
@@ -2453,7 +2463,8 @@ static int _add_snapshot_target_to_dtree(struct dev_manager *dm,
uint64_t size;
if (!(snap_seg = find_snapshot(lv))) {
- log_error("Couldn't find snapshot for '%s'.", lv->name);
+ log_error("Couldn't find snapshot for '%s'.",
+ display_lvname(lv));
return 0;
}
@@ -2578,8 +2589,8 @@ static int _add_new_external_lv_to_dtree(struct dev_manager *dm,
*/
dm->skip_external_lv = 1;
- log_debug_activation("Adding external origin lv %s and all active users.",
- external_lv->name);
+ log_debug_activation("Adding external origin LV %s and all active users.",
+ display_lvname(external_lv));
if (!_add_new_lv_to_dtree(dm, dtree, external_lv, laopts,
lv_layer(external_lv)))
@@ -2599,8 +2610,9 @@ static int _add_new_external_lv_to_dtree(struct dev_manager *dm,
laopts, lv_layer(sl->seg->lv)))
return_0;
- log_debug_activation("Finished adding external origin lv %s and all active users.",
- external_lv->name);
+ log_debug_activation("Finished adding external origin LV %s and all active users.",
+ display_lvname(external_lv));
+
dm->skip_external_lv = 0;
return 1;
@@ -2627,14 +2639,14 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
segtype->name);
log_debug_activation("Checking kernel supports %s segment type for %s%s%s",
- target_name, seg->lv->name,
+ target_name, display_lvname(seg->lv),
layer ? "-" : "", layer ? : "");
if (segtype->ops->target_present &&
!segtype->ops->target_present(seg_present->lv->vg->cmd,
seg_present, NULL)) {
log_error("Can't process LV %s: %s target support missing "
- "from kernel?", seg->lv->name, target_name);
+ "from kernel?", display_lvname(seg->lv), target_name);
return 0;
}
@@ -2681,7 +2693,7 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
if (dm->track_pending_delete) {
/* Replace target and all its used devs with error mapping */
log_debug_activation("Using error for pending delete %s.",
- seg->lv->name);
+ display_lvname(seg->lv));
if (!dm_tree_node_add_error_target(dnode, (uint64_t)seg->lv->vg->extent_size * seg->len))
return_0;
} else if (!_add_target_to_dtree(dm, dnode, seg, laopts))
@@ -2762,7 +2774,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!(lvlayer = dm_pool_alloc(dm->mem, sizeof(*lvlayer)))) {
log_error("_add_new_lv_to_dtree: pool alloc failed for %s %s.",
- lv->name, layer);
+ display_lvname(lv), layer);
return 0;
}
@@ -3032,7 +3044,8 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
/* Some LV can be used for top level tree */
/* TODO: add more.... */
if (lv_is_cache_pool(lv) && !dm_list_empty(&lv->segs_using_this_lv)) {
- log_error(INTERNAL_ERROR "Cannot create tree for %s.", lv->name);
+ log_error(INTERNAL_ERROR "Cannot create tree for %s.",
+ display_lvname(lv));
return 0;
}
/* Some targets may build bigger tree for activation */
@@ -3068,7 +3081,8 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
if (!dm_tree_deactivate_children(root, dlid, DLID_SIZE))
goto_out;
if (!_remove_lv_symlinks(dm, root))
- log_warn("Failed to remove all device symlinks associated with %s.", lv->name);
+ log_warn("Failed to remove all device symlinks associated with %s.",
+ display_lvname(lv));
break;
case SUSPEND:
dm_tree_skip_lockfs(root);
@@ -3105,7 +3119,8 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
if (!dm_tree_activate_children(root, dlid, DLID_SIZE))
goto_out;
if (!_create_lv_symlinks(dm, root))
- log_warn("Failed to create symlinks for %s.", lv->name);
+ log_warn("Failed to create symlinks for %s.",
+ display_lvname(lv));
}
break;
8 years, 5 months
master - cleanup: remove unused code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b7b59ad9323cd3...
Commit: b7b59ad9323cd38889e78068813c311170920d9d
Parent: 528695ec2004dcadaacba99d51685ac4a0582ea7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 25 15:45:19 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 09:27:37 2015 +0100
cleanup: remove unused code
Remove long outstand unused code lines, which were already
been obsoleted by other code.
Statuses and snapshot tree creation is already handled differently.
Also drop some 'extra' log_error() and use only stack;
since error has already been reported.
---
lib/activate/activate.c | 7 --
lib/activate/dev_manager.c | 218 ++------------------------------------------
2 files changed, 7 insertions(+), 218 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 4bcfcd6..47c675c 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1977,13 +1977,6 @@ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned o
return _lv_suspend(cmd, lvid_s, &laopts, 0, lv, lv_pre);
}
-/* No longer used */
-/***********
-int lv_suspend(struct cmd_context *cmd, const char *lvid_s)
-{
- return _lv_suspend(cmd, lvid_s, 1);
-}
-***********/
static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
struct lv_activate_opts *laopts, int error_if_not_active,
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 9110ecb..328d8ac 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -794,15 +794,12 @@ int dev_manager_info(struct dm_pool *mem, const struct logical_volume *lv,
char *dlid, *name;
int r;
- if (!(name = dm_build_dm_name(mem, lv->vg->name, lv->name, layer))) {
- log_error("name build failed for %s", lv->name);
- return 0;
- }
+ if (!(name = dm_build_dm_name(mem, lv->vg->name, lv->name, layer)))
+ return_0;
if (!(dlid = build_dm_uuid(mem, lv, layer))) {
- log_error("dlid build failed for %s", name);
r = 0;
- goto out;
+ goto_out;
}
log_debug_activation("Getting device info for %s [%s]", name, dlid);
@@ -823,10 +820,8 @@ static const struct dm_info *_cached_dm_info(struct dm_pool *mem,
const struct dm_tree_node *dnode;
const struct dm_info *dinfo = NULL;
- if (!(dlid = build_dm_uuid(mem, lv, layer))) {
- log_error("Failed to build dlid for %s.", lv->name);
- return NULL;
- }
+ if (!(dlid = build_dm_uuid(mem, lv, layer)))
+ return_NULL;
if (!(dnode = dm_tree_find_node_by_uuid(dtree, dlid)))
goto_out;
@@ -844,83 +839,6 @@ out:
return dinfo;
}
-#if 0
-/* FIXME Interface must cope with multiple targets */
-static int _status_run(const char *name, const char *uuid,
- unsigned long long *s, unsigned long long *l,
- char **t, uint32_t t_size, char **p, uint32_t p_size)
-{
- int r = 0;
- struct dm_task *dmt;
- struct dm_info info;
- void *next = NULL;
- uint64_t start, length;
- char *type = NULL;
- char *params = NULL;
-
- if (!(dmt = _setup_task(name, uuid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
- return_0;
-
- if (!dm_task_run(dmt))
- goto_out;
-
- if (!dm_task_get_info(dmt, &info) || !info.exists)
- goto_out;
-
- do {
- next = dm_get_next_target(dmt, next, &start, &length,
- &type, ¶ms);
- if (type) {
- *s = start;
- *l = length;
- /* Make sure things are null terminated */
- strncpy(*t, type, t_size);
- (*t)[t_size - 1] = '\0';
- strncpy(*p, params, p_size);
- (*p)[p_size - 1] = '\0';
-
- r = 1;
- /* FIXME Cope with multiple targets! */
- break;
- }
-
- } while (next);
-
- out:
- dm_task_destroy(dmt);
- return r;
-}
-
-static int _status(const char *name, const char *uuid,
- unsigned long long *start, unsigned long long *length,
- char **type, uint32_t type_size, char **params,
- uint32_t param_size) __attribute__ ((unused));
-
-static int _status(const char *name, const char *uuid,
- unsigned long long *start, unsigned long long *length,
- char **type, uint32_t type_size, char **params,
- uint32_t param_size)
-{
- if (uuid && *uuid) {
- if (_status_run(NULL, uuid, start, length, type,
- type_size, params, param_size) &&
- *params)
- return 1;
- else if (_status_run(NULL, uuid + sizeof(UUID_PREFIX) - 1, start,
- length, type, type_size, params,
- param_size) &&
- *params)
- return 1;
- }
-
- if (name && _status_run(name, NULL, start, length, type, type_size,
- params, param_size))
- return 1;
-
- return 0;
-}
-#endif
-
int lv_has_target_type(struct dm_pool *mem, const struct logical_volume *lv,
const char *layer, const char *target_type)
{
@@ -1333,10 +1251,8 @@ int dev_manager_mirror_percent(struct dev_manager *dm,
if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
return_0;
- if (!(dlid = build_dm_uuid(dm->mem, lv, layer))) {
- log_error("dlid build failed for %s", lv->name);
- return 0;
- }
+ if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
+ return_0;
log_debug_activation("Getting device %s status percentage for %s",
target_type, name);
@@ -1497,66 +1413,6 @@ out:
return r;
}
-//FIXME: Can we get rid of this crap below?
-#if 0
- log_very_verbose("%s %s", sus ? "Suspending" : "Resuming", name);
-
- log_verbose("Loading %s", dl->name);
- log_very_verbose("Activating %s read-only", dl->name);
- log_very_verbose("Activated %s %s %03u:%03u", dl->name,
- dl->dlid, dl->info.major, dl->info.minor);
-
- if (_get_flag(dl, VISIBLE))
- log_verbose("Removing %s", dl->name);
- else
- log_very_verbose("Removing %s", dl->name);
-
- log_debug_activation("Adding target: %" PRIu64 " %" PRIu64 " %s %s",
- extent_size * seg->le, extent_size * seg->len, target, params);
-
- log_debug_activation("Adding target: 0 %" PRIu64 " snapshot-origin %s",
- dl->lv->size, params);
- log_debug_activation("Adding target: 0 %" PRIu64 " snapshot %s", size, params);
- log_debug_activation("Getting device info for %s", dl->name);
-
- /* Rename? */
- if ((suffix = strrchr(dl->dlid + sizeof(UUID_PREFIX) - 1, '-')))
- suffix++;
- new_name = dm_build_dm_name(dm->mem, dm->vg_name, dl->lv->name,
- suffix);
-
-static int _belong_to_vg(const char *vgname, const char *name)
-{
- const char *v = vgname, *n = name;
-
- while (*v) {
- if ((*v != *n) || (*v == '-' && *(++n) != '-'))
- return 0;
- v++, n++;
- }
-
- if (*n == '-' && *(n + 1) != '-')
- return 1;
- else
- return 0;
-}
-
- if (!(snap_seg = find_snapshot(lv)))
- return 1;
-
- old_origin = snap_seg->origin;
-
- /* Was this the last active snapshot with this origin? */
- dm_list_iterate_items(lvl, active_head) {
- active = lvl->lv;
- if ((snap_seg = find_snapshot(active)) &&
- snap_seg->origin == old_origin) {
- return 1;
- }
- }
-
-#endif
-
int dev_manager_thin_pool_status(struct dev_manager *dm,
const struct logical_volume *lv,
struct dm_status_thin_pool **status,
@@ -2734,7 +2590,6 @@ static int _add_new_external_lv_to_dtree(struct dev_manager *dm,
* needed because of conversion of thin which could have been
* also an old-snapshot to external origin.
*/
- //if (lv_is_origin(external_lv))
dm_list_iterate_items(sl, &external_lv->segs_using_this_lv)
if ((sl->seg->external_lv == external_lv) &&
/* Add only active layered devices (also avoids loop) */
@@ -2835,59 +2690,6 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
return 1;
}
-#if 0
-static int _set_udev_flags_for_children(struct dev_manager *dm,
- struct volume_group *vg,
- struct dm_tree_node *dnode)
-{
- char *p;
- const char *uuid;
- void *handle = NULL;
- struct dm_tree_node *child;
- const struct dm_info *info;
- struct lv_list *lvl;
-
- while ((child = dm_tree_next_child(&handle, dnode, 0))) {
- /* Ignore root node */
- if (!(info = dm_tree_node_get_info(child)) || !info->exists)
- continue;
-
- if (!(uuid = dm_tree_node_get_uuid(child))) {
- log_error(INTERNAL_ERROR
- "Failed to get uuid for %" PRIu32 ":%" PRIu32,
- info->major, info->minor);
- continue;
- }
-
- /* Ignore non-LVM devices */
- if (!(p = strstr(uuid, UUID_PREFIX)))
- continue;
- p += strlen(UUID_PREFIX);
-
- /* Ignore LVs that belong to different VGs (due to stacking) */
- if (strncmp(p, (char *)vg->id.uuid, ID_LEN))
- continue;
-
- /* Ignore LVM devices with 'layer' suffixes */
- if (strrchr(p, '-'))
- continue;
-
- if (!(lvl = find_lv_in_vg_by_lvid(vg, (const union lvid *)p))) {
- log_error(INTERNAL_ERROR
- "%s (%" PRIu32 ":%" PRIu32 ") not found in VG",
- dm_tree_node_get_name(child),
- info->major, info->minor);
- return 0;
- }
-
- dm_tree_node_set_udev_flags(child,
- _get_udev_flags(dm, lvl->lv, NULL, 0, 0));
- }
-
- return 1;
-}
-#endif
-
static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
const struct logical_volume *lv, struct lv_activate_opts *laopts,
const char *layer)
@@ -3073,12 +2875,6 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!_add_new_lv_to_dtree(dm, dtree, sl->seg->lv, laopts, NULL))
return_0;
-#if 0
- /* Should not be needed, will be removed */
- if (!_set_udev_flags_for_children(dm, lv->vg, dnode))
- return_0;
-#endif
-
dm->track_pending_delete = save_pending_delete; /* restore */
return 1;
8 years, 5 months
master - cleanup: avoid allocation for vg_name
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=528695ec2004dc...
Commit: 528695ec2004dcadaacba99d51685ac4a0582ea7
Parent: d582be43d4cee8c74ee4e251d299a321ded474fa
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 25 16:04:27 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 09:27:37 2015 +0100
cleanup: avoid allocation for vg_name
Since we do not use dev_manager in a way we would have destroyed VG
content while in-use - we could safely keep just pointer.
So dropping strdup.
Also it seems we actually no longer use vg_name for anything
so it may possibly go away completely unless it would be useful
for debugging...
---
lib/activate/dev_manager.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index eb47ed1..9110ecb 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -66,7 +66,7 @@ struct dev_manager {
unsigned track_pending_delete;
unsigned track_pvmove_deps;
- char *vg_name;
+ const char *vg_name;
};
struct lv_layer {
@@ -1230,9 +1230,7 @@ struct dev_manager *dev_manager_create(struct cmd_context *cmd,
dm->cmd = cmd;
dm->mem = mem;
-
- if (!(dm->vg_name = dm_pool_strdup(dm->mem, vg_name)))
- goto_bad;
+ dm->vg_name = vg_name;
/*
* When we manipulate (normally suspend/resume) the PVMOVE
8 years, 5 months
master - libdm: const raid params and error for unsupported type
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d582be43d4cee8...
Commit: d582be43d4cee8c74ee4e251d299a321ded474fa
Parent: 1ea8afd3caa54259e58d8e3443389c819281c8c0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 26 09:18:46 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 26 09:27:04 2015 +0100
libdm: const raid params and error for unsupported type
Accept const struct with raid params (No API change).
Also add extra error message when raid type is unsupported.
---
WHATS_NEW_DM | 1 +
libdm/libdevmapper.h | 2 +-
libdm/libdm-deptree.c | 8 +++++---
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 600c5b7..a510938 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.112 -
=====================================
+ Show error message when trying to create unsupported raid type.
Improve preloading sequence of an active thin-pool target.
Drop extra space from cache target line to fix unneded table reloads.
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 6619aa7..310ceb7 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1441,7 +1441,7 @@ struct dm_tree_node_raid_params {
int dm_tree_node_add_raid_target_with_params(struct dm_tree_node *node,
uint64_t size,
- struct dm_tree_node_raid_params *p);
+ const struct dm_tree_node_raid_params *p);
/* Cache feature_flags */
#define DM_CACHE_FEATURE_WRITEBACK 0x00000001
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 0b33ad3..73f2e4c 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -3207,7 +3207,7 @@ int dm_tree_node_add_mirror_target(struct dm_tree_node *node,
int dm_tree_node_add_raid_target_with_params(struct dm_tree_node *node,
uint64_t size,
- struct dm_tree_node_raid_params *p)
+ const struct dm_tree_node_raid_params *p)
{
unsigned i;
struct load_segment *seg = NULL;
@@ -3217,8 +3217,10 @@ int dm_tree_node_add_raid_target_with_params(struct dm_tree_node *node,
if (!(seg = _add_segment(node,
_dm_segtypes[i].type, size)))
return_0;
- if (!seg)
- return_0;
+ if (!seg) {
+ log_error("Unsupported raid type %s.", p->raid_type);
+ return 0;
+ }
seg->region_size = p->region_size;
seg->stripe_size = p->stripe_size;
8 years, 5 months
master - lvmconfig: add --sinceversion for --type new
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1ea8afd3caa542...
Commit: 1ea8afd3caa54259e58d8e3443389c819281c8c0
Parent: 66c7fa4a44e322720ff67f0e46ed91d4d8113c72
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 25 14:09:20 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 25 14:12:12 2015 +0100
lvmconfig: add --sinceversion for --type new
Just for convenience to display all new configuration settings
introduced since given version (before, there was only --atversion
to display settings introduced in concrete version).
For example:
$ lvmconfig --type new --sinceversion 2.2.120
allocation {
# cache_mode="writethrough"
# cache_settings {
# }
}
global {
use_lvmlockd=0
# lvmlockd_lock_retries=3
# sanlock_lv_extend=256
use_lvmpolld=1
}
activation {
}
# report {
# compact_output_cols=""
# time_format="%Y-%m-%d %T %z"
# }
local {
# host_id=0
}
---
WHATS_NEW | 1 +
lib/config/config.c | 5 +++++
lib/config/config.h | 1 +
man/lvmconfig.8.in | 9 +++++++++
tools/args.h | 1 +
tools/commands.h | 27 +++++++++++++++------------
tools/dumpconfig.c | 33 ++++++++++++++++++++++++++-------
7 files changed, 58 insertions(+), 19 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a4eeebf..c3afac3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.136 -
=====================================
+ Add new --sinceversion option for lvmconfig --type new.
Fix inactive table loaded for wrapping thin-pool when resizing it.
Extend the list of ignored libraries when locking memory.
diff --git a/lib/config/config.c b/lib/config/config.c
index d69f1f7..5551a7f 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1996,6 +1996,11 @@ static int _should_skip_def_node(struct config_def_tree_spec *spec, int section_
_should_skip_deprecated_def_node(def, spec))
return 1;
break;
+ case CFG_DEF_TREE_NEW_SINCE:
+ if ((def->since_version < spec->version) ||
+ _should_skip_deprecated_def_node(def, spec))
+ return 1;
+ break;
case CFG_DEF_TREE_PROFILABLE:
/* fall through */
case CFG_DEF_TREE_PROFILABLE_CMD:
diff --git a/lib/config/config.h b/lib/config/config.h
index e112223..95d252c 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -146,6 +146,7 @@ typedef enum {
CFG_DEF_TREE_FULL, /* CURRENT + MISSING, the tree actually used within execution */
CFG_DEF_TREE_DEFAULT, /* tree of all possible config nodes with default values */
CFG_DEF_TREE_NEW, /* tree of all new nodes that appeared in given version */
+ CFG_DEF_TREE_NEW_SINCE, /* tree of all new nodes that appeared since given version */
CFG_DEF_TREE_PROFILABLE, /* tree of all nodes that are customizable by profiles */
CFG_DEF_TREE_PROFILABLE_CMD, /* tree of all nodes that are customizable by command profiles (subset of PROFILABLE) */
CFG_DEF_TREE_PROFILABLE_MDA, /* tree of all nodes that are customizable by metadata profiles (subset of PROFILABLE) */
diff --git a/man/lvmconfig.8.in b/man/lvmconfig.8.in
index bbbeb6d..0e9e7c5 100644
--- a/man/lvmconfig.8.in
+++ b/man/lvmconfig.8.in
@@ -9,6 +9,8 @@ lvmconfig, lvm dumpconfig, lvm config \(em Display LVM configuration
.RI { current | default | diff | full | list | missing | new | profilable | profilable-command | profilable-metadata }
.RB [ \-\-atversion
.IR version ]
+.RB [ \-\---sinceversion
+.IR version ]
.RB [ \-\-ignoreadvanced ]
.RB [ \-\-ignoreunsupported ]
.RB [ \-\-ignorelocal ]
@@ -109,6 +111,13 @@ which does not contain any newer settings for which LVM would
issue a warning message when checking the configuration.
.TP
+.BI \-\-sinceversion " version"
+Specify an LVM version in x.y.z format where x is the major version,
+the y is the minor version and z is the patchlevel (e.g. 2.2.106).
+This option is currently applicable only with \fB\-\-type new\fP
+to display all configuration settings introduced since given version.
+
+.TP
.B \-\-ignoreadvanced
Exclude advanced configuration settings from the output.
diff --git a/tools/args.h b/tools/args.h
index 210545e..f6b10a6 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -101,6 +101,7 @@ arg(rows_ARG, '\0', "rows", NULL, 0)
arg(segments_ARG, '\0', "segments", NULL, 0)
arg(separator_ARG, '\0', "separator", string_arg, 0)
arg(shared_ARG, '\0', "shared", NULL, 0)
+arg(sinceversion_ARG, '\0', "sinceversion", string_arg, 0)
arg(split_ARG, '\0', "split", NULL, 0)
arg(splitcache_ARG, '\0', "splitcache", NULL, 0)
arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index a141135..b232a7d 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -33,8 +33,8 @@ xx(config,
PERMITTED_READ_ONLY | NO_METADATA_PROCESSING,
"config\n"
"\t[-f|--file filename]\n"
- "\t[--type {current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata}\n"
- "\t[--atversion version]]\n"
+ "\t[--type {current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata}]\n"
+ "\t[--atversion version]\n"
"\t[--ignoreadvanced]\n"
"\t[--ignoreunsupported]\n"
"\t[--ignorelocal]\n"
@@ -44,6 +44,7 @@ xx(config,
"\t[--profile ProfileName]\n"
"\t[--metadataprofile ProfileName]\n"
"\t[--mergedconfig]\n"
+ "\t[--sinceversion version]\n"
"\t[--showdeprecated]\n"
"\t[--showunsupported]\n"
"\t[--validate]\n"
@@ -55,8 +56,8 @@ xx(config,
"\t[ConfigurationNode...]\n",
atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
ignoreunsupported_ARG, ignorelocal_ARG, list_ARG, mergedconfig_ARG, metadataprofile_ARG,
- showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG, withcomments_ARG,
- withspaces_ARG, unconfigured_ARG, withversions_ARG)
+ sinceversion_ARG, showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG,
+ withcomments_ARG, withspaces_ARG, unconfigured_ARG, withversions_ARG)
xx(devtypes,
"Display recognised built-in block device types",
@@ -89,8 +90,8 @@ xx(dumpconfig,
PERMITTED_READ_ONLY | NO_METADATA_PROCESSING,
"dumpconfig\n"
"\t[-f|--file filename]\n"
- "\t[--type {current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata}\n"
- "\t[--atversion version]]\n"
+ "\t[--type {current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata}]\n"
+ "\t[--atversion version]\n"
"\t[--ignoreadvanced]\n"
"\t[--ignoreunsupported]\n"
"\t[--ignorelocal]\n"
@@ -100,6 +101,7 @@ xx(dumpconfig,
"\t[--profile ProfileName]\n"
"\t[--metadataprofile ProfileName]\n"
"\t[--mergedconfig]\n"
+ "\t[--sinceversion version]\n"
"\t[--showdeprecated]\n"
"\t[--showunsupported]\n"
"\t[--validate]\n"
@@ -111,8 +113,8 @@ xx(dumpconfig,
"\t[ConfigurationNode...]\n",
atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
ignoreunsupported_ARG, ignorelocal_ARG, list_ARG, mergedconfig_ARG, metadataprofile_ARG,
- showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG, withcomments_ARG,
- withspaces_ARG, unconfigured_ARG, withversions_ARG)
+ sinceversion_ARG, showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG,
+ withcomments_ARG, withspaces_ARG, unconfigured_ARG, withversions_ARG)
xx(formats,
"List available metadata formats",
@@ -499,8 +501,8 @@ xx(lvmconfig,
PERMITTED_READ_ONLY | NO_METADATA_PROCESSING,
"lvmconfig\n"
"\t[-f|--file filename]\n"
- "\t[--type {current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata}\n"
- "\t[--atversion version]]\n"
+ "\t[--type {current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata}]\n"
+ "\t[--atversion version]\n"
"\t[--ignoreadvanced]\n"
"\t[--ignoreunsupported]\n"
"\t[--ignorelocal]\n"
@@ -510,6 +512,7 @@ xx(lvmconfig,
"\t[--profile ProfileName]\n"
"\t[--metadataprofile ProfileName]\n"
"\t[--mergedconfig]\n"
+ "\t[--sinceversion version]\n"
"\t[--showdeprecated]\n"
"\t[--showunsupported]\n"
"\t[--validate]\n"
@@ -521,8 +524,8 @@ xx(lvmconfig,
"\t[ConfigurationNode...]\n",
atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
ignoreunsupported_ARG, ignorelocal_ARG, list_ARG, mergedconfig_ARG, metadataprofile_ARG,
- showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG, withcomments_ARG,
- withspaces_ARG, unconfigured_ARG, withversions_ARG)
+ sinceversion_ARG, showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG,
+ withcomments_ARG, withspaces_ARG, unconfigured_ARG, withversions_ARG)
xx(lvmdiskscan,
"List devices that may be used as physical volumes",
diff --git a/tools/dumpconfig.c b/tools/dumpconfig.c
index c9c5bf9..72129c2 100644
--- a/tools/dumpconfig.c
+++ b/tools/dumpconfig.c
@@ -17,10 +17,17 @@
static int _get_vsn(struct cmd_context *cmd, uint16_t *version_int)
{
- const char *atversion = arg_str_value(cmd, atversion_ARG, LVM_VERSION);
+ const char *version;
unsigned int major, minor, patchlevel;
- if (sscanf(atversion, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
+ if (arg_count(cmd, atversion_ARG))
+ version = arg_str_value(cmd, atversion_ARG, NULL);
+ else if (arg_count(cmd, sinceversion_ARG))
+ version = arg_str_value(cmd, sinceversion_ARG, NULL);
+ else
+ version = LVM_VERSION;
+
+ if (sscanf(version, "%u.%u.%u", &major, &minor, &patchlevel) != 3) {
log_error("Incorrect version format.");
return 0;
}
@@ -110,10 +117,21 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
- if (arg_count(cmd, atversion_ARG) && !arg_count(cmd, configtype_ARG) &&
- !arg_count(cmd, list_ARG)) {
- log_error("--atversion requires --type or --list");
- return EINVALID_CMD_LINE;
+ if (arg_count(cmd, atversion_ARG)) {
+ if (arg_count(cmd, sinceversion_ARG)) {
+ log_error("Only one of --atversion and --sinceversion permitted.");
+ return EINVALID_CMD_LINE;
+ }
+
+ if (!arg_count(cmd, configtype_ARG) && !arg_count(cmd, list_ARG)) {
+ log_error("--atversion requires --type or --list");
+ return EINVALID_CMD_LINE;
+ }
+ } else if (arg_count(cmd, sinceversion_ARG)) {
+ if (!arg_count(cmd, configtype_ARG) || strcmp(type, "new")) {
+ log_error("--sinceversion requires --type new");
+ return EINVALID_CMD_LINE;
+ }
}
if (arg_count(cmd, ignoreadvanced_ARG))
@@ -252,7 +270,8 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
}
}
else if (!strcmp(type, "new")) {
- tree_spec.type = CFG_DEF_TREE_NEW;
+ tree_spec.type = arg_count(cmd, sinceversion_ARG) ? CFG_DEF_TREE_NEW_SINCE
+ : CFG_DEF_TREE_NEW;
/* new type does not require check status */
}
else if (!strcmp(type, "profilable")) {
8 years, 5 months
master - cleanup: rename lv_ondisk to lv_committed
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=66c7fa4a44e322...
Commit: 66c7fa4a44e322720ff67f0e46ed91d4d8113c72
Parent: 4312b096359b336d6f4ba52679a0f594854ba7ee
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 25 11:10:32 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Nov 25 11:39:26 2015 +0100
cleanup: rename lv_ondisk to lv_committed
Patch has no functional change.
---
lib/locking/file_locking.c | 14 +++++++-------
lib/locking/no_locking.c | 16 +++++++++-------
lib/metadata/lv.h | 2 +-
lib/metadata/metadata.c | 4 ++--
4 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
index 0595752..849bc3c 100644
--- a/lib/locking/file_locking.c
+++ b/lib/locking/file_locking.c
@@ -92,18 +92,18 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
switch (flags & LCK_TYPE_MASK) {
case LCK_UNLOCK:
log_very_verbose("Unlocking LV %s%s%s", resource, origin_only ? " without snapshots" : "", revert ? " (reverting)" : "");
- if (!lv_resume_if_active(cmd, resource, origin_only, 0, revert, lv_ondisk(lv)))
+ if (!lv_resume_if_active(cmd, resource, origin_only, 0, revert, lv_committed(lv)))
return 0;
break;
case LCK_NULL:
log_very_verbose("Locking LV %s (NL)", resource);
- if (!lv_deactivate(cmd, resource, lv_ondisk(lv)))
+ if (!lv_deactivate(cmd, resource, lv_committed(lv)))
return 0;
break;
case LCK_READ:
log_very_verbose("Locking LV %s (R)", resource);
- if (!lv_activate_with_filter(cmd, resource, 0, lv->status & LV_NOSCAN ? 1 : 0,
- lv->status & LV_TEMPORARY ? 1 : 0, lv_ondisk(lv)))
+ if (!lv_activate_with_filter(cmd, resource, 0, (lv->status & LV_NOSCAN) ? 1 : 0,
+ (lv->status & LV_TEMPORARY) ? 1 : 0, lv_committed(lv)))
return 0;
break;
case LCK_PREAD:
@@ -111,13 +111,13 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
break;
case LCK_WRITE:
log_very_verbose("Locking LV %s (W)%s", resource, origin_only ? " without snapshots" : "");
- if (!lv_suspend_if_active(cmd, resource, origin_only, 0, lv_ondisk(lv), lv))
+ if (!lv_suspend_if_active(cmd, resource, origin_only, 0, lv_committed(lv), lv))
return 0;
break;
case LCK_EXCL:
log_very_verbose("Locking LV %s (EX)", resource);
- if (!lv_activate_with_filter(cmd, resource, 1, lv->status & LV_NOSCAN ? 1 : 0,
- lv->status & LV_TEMPORARY ? 1 : 0, lv_ondisk(lv)))
+ if (!lv_activate_with_filter(cmd, resource, 1, (lv->status & LV_NOSCAN) ? 1 : 0,
+ (lv->status & LV_TEMPORARY) ? 1 : 0, lv_committed(lv)))
return 0;
break;
default:
diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c
index 613877a..6b0ac63 100644
--- a/lib/locking/no_locking.c
+++ b/lib/locking/no_locking.c
@@ -44,17 +44,19 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
case LCK_LV:
switch (flags & LCK_TYPE_MASK) {
case LCK_NULL:
- return lv_deactivate(cmd, resource, lv_ondisk(lv));
+ return lv_deactivate(cmd, resource, lv_committed(lv));
case LCK_UNLOCK:
- return lv_resume_if_active(cmd, resource, (flags & LCK_ORIGIN_ONLY) ? 1: 0, 0, (flags & LCK_REVERT) ? 1 : 0, lv_ondisk(lv));
+ return lv_resume_if_active(cmd, resource, (flags & LCK_ORIGIN_ONLY) ? 1: 0, 0,
+ (flags & LCK_REVERT) ? 1 : 0, lv_committed(lv));
case LCK_READ:
- return lv_activate_with_filter(cmd, resource, 0, lv->status & LV_NOSCAN ? 1 : 0,
- lv->status & LV_TEMPORARY ? 1 : 0, lv_ondisk(lv));
+ return lv_activate_with_filter(cmd, resource, 0, (lv->status & LV_NOSCAN) ? 1 : 0,
+ (lv->status & LV_TEMPORARY) ? 1 : 0, lv_committed(lv));
case LCK_WRITE:
- return lv_suspend_if_active(cmd, resource, (flags & LCK_ORIGIN_ONLY) ? 1 : 0, 0, lv_ondisk(lv), lv);
+ return lv_suspend_if_active(cmd, resource, (flags & LCK_ORIGIN_ONLY) ? 1 : 0, 0,
+ lv_committed(lv), lv);
case LCK_EXCL:
- return lv_activate_with_filter(cmd, resource, 1, lv->status & LV_NOSCAN ? 1 : 0,
- lv->status & LV_TEMPORARY ? 1 : 0, lv_ondisk(lv));
+ return lv_activate_with_filter(cmd, resource, 1, (lv->status & LV_NOSCAN) ? 1 : 0,
+ (lv->status & LV_TEMPORARY) ? 1 : 0, lv_committed(lv));
default:
break;
}
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index 172d29f..2f1e4f9 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -113,7 +113,7 @@ int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
enum activation_change activate, int needs_exlusive);
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
const struct logical_volume *lv_lock_holder(const struct logical_volume *lv);
-const struct logical_volume *lv_ondisk(const struct logical_volume *lv);
+const struct logical_volume *lv_committed(const struct logical_volume *lv);
struct profile *lv_config_profile(const struct logical_volume *lv);
char *lv_profile_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_lock_args_dup(struct dm_pool *mem, const struct logical_volume *lv);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 52d76c3..7ee928d 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -5531,7 +5531,7 @@ char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl)
return dm_pool_end_object(mem);
}
-const struct logical_volume *lv_ondisk(const struct logical_volume *lv)
+const struct logical_volume *lv_committed(const struct logical_volume *lv)
{
struct volume_group *vg;
struct logical_volume *found_lv;
@@ -5545,7 +5545,7 @@ const struct logical_volume *lv_ondisk(const struct logical_volume *lv)
vg = lv->vg->vg_committed;
if (!(found_lv = find_lv_in_vg_by_lvid(vg, &lv->lvid))) {
- log_error(INTERNAL_ERROR "LV %s (UUID %s) not found in ondisk metadata.",
+ log_error(INTERNAL_ERROR "LV %s (UUID %s) not found in committed metadata.",
display_lvname(lv), lv->lvid.s);
return NULL;
}
8 years, 5 months
master - cleanup: change ondisk committed
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4312b096359b33...
Commit: 4312b096359b336d6f4ba52679a0f594854ba7ee
Parent: d9faf859871e0e862ded3cc08638847c9aaa6f1a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 25 10:52:22 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Nov 25 11:39:26 2015 +0100
cleanup: change ondisk committed
Patch has no functional change.
---
lib/activate/activate.c | 86 +++++++++++++++++++++++-----------------------
lib/activate/activate.h | 2 +-
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index c30a7ac..4bcfcd6 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -333,7 +333,7 @@ int lv_suspend(struct cmd_context *cmd, const char *lvid_s)
}
*******/
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
- const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv)
+ const struct logical_volume *lv, const struct logical_volume *lv_pre)
{
return 1;
}
@@ -1793,12 +1793,12 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
struct lv_activate_opts *laopts, int error_if_not_suspended,
- const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv)
+ const struct logical_volume *lv, const struct logical_volume *lv_pre)
{
const struct logical_volume *pvmove_lv = NULL;
- const struct logical_volume *ondisk_lv_to_free = NULL;
- const struct logical_volume *incore_lv_to_free = NULL;
- struct logical_volume *lv_pre;
+ const struct logical_volume *lv_to_free = NULL;
+ const struct logical_volume *lv_pre_to_free = NULL;
+ struct logical_volume *lv_pre_tmp;
struct seg_list *sl;
struct lv_segment *snap_seg;
struct lvinfo info;
@@ -1808,27 +1808,28 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
if (!activation())
return 1;
- if (!ondisk_lv && !(ondisk_lv_to_free = ondisk_lv = lv_from_lvid(cmd, lvid_s, 0)))
+ /* lv comes from committed metadata */
+ if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0)))
goto_out;
/* Use precommitted metadata if present */
- if (!incore_lv && !(incore_lv_to_free = incore_lv = lv_from_lvid(cmd, lvid_s, 1)))
+ if (!lv_pre && !(lv_pre_to_free = lv_pre = lv_from_lvid(cmd, lvid_s, 1)))
goto_out;
/* Ignore origin_only unless LV is origin in both old and new metadata */
/* or LV is thin or thin pool volume */
- if (!lv_is_thin_volume(ondisk_lv) && !lv_is_thin_pool(ondisk_lv) &&
- !(lv_is_origin(ondisk_lv) && lv_is_origin(incore_lv)))
+ if (!lv_is_thin_volume(lv) && !lv_is_thin_pool(lv) &&
+ !(lv_is_origin(lv) && lv_is_origin(lv_pre)))
laopts->origin_only = 0;
if (test_mode()) {
- _skip("Suspending %s%s.", ondisk_lv->name,
+ _skip("Suspending %s%s.", display_lvname(lv),
laopts->origin_only ? " origin without snapshots" : "");
r = 1;
goto out;
}
- if (!lv_info(cmd, ondisk_lv, laopts->origin_only, &info, 0, 0))
+ if (!lv_info(cmd, lv, laopts->origin_only, &info, 0, 0))
goto_out;
if (!info.exists || info.suspended) {
@@ -1840,10 +1841,10 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
goto out;
}
- if (!lv_read_replicator_vgs(ondisk_lv))
+ if (!lv_read_replicator_vgs(lv))
goto_out;
- lv_calculate_readahead(ondisk_lv, NULL);
+ lv_calculate_readahead(lv, NULL);
/*
* Preload devices for the LV.
@@ -1852,58 +1853,57 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
* tables for all the changed LVs here, as the relationships
* are not found by walking the new metadata.
*/
- if (!lv_is_locked(incore_lv) &&
- lv_is_locked(ondisk_lv) &&
- (pvmove_lv = find_pvmove_lv_in_lv(ondisk_lv))) {
+ if (lv_is_locked(lv) && !lv_is_locked(lv_pre) &&
+ (pvmove_lv = find_pvmove_lv_in_lv(lv))) {
/* Preload all the LVs above the PVMOVE LV */
dm_list_iterate_items(sl, &pvmove_lv->segs_using_this_lv) {
- if (!(lv_pre = find_lv(incore_lv->vg, sl->seg->lv->name))) {
+ if (!(lv_pre_tmp = find_lv(lv_pre->vg, sl->seg->lv->name))) {
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", sl->seg->lv->name);
goto out;
}
- if (!_lv_preload(lv_pre, laopts, &flush_required))
+ if (!_lv_preload(lv_pre_tmp, laopts, &flush_required))
goto_out;
}
/* Now preload the PVMOVE LV itself */
- if (!(lv_pre = find_lv(incore_lv->vg, pvmove_lv->name))) {
+ if (!(lv_pre_tmp = find_lv(lv_pre->vg, pvmove_lv->name))) {
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", pvmove_lv->name);
goto out;
}
- if (!_lv_preload(lv_pre, laopts, &flush_required))
+ if (!_lv_preload(lv_pre_tmp, laopts, &flush_required))
goto_out;
} else {
- if (!_lv_preload(incore_lv, laopts, &flush_required))
+ if (!_lv_preload(lv_pre, laopts, &flush_required))
/* FIXME Revert preloading */
goto_out;
/*
* Search for existing LVs that have become detached and preload them.
*/
- detached.lv_pre = incore_lv;
+ detached.lv_pre = lv_pre;
detached.laopts = laopts;
detached.flush_required = &flush_required;
- if (!for_each_sub_lv((struct logical_volume *)ondisk_lv, &_preload_detached_lv, &detached))
+ if (!for_each_sub_lv((struct logical_volume *)lv, &_preload_detached_lv, &detached))
goto_out;
/*
* Preload any snapshots that are being removed.
*/
- if (!laopts->origin_only && lv_is_origin(ondisk_lv)) {
- dm_list_iterate_items_gen(snap_seg, &ondisk_lv->snapshot_segs, origin_list) {
- if (!(lv_pre = find_lv_in_vg_by_lvid(incore_lv->vg, &snap_seg->cow->lvid))) {
+ if (!laopts->origin_only && lv_is_origin(lv)) {
+ dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) {
+ if (!(lv_pre_tmp = find_lv_in_vg_by_lvid(lv_pre->vg, &snap_seg->cow->lvid))) {
log_error(INTERNAL_ERROR "LV %s (%s) missing from preload metadata",
snap_seg->cow->name, snap_seg->cow->lvid.id[1].uuid);
goto out;
}
- if (!lv_is_cow(lv_pre) &&
- !_lv_preload(lv_pre, laopts, &flush_required))
+ if (!lv_is_cow(lv_pre_tmp) &&
+ !_lv_preload(lv_pre_tmp, laopts, &flush_required))
goto_out;
}
}
}
- if (!monitor_dev_for_events(cmd, ondisk_lv, laopts, 0))
+ if (!monitor_dev_for_events(cmd, lv, laopts, 0))
/* FIXME Consider aborting here */
stack;
@@ -1912,14 +1912,14 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
critical_section_inc(cmd, "suspending pvmove LV");
if (!laopts->origin_only &&
- (lv_is_origin(incore_lv) || lv_is_cow(incore_lv)))
+ (lv_is_origin(lv_pre) || lv_is_cow(lv_pre)))
lockfs = 1;
/* Converting non-thin LV to thin external origin ? */
- if (!lv_is_thin_volume(ondisk_lv) && lv_is_thin_volume(incore_lv))
+ if (!lv_is_thin_volume(lv) && lv_is_thin_volume(lv_pre))
lockfs = 1; /* Sync before conversion */
- if (laopts->origin_only && lv_is_thin_volume(ondisk_lv) && lv_is_thin_volume(incore_lv))
+ if (laopts->origin_only && lv_is_thin_volume(lv) && lv_is_thin_volume(lv_pre))
lockfs = 1;
/*
@@ -1930,9 +1930,9 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
* inactive table to load or not instead so lv_suspend
* can be called separately for each LV safely.
*/
- if ((incore_lv->vg->status & PRECOMMITTED) &&
- lv_is_locked(incore_lv) && find_pvmove_lv_in_lv(incore_lv)) {
- if (!_lv_suspend_lv(incore_lv, laopts, lockfs, flush_required)) {
+ if ((lv_pre->vg->status & PRECOMMITTED) &&
+ lv_is_locked(lv_pre) && find_pvmove_lv_in_lv(lv_pre)) {
+ if (!_lv_suspend_lv(lv_pre, laopts, lockfs, flush_required)) {
critical_section_dec(cmd, "failed precommitted suspend");
if (pvmove_lv)
critical_section_dec(cmd, "failed precommitted suspend (pvmove)");
@@ -1940,7 +1940,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
}
} else {
/* Normal suspend */
- if (!_lv_suspend_lv(ondisk_lv, laopts, lockfs, flush_required)) {
+ if (!_lv_suspend_lv(lv, laopts, lockfs, flush_required)) {
critical_section_dec(cmd, "failed suspend");
if (pvmove_lv)
critical_section_dec(cmd, "failed suspend (pvmove)");
@@ -1950,11 +1950,11 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
r = 1;
out:
- if (incore_lv_to_free)
- release_vg(incore_lv_to_free->vg);
- if (ondisk_lv_to_free) {
- lv_release_replicator_vgs(ondisk_lv_to_free);
- release_vg(ondisk_lv_to_free->vg);
+ if (lv_pre_to_free)
+ release_vg(lv_pre_to_free->vg);
+ if (lv_to_free) {
+ lv_release_replicator_vgs(lv_to_free);
+ release_vg(lv_to_free->vg);
}
return r;
@@ -1967,14 +1967,14 @@ out:
* Returns success if the device is not active
*/
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
- const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv)
+ const struct logical_volume *lv, const struct logical_volume *lv_pre)
{
struct lv_activate_opts laopts = {
.origin_only = origin_only,
.exclusive = exclusive
};
- return _lv_suspend(cmd, lvid_s, &laopts, 0, ondisk_lv, incore_lv);
+ return _lv_suspend(cmd, lvid_s, &laopts, 0, lv, lv_pre);
}
/* No longer used */
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 01d6444..2c339c0 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -106,7 +106,7 @@ void activation_exit(void);
/* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive,
- const struct logical_volume *lv_ondisk, const struct logical_volume *lv_incore);
+ const struct logical_volume *lv, const struct logical_volume *lv_pre);
int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, const struct logical_volume *lv);
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
unsigned origin_only, unsigned exclusive, unsigned revert, const struct logical_volume *lv);
8 years, 5 months