master - cleanup: simplify _deps code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0e177cc7c9013944153...
Commit: 0e177cc7c90139441530fc065125fa510671e610
Parent: 4dc81848034f4f5edb02335af03e50f45c3977f0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 30 12:53:34 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
cleanup: simplify _deps code
Make _deps to always return name & uuid,
and postpone duplication of name and uuid into _create_dm_tree_node().
Saves some duplicated code.
---
libdm/libdm-deptree.c | 42 +++++++++++-------------------------------
1 files changed, 11 insertions(+), 31 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index d460ce1..8c623bf 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -523,15 +523,14 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
struct dm_tree_node *node;
dev_t dev;
- if (!(node = dm_pool_zalloc(dtree->mem, sizeof(*node)))) {
- log_error("_create_dm_tree_node alloc failed");
+ if (!(node = dm_pool_zalloc(dtree->mem, sizeof(*node))) ||
+ !(node->name = dm_pool_strdup(dtree->mem, name)) ||
+ !(node->uuid = dm_pool_strdup(dtree->mem, uuid))) {
+ log_error("_create_dm_tree_node alloc failed.");
return NULL;
}
node->dtree = dtree;
-
- node->name = name;
- node->uuid = uuid;
node->info = *info;
node->context = context;
node->udev_flags = udev_flags;
@@ -882,10 +881,8 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint
}
if (!info->exists) {
- if (name)
- *name = "";
- if (uuid)
- *uuid = "";
+ *name = "";
+ *uuid = "";
*deps = NULL;
} else {
if (info->major != major) {
@@ -898,14 +895,8 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint
minor, info->minor);
goto failed;
}
- if (name && !(*name = dm_pool_strdup(mem, dm_task_get_name(*dmt)))) {
- log_error("name pool_strdup failed");
- goto failed;
- }
- if (uuid && !(*uuid = dm_pool_strdup(mem, dm_task_get_uuid(*dmt)))) {
- log_error("uuid pool_strdup failed");
- goto failed;
- }
+ *name = dm_task_get_name(*dmt);
+ *uuid = dm_task_get_uuid(*dmt);
*deps = dm_task_get_deps(*dmt);
}
@@ -1081,7 +1072,7 @@ static int _node_clear_table(struct dm_tree_node *dnode, uint16_t udev_flags)
struct dm_task *dmt = NULL, *deps_dmt = NULL;
struct dm_info *info, deps_info;
struct dm_deps *deps = NULL;
- const char *name, *uuid;
+ const char *name, *uuid, *depname, *depuuid;
const char *default_uuid_prefix;
size_t default_uuid_prefix_len;
uint32_t i;
@@ -1102,7 +1093,7 @@ static int _node_clear_table(struct dm_tree_node *dnode, uint16_t udev_flags)
return 1;
/* Get devices used by inactive table that's about to be deleted. */
- if (!_deps(&deps_dmt, dnode->dtree->mem, info->major, info->minor, NULL, NULL, 1, info, &deps)) {
+ if (!_deps(&deps_dmt, dnode->dtree->mem, info->major, info->minor, &depname, &depuuid, 1, info, &deps)) {
log_error("Failed to obtain dependencies for %s before clearing table.", name);
return 0;
}
@@ -1185,8 +1176,6 @@ struct dm_tree_node *dm_tree_add_new_dev_with_udev_flags(struct dm_tree *dtree,
{
struct dm_tree_node *dnode;
struct dm_info info = { 0 };
- const char *name2;
- const char *uuid2;
if (!name || !uuid) {
log_error("Cannot add device without name and uuid.");
@@ -1195,16 +1184,7 @@ struct dm_tree_node *dm_tree_add_new_dev_with_udev_flags(struct dm_tree *dtree,
/* Do we need to add node to tree? */
if (!(dnode = dm_tree_find_node_by_uuid(dtree, uuid))) {
- if (!(name2 = dm_pool_strdup(dtree->mem, name))) {
- log_error("name pool_strdup failed");
- return NULL;
- }
- if (!(uuid2 = dm_pool_strdup(dtree->mem, uuid))) {
- log_error("uuid pool_strdup failed");
- return NULL;
- }
-
- if (!(dnode = _create_dm_tree_node(dtree, name2, uuid2, &info,
+ if (!(dnode = _create_dm_tree_node(dtree, name, uuid, &info,
context, 0)))
return_NULL;
6 years, 4 months
master - suspend: optimize generated list
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4dc81848034f4f5edb0...
Commit: 4dc81848034f4f5edb02335af03e50f45c3977f0
Parent: 7e794b7748a84d2e8f48012b6c31ba50992c8ac1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 30 13:24:41 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
suspend: optimize generated list
Avoid adding same LV multiple times into the list.
Just saves couple extra calls and ioctls and makes log shorter.
---
lib/activate/activate.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index eacf638..381083b 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2089,7 +2089,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
const struct logical_volume *pvmove_lv = NULL;
const struct logical_volume *lv_to_free = NULL;
const struct logical_volume *lv_pre_to_free = NULL;
- struct logical_volume *lv_pre_tmp;
+ struct logical_volume *lv_pre_tmp, *lv_tmp;
struct seg_list *sl;
struct lv_segment *snap_seg;
struct lvinfo info;
@@ -2098,6 +2098,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
struct dm_pool *mem = NULL;
struct dm_list suspend_lvs;
struct lv_list *lvl;
+ int found;
if (!activation())
return 1;
@@ -2247,19 +2248,28 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
/* Prepare list of all LVs for suspend ahead */
dm_list_init(&suspend_lvs);
dm_list_iterate_items(sl, &pvmove_lv->segs_using_this_lv) {
+ lv_tmp = sl->seg->lv;
+ if (lv_is_cow(lv_tmp))
+ /* Never suspend COW, always has to be origin */
+ lv_tmp = origin_from_cow(lv_tmp);
+ found = 0;
+ dm_list_iterate_items(lvl, &suspend_lvs)
+ if (strcmp(lvl->lv->name, lv_tmp->name) == 0) {
+ found = 1;
+ break;
+ }
+ if (found)
+ continue; /* LV is already in the list */
if (!(lvl = dm_pool_alloc(mem, sizeof(*lvl)))) {
log_error("lv_list alloc failed.");
goto out;
}
/* Look for precommitted LV name in commmitted VG */
- if (!(lvl->lv = find_lv(lv->vg, sl->seg->lv->name))) {
+ if (!(lvl->lv = find_lv(lv->vg, lv_tmp->name))) {
log_error(INTERNAL_ERROR "LV %s missing from preload metadata.",
- display_lvname(sl->seg->lv));
+ display_lvname(lv_tmp));
goto out;
}
- /* Never suspend COW, always has to be origin */
- if (lv_is_cow(lvl->lv))
- lvl->lv = origin_from_cow(lvl->lv);
dm_list_add(&suspend_lvs, &lvl->list);
}
dm_list_iterate_items(lvl, &suspend_lvs)
6 years, 4 months
master - activation: avoid rechecking pvmove node
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7e794b7748a84d2e8f4...
Commit: 7e794b7748a84d2e8f48012b6c31ba50992c8ac1
Parent: e4db42e4769823aceb59698cef9811c11e330b7b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 30 13:26:44 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
activation: avoid rechecking pvmove node
Use new 3rd. state of trace_pvmove_deps == 2.
In this state we know, we have already seen the node and can skip futher
testing. Remainging value 1 signals we want to track, and value 0
is for ignoring tracking, but node is still checking in this case.
Reduces large amount of duplicate ioctl queries.
---
lib/activate/dev_manager.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 429f4f6..9f19912 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2059,6 +2059,9 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
const char *uuid;
const struct logical_volume *plv;
+ if (lv_is_pvmove(lv) && (dm->track_pvmove_deps == 2))
+ return 1; /* Avoid rechecking of already seen pvmove LV */
+
if (lv_is_cache_pool(lv)) {
if (!dm_list_empty(&lv->segs_using_this_lv)) {
if (!_add_lv_to_dtree(dm, dtree, seg_lv(first_seg(lv), 0), 0))
@@ -2178,8 +2181,8 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
/* Add any LVs referencing a PVMOVE LV unless told not to. */
- if (dm->track_pvmove_deps && lv_is_pvmove(lv)) {
- dm->track_pvmove_deps = 0;
+ if ((dm->track_pvmove_deps == 1) && lv_is_pvmove(lv)) {
+ dm->track_pvmove_deps = 2; /* Mark as already seen */
dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
/* If LV is snapshot COW - whole snapshot needs reload */
plv = lv_is_cow(sl->seg->lv) ? origin_from_cow(sl->seg->lv) : sl->seg->lv;
6 years, 4 months
master - activation: extend resume validation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e4db42e4769823aceb5...
Commit: e4db42e4769823aceb59698cef9811c11e330b7b
Parent: c086dfadc389551b9a2d7b4c26931e5e74ada8d6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 28 23:11:20 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
activation: extend resume validation
Check also all snapshosts when resume is requested,
the origin volume is already resume, but possibly
some subLV or snapshot LV could be suspended if
we are still in critical_section.
---
lib/activate/activate.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 17bbe15..eacf638 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2311,6 +2311,11 @@ static int _check_suspended_lv(struct logical_volume *lv, void *data)
return 0; /* There is suspended subLV in the tree */
}
+ if (lv_layer(lv) && lv_info(lv->vg->cmd, lv, 1, &info, 0, 0) && info.exists && info.suspended) {
+ log_debug("Found suspended layered LV %s in critical section().", display_lvname(lv));
+ return 0; /* There is suspended subLV in the tree */
+ }
+
return 1;
}
@@ -2319,6 +2324,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
const struct logical_volume *lv)
{
const struct logical_volume *lv_to_free = NULL;
+ struct dm_list *snh;
struct lvinfo info;
int r = 0;
@@ -2360,18 +2366,21 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
critical_section_dec(cmd, "resumed");
if (!info.suspended && critical_section()) {
- /* check if any subLV is suspended */
- if ((r = for_each_sub_lv((struct logical_volume *)lv, &_check_suspended_lv, NULL))) {
- /* Everything seems resumed */
- log_debug_activation("LV %s not suspended.", display_lvname(lv));
- goto out;
+ /* Validation check if any subLV is suspended */
+ if (!laopts->origin_only && lv_is_origin(lv)) {
+ /* Check all snapshots for this origin LV */
+ dm_list_iterate(snh, &lv->snapshot_segs)
+ if (!_check_suspended_lv(dm_list_struct_base(snh, struct lv_segment, origin_list)->cow, NULL))
+ goto needs_resume; /* Found suspended snapshot */
}
+ if ((r = for_each_sub_lv((struct logical_volume *)lv, &_check_suspended_lv, NULL)))
+ goto out; /* Nothing was found suspended */
} else {
r = 1;
goto out;
}
}
-
+needs_resume:
laopts->read_only = _passes_readonly_filter(cmd, lv);
laopts->resuming = 1;
6 years, 4 months
master - activation: split priority from memory locking
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c086dfadc389551b9a2...
Commit: c086dfadc389551b9a2d7b4c26931e5e74ada8d6
Parent: c489dd2e1764216de07be80d36b1025fb4f6fc85
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 1 11:50:14 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
activation: split priority from memory locking
When entering any critical section, lvm2 used to lock process memory
and raised task priority to avoid problem with page swapping and minimize
time of having non-resumed devices in table.
With this patch, memory locking which which is expensive is only used when
entering 'suspending' section as only in this section there is risk
lvm could be suspending a device which later can be needed for paging.
Raised priority is still kept for all section entrances as this is
low-cost operation and may accelerate table resumes - although the real
impact can be still considered later.
---
WHATS_NEW | 1 +
lib/mm/memlock.c | 99 ++++++++++++++++++++++++++++++++++++------------------
2 files changed, 67 insertions(+), 33 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 093fc95..8bbe4ee 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ Command will lock memory only when suspending volumes.
Merge segments when pvmove is finished.
Remove label_verify that has never been used.
Ensure very large numbers used as arguments are not casted to lower values.
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 389e213..7edd9de 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -85,6 +85,7 @@ static size_t _size_malloc = 2000000;
static void *_malloc_mem = NULL;
static int _mem_locked = 0;
+static int _priority_raised = 0;
static int _critical_section = 0;
static int _memlock_count_daemon = 0;
static int _priority;
@@ -465,6 +466,38 @@ static int _restore_mmap(void)
#endif /* ARCH_X86 */
return 1;
}
+static void _raise_priority(struct cmd_context *cmd)
+{
+ if (_priority_raised)
+ return;
+
+ _priority_raised = 1;
+ errno = 0;
+ if (((_priority = getpriority(PRIO_PROCESS, 0)) == -1) && errno)
+ log_sys_debug("getpriority", "");
+ else if (_default_priority < _priority) {
+ if (setpriority(PRIO_PROCESS, 0, _default_priority) == 0)
+ log_debug_activation("Raised task priority %d -> %d.",
+ _priority, _default_priority);
+ else
+ log_warn("WARNING: setpriority %d failed: %s.",
+ _default_priority, strerror(errno));
+ }
+}
+
+static void _restore_priority_if_possible(struct cmd_context *cmd)
+{
+ if (!_priority_raised || _critical_section || _memlock_count_daemon)
+ return;
+
+ if (setpriority(PRIO_PROCESS, 0, _priority) == 0)
+ log_debug_activation("Restoring original task priority %d.", _priority);
+ else
+ log_warn("WARNING: setpriority %u failed: %s.",
+ _priority, strerror(errno));
+
+ _priority_raised = 0;
+}
/* Stop memory getting swapped out */
static void _lock_mem(struct cmd_context *cmd)
@@ -502,14 +535,6 @@ static void _lock_mem(struct cmd_context *cmd)
if (!_memlock_maps(cmd, LVM_MLOCK, &_mstats))
stack;
-
- errno = 0;
- if (((_priority = getpriority(PRIO_PROCESS, 0)) == -1) && errno)
- log_sys_error("getpriority", "");
- else
- if (setpriority(PRIO_PROCESS, 0, _default_priority))
- log_error("setpriority %d failed: %s",
- _default_priority, strerror(errno));
}
static void _unlock_mem(struct cmd_context *cmd)
@@ -539,16 +564,15 @@ static void _unlock_mem(struct cmd_context *cmd)
}
}
- if (setpriority(PRIO_PROCESS, 0, _priority))
- log_error("setpriority %u failed: %s", _priority,
- strerror(errno));
+ _restore_priority_if_possible(cmd);
+
_release_memory();
}
static void _lock_mem_if_needed(struct cmd_context *cmd)
{
- log_debug_mem("Lock: Memlock counters: locked:%d critical:%d daemon:%d suspended:%d",
- _mem_locked, _critical_section, _memlock_count_daemon, dm_get_suspended_counter());
+ log_debug_mem("Lock: Memlock counters: prioritized:%d locked:%d critical:%d daemon:%d suspended:%d",
+ _priority_raised, _mem_locked, _critical_section, _memlock_count_daemon, dm_get_suspended_counter());
if (!_mem_locked &&
((_critical_section + _memlock_count_daemon) == 1)) {
_mem_locked = 1;
@@ -558,8 +582,8 @@ static void _lock_mem_if_needed(struct cmd_context *cmd)
static void _unlock_mem_if_possible(struct cmd_context *cmd)
{
- log_debug_mem("Unlock: Memlock counters: locked:%d critical:%d daemon:%d suspended:%d",
- _mem_locked, _critical_section, _memlock_count_daemon, dm_get_suspended_counter());
+ log_debug_mem("Unlock: Memlock counters: prioritized:%d locked:%d critical:%d daemon:%d suspended:%d",
+ _priority_raised, _mem_locked, _critical_section, _memlock_count_daemon, dm_get_suspended_counter());
if (_mem_locked &&
!_critical_section &&
!_memlock_count_daemon) {
@@ -568,29 +592,41 @@ static void _unlock_mem_if_possible(struct cmd_context *cmd)
}
}
+/*
+ * Critical section is only triggered with suspending reason.
+ * Other reasons only raise process priority so the table manipulation
+ * remains fast.
+ *
+ * Memory stays locked until 'memlock_unlock()' is called so when possible
+ * it may stay locked across multiple crictical section entrances.
+ */
void critical_section_inc(struct cmd_context *cmd, const char *reason)
{
- /*
- * Profiles are loaded on-demand so make sure that before
- * entering the critical section all needed profiles are
- * loaded to avoid the disk access later.
- */
- (void) load_pending_profiles(cmd);
-
- if (!_critical_section) {
+ if (!_critical_section && (strcmp(reason, "suspending") == 0)) {
+ /*
+ * Profiles are loaded on-demand so make sure that before
+ * entering the critical section all needed profiles are
+ * loaded to avoid the disk access later.
+ */
+ (void) load_pending_profiles(cmd);
_critical_section = 1;
- log_debug_mem("Entering critical section (%s).", reason);
- }
+ log_debug_activation("Entering critical section (%s).", reason);
+ _lock_mem_if_needed(cmd);
+ } else
+ log_debug_activation("Entering prioritized section (%s).", reason);
- _lock_mem_if_needed(cmd);
+ _raise_priority(cmd);
}
void critical_section_dec(struct cmd_context *cmd, const char *reason)
{
if (_critical_section && !dm_get_suspended_counter()) {
_critical_section = 0;
- log_debug_mem("Leaving critical section (%s).", reason);
- }
+ log_debug_activation("Leaving critical section (%s).", reason);
+ } else
+ log_debug_activation("Leaving section (%s).", reason);
+
+ _restore_priority_if_possible(cmd);
}
int critical_section(void)
@@ -612,6 +648,7 @@ void memlock_inc_daemon(struct cmd_context *cmd)
log_error(INTERNAL_ERROR "_memlock_inc_daemon used in critical section.");
log_debug_mem("memlock_count_daemon inc to %d", _memlock_count_daemon);
_lock_mem_if_needed(cmd);
+ _raise_priority(cmd);
}
void memlock_dec_daemon(struct cmd_context *cmd)
@@ -620,11 +657,6 @@ void memlock_dec_daemon(struct cmd_context *cmd)
log_error(INTERNAL_ERROR "_memlock_count_daemon has dropped below 0.");
--_memlock_count_daemon;
log_debug_mem("memlock_count_daemon dec to %d", _memlock_count_daemon);
- if (!_memlock_count_daemon && _critical_section && _mem_locked) {
- log_error("Unlocking daemon memory in critical section.");
- _unlock_mem(cmd);
- _mem_locked = 0;
- }
_unlock_mem_if_possible(cmd);
}
@@ -641,6 +673,7 @@ void memlock_reset(void)
{
log_debug_mem("memlock reset.");
_mem_locked = 0;
+ _priority_raised = 0;
_critical_section = 0;
_memlock_count_daemon = 0;
}
6 years, 4 months
master - pvmove: add missing segment merging
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c489dd2e1764216de07...
Commit: c489dd2e1764216de07be80d36b1025fb4f6fc85
Parent: fbd8b456dbc963bbc306e5b3c643d0f67d3a2d6c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 29 22:19:46 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
pvmove: add missing segment merging
When pvmove is finished and metadata are updated, the code missed
to merge possible mergable segments - so add explicit merging
call after pvmoved volumes are unlocked.
This avoids weird results where i.e. lvs could have been reporting
non-matching segments as lvs upon metadata read is doing silent segment
merging while dm table left after pvmove was still preserving
non-merged segments.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 32ed3c9..093fc95 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ Merge segments when pvmove is finished.
Remove label_verify that has never been used.
Ensure very large numbers used as arguments are not casted to lower values.
Enhance reading and validation of options stripes and stripes_size.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index d4a4b8b..fb152ac 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6637,6 +6637,8 @@ int remove_layers_for_segments_all(struct cmd_context *cmd,
dm_list_iterate_items(lvl, lvs_changed) {
/* FIXME Assumes only one pvmove at a time! */
lvl->lv->status &= ~LOCKED;
+ if (!lv_merge_segments(lvl->lv))
+ return_0;
}
return 1;
6 years, 4 months
master - pvmove: move code from tools to lib
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fbd8b456dbc963bbc30...
Commit: fbd8b456dbc963bbc306e5b3c643d0f67d3a2d6c
Parent: 94d3878efb7cec344681bf4a2b28774ffebda3ba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 29 22:19:05 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:18:32 2017 +0100
pvmove: move code from tools to lib
Move code manipulating with locking flags into /lib part of lvm.
---
lib/metadata/lv_manip.c | 6 ++++++
tools/pvmove_poll.c | 5 -----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 33a4f7d..d4a4b8b 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6633,6 +6633,12 @@ int remove_layers_for_segments_all(struct cmd_context *cmd,
if (!lv_empty(layer_lv))
return_0;
+ /* Assumes only used by PVMOVE ATM when unlocking LVs */
+ dm_list_iterate_items(lvl, lvs_changed) {
+ /* FIXME Assumes only one pvmove at a time! */
+ lvl->lv->status &= ~LOCKED;
+ }
+
return 1;
}
diff --git a/tools/pvmove_poll.c b/tools/pvmove_poll.c
index f573eb9..e50747c 100644
--- a/tools/pvmove_poll.c
+++ b/tools/pvmove_poll.c
@@ -52,7 +52,6 @@ static int _detach_pvmove_mirror(struct cmd_context *cmd,
{
uint32_t mimage_to_remove = 0;
struct dm_list lvs_completed;
- struct lv_list *lvl;
/* Update metadata to remove mirror segments and break dependencies */
dm_list_init(&lvs_completed);
@@ -67,10 +66,6 @@ static int _detach_pvmove_mirror(struct cmd_context *cmd,
return_0;
}
- dm_list_iterate_items(lvl, &lvs_completed)
- /* FIXME Assumes only one pvmove at a time! */
- lvl->lv->status &= ~LOCKED;
-
return 1;
}
6 years, 4 months