master - vgchange: use NULL 'feature' of lv_info call
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=93fbef1a45948c...
Commit: 93fbef1a45948c1f97fe484b4dd65179afa5051d
Parent: 5b70bdc104991056a9e1c3f97c07b6f0ba3ae998
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 24 10:01:14 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:47 2014 +0200
vgchange: use NULL 'feature' of lv_info call
When NULL is passed for info the call itself
already does the same evaluation.
---
tools/vgchange.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index e817910..350d8a3 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -23,15 +23,13 @@ static int _monitor_lvs_in_vg(struct cmd_context *cmd,
{
struct lv_list *lvl;
struct logical_volume *lv;
- struct lvinfo info;
int r = 1;
dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (!lv_info(cmd, lv, lv_is_thin_pool(lv) ? 1 : 0,
- &info, 0, 0) ||
- !info.exists)
+ NULL, 0, 0))
continue;
/*
* FIXME: Need to consider all cases... PVMOVE, etc
8 years, 6 months
master - vgchange: add sync point
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5b70bdc1049910...
Commit: 5b70bdc104991056a9e1c3f97c07b6f0ba3ae998
Parent: 13c07c685ade35192348a6b60a6c19077976b089
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 23:22:23 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:54:47 2014 +0200
vgchange: add sync point
Before leaving _activate_lvs_in_vg() wait till devices
are active - so we do not print message about active
devices earlier then it really happens for a user.
---
tools/vgchange.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index da0a05d..e817910 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -152,6 +152,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
}
sigint_restore();
+ sync_local_dev_names(vg->cmd); /* Wait until devices are available */
if (expected_count)
log_verbose("%s %d logical volumes in volume group %s",
8 years, 6 months
master - thin and cache: improve conversion validation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=13c07c685ade35...
Commit: 13c07c685ade35192348a6b60a6c19077976b089
Parent: cd3345a5b06ee1626101619f94b346a77295ca03
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 14:15:13 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:53:44 2014 +0200
thin and cache: improve conversion validation
More validations before any thin or cache related conversion begins.
We allow to use and stack:
pool data: cache or raid
pool metadata: raid
pool: linear, striped
cache: linear, striped, raid
thin(extorig): linear, origin, cow, virtual, thin
---
tools/lvconvert.c | 145 +++++++++++++++++++++++++++++------------------------
1 files changed, 79 insertions(+), 66 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 62e560c..57975d1 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2662,30 +2662,48 @@ static int _lvconvert_pool(struct cmd_context *cmd,
return 0;
}
- /*
- * Only linear, striped and raid supported.
- * FIXME Tidy up all these type restrictions.
- */
- if (!lv_is_pool(pool_lv) &&
- (lv_is_external_origin(pool_lv) || lv_is_origin(pool_lv) || lv_is_thin_type(pool_lv) ||
- lv_is_mirror_type(pool_lv) || lv_is_cache_type(pool_lv) || lv_is_virtual(pool_lv) ||
- lv_is_cache_origin(pool_lv) || lv_is_merging_origin(pool_lv) || lv_is_merging_cow(pool_lv))) {
- log_error("Pool data LV %s is of an unsupported type.", display_lvname(pool_lv));
+ if (!lv_is_visible(pool_lv)) {
+ log_error("Can't convert internal LV %s.", display_lvname(pool_lv));
+ return 0;
+ }
+
+ if (lv_is_locked(pool_lv)) {
+ log_error("Can't convert locked LV %s.", display_lvname(pool_lv));
return 0;
}
- if (arg_is_set(cmd, cachepool_ARG) && lv_is_thin_pool(pool_lv)) {
- log_error("--cachepool requires a cache pool. %s is a thin pool.",
+ if (lv_is_thin_pool(pool_lv) && (segtype_is_cache_pool(lp->segtype) || lp->cache)) {
+ log_error("Cannot convert thin pool volume %s as cache pool data volume.",
display_lvname(pool_lv));
return 0;
}
- if (arg_is_set(cmd, thinpool_ARG) && lv_is_cache_pool(pool_lv)) {
- log_error("--thinpool requires a thin pool. %s is a cache pool.",
+ if (lv_is_cache_pool(pool_lv) && (segtype_is_thin_pool(lp->segtype) || lp->thin)) {
+ log_error("Cannot convert cache pool %s as thin pool data volume.",
display_lvname(pool_lv));
return 0;
}
+ if (lv_is_mirror(pool_lv)) {
+ log_error("Mirror logical volumes cannot be used as pools.");
+ log_print_unless_silent("Try \"raid1\" segment type instead.");
+ return 0;
+ }
+
+ /*
+ * Only linear, striped and raid supported.
+ * FIXME Tidy up all these type restrictions.
+ */
+ if (!lv_is_pool(pool_lv) &&
+ (lv_is_thin_type(pool_lv) ||
+ lv_is_cow(pool_lv) || lv_is_merging_cow(pool_lv) ||
+ lv_is_origin(pool_lv) ||lv_is_merging_origin(pool_lv) ||
+ lv_is_external_origin(pool_lv) ||
+ lv_is_virtual(pool_lv))) {
+ log_error("Pool data LV %s is of an unsupported type.", display_lvname(pool_lv));
+ return 0;
+ }
+
if (lp->pool_metadata_lv_name) {
if (!(lp->pool_metadata_lv = find_lv(vg, lp->pool_metadata_lv_name))) {
log_error("Unknown pool metadata LV %s.", lp->pool_metadata_lv_name);
@@ -2694,16 +2712,15 @@ static int _lvconvert_pool(struct cmd_context *cmd,
lp->pool_metadata_size = lp->pool_metadata_lv->size;
metadata_lv = lp->pool_metadata_lv;
- if (!lv_is_visible(metadata_lv)) {
- log_error("Can't convert internal LV %s.",
+ if (metadata_lv == pool_lv) {
+ log_error("Can't use same LV for pool data and metadata LV %s.",
display_lvname(metadata_lv));
return 0;
}
- if (lv_is_mirror(metadata_lv)) {
- log_error("Mirror logical volumes cannot be used "
- "for pool metadata.");
- log_error("Try \"raid1\" segment type instead.");
+ if (!lv_is_visible(metadata_lv)) {
+ log_error("Can't convert internal LV %s.",
+ display_lvname(metadata_lv));
return 0;
}
@@ -2713,24 +2730,19 @@ static int _lvconvert_pool(struct cmd_context *cmd,
return 0;
}
- if (metadata_lv == pool_lv) {
- log_error("Can't use same LV for pool data and metadata LV %s.",
- display_lvname(metadata_lv));
- return 0;
- }
-
- if (lv_is_thin_type(metadata_lv) ||
- lv_is_cache_type(metadata_lv)) {
- log_error("Can't use thin or cache type LV %s for pool metadata.",
- display_lvname(metadata_lv));
+ if (lv_is_mirror(metadata_lv)) {
+ log_error("Mirror logical volumes cannot be used for pool metadata.");
+ log_print_unless_silent("Try \"raid1\" segment type instead.");
return 0;
}
/* FIXME Tidy up all these type restrictions. */
- if (lv_is_external_origin(metadata_lv) || lv_is_virtual(metadata_lv) ||
- lv_is_origin(metadata_lv) || lv_is_thin_origin(metadata_lv, NULL) ||
- lv_is_cache_origin(metadata_lv) || lv_is_cow(metadata_lv) ||
- lv_is_merging_origin(metadata_lv) || lv_is_merging_cow(metadata_lv)) {
+ if (lv_is_cache_type(metadata_lv) ||
+ lv_is_thin_type(metadata_lv) ||
+ lv_is_cow(metadata_lv) || lv_is_merging_cow(metadata_lv) ||
+ lv_is_origin(metadata_lv) || lv_is_merging_origin(metadata_lv) ||
+ lv_is_external_origin(metadata_lv) ||
+ lv_is_virtual(metadata_lv)) {
log_error("Pool metadata LV %s is of an unsupported type.",
display_lvname(metadata_lv));
return 0;
@@ -2748,39 +2760,21 @@ static int _lvconvert_pool(struct cmd_context *cmd,
}
}
- if (!lv_is_visible(pool_lv)) {
- log_error("Can't convert internal LV %s.", display_lvname(pool_lv));
- return 0;
- }
-
- if (lv_is_mirror(pool_lv)) {
- log_error("Mirror logical volumes cannot be used as pools.\n"
- "Try \"raid1\" segment type instead.");
- return 0;
- }
-
- if ((dm_snprintf(metadata_name, sizeof(metadata_name), "%s%s",
- pool_lv->name,
- (segtype_is_cache_pool(lp->segtype)) ?
- "_cmeta" : "_tmeta") < 0) ||
- (dm_snprintf(data_name, sizeof(data_name), "%s%s",
- pool_lv->name,
- (segtype_is_cache_pool(lp->segtype)) ?
- "_cdata" : "_tdata") < 0)) {
- log_error("Failed to create internal lv names, "
- "pool name is too long.");
- return 0;
- }
-
if (lv_is_pool(pool_lv)) {
lp->pool_data_lv = pool_lv;
if (!metadata_lv) {
if (arg_from_list_is_set(cmd, "is invalid with existing pool",
- cachemode_ARG,chunksize_ARG, discards_ARG,
+ cachemode_ARG, chunksize_ARG, discards_ARG,
zero_ARG, poolmetadatasize_ARG, -1))
return_0;
- return 1;
+
+ if (lp->thin || lp->cache)
+ /* already pool, can continue converting volume */
+ return 1;
+
+ log_error("LV %s is already pool.", display_lvname(pool_lv));
+ return 0;
}
if (lp->thin || lp->cache) {
@@ -2841,10 +2835,6 @@ static int _lvconvert_pool(struct cmd_context *cmd,
log_error("Conversion aborted.");
return 0;
}
- } else if (lv_is_thin_type(pool_lv)) {
- log_error("Can't use thin type logical volume %s for thin pool data.",
- display_lvname(pool_lv));
- return 0;
} else {
log_warn("WARNING: Converting logical volume %s%s%s to pool's data%s.",
display_lvname(pool_lv),
@@ -2869,6 +2859,19 @@ static int _lvconvert_pool(struct cmd_context *cmd,
/* Allow to have only thinpool active and restore it's active state */
activate_pool = lv_is_active(pool_lv);
+ if ((dm_snprintf(metadata_name, sizeof(metadata_name), "%s%s",
+ pool_lv->name,
+ (segtype_is_cache_pool(lp->segtype)) ?
+ "_cmeta" : "_tmeta") < 0) ||
+ (dm_snprintf(data_name, sizeof(data_name), "%s%s",
+ pool_lv->name,
+ (segtype_is_cache_pool(lp->segtype)) ?
+ "_cdata" : "_tdata") < 0)) {
+ log_error("Failed to create internal lv names, "
+ "pool name is too long.");
+ return 0;
+ }
+
if (!metadata_lv) {
if (!_lvconvert_update_pool_params(pool_lv, lp))
return_0;
@@ -3068,13 +3071,23 @@ static int _lvconvert_cache(struct cmd_context *cmd,
return 0;
}
+ /* We support conversion of _tdata */
+ if (!lv_is_visible(origin) && !lv_is_thin_pool_data(origin)) {
+ log_error("Can't convert internal LV %s.", display_lvname(origin));
+ return 0;
+ }
+
/*
* Only linear, striped or raid supported.
* FIXME Tidy up all these type restrictions.
*/
- if (lv_is_external_origin(origin) || lv_is_origin(origin) || lv_is_thin_type(origin) ||
- lv_is_mirror_type(origin) || lv_is_cache_origin(origin) || lv_is_virtual(origin) ||
- lv_is_cow(origin) || lv_is_merging_origin(origin) || lv_is_merging_cow(origin)) {
+ if (lv_is_cache_origin(origin) ||
+ lv_is_mirror_type(origin) ||
+ lv_is_thin_volume(origin) || lv_is_thin_pool_metadata(origin) ||
+ lv_is_origin(origin) || lv_is_merging_origin(origin) ||
+ lv_is_cow(origin) || lv_is_merging_cow(origin) ||
+ lv_is_external_origin(origin) ||
+ lv_is_virtual(origin)) {
log_error("Cache is not supported with origin LV %s type.",
display_lvname(origin));
return 0;
8 years, 6 months
master - thin: no pool can be used for external origins
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cd3345a5b06ee1...
Commit: cd3345a5b06ee1626101619f94b346a77295ca03
Parent: a84d0d0c7b843168516a940a8bc4debafc5f980c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 14:09:55 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:52:02 2014 +0200
thin: no pool can be used for external origins
Cache pool can't be external origin either.
For simplicity use vg from passed LV.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 39282c2..a94edc6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Pools cannot be used as external origin.
Use lv_update_and_reload() for snapshot reload.
Don't print message in adjusted_mirror_region_size() in activation.
Improve lv_update_and_reload() to find out proper lock holding LV.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e501978..62e560c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2511,7 +2511,7 @@ static int _lvconvert_thin(struct cmd_context *cmd,
struct lvconvert_params *lp)
{
struct logical_volume *torigin_lv, *pool_lv = lp->pool_data_lv;
- struct volume_group *vg = pool_lv->vg;
+ struct volume_group *vg = lv->vg;
struct lvcreate_params lvc = {
.activate = CHANGE_AEY,
.alloc = ALLOC_INHERIT,
@@ -2533,7 +2533,7 @@ static int _lvconvert_thin(struct cmd_context *cmd,
return 0;
}
- if (lv_is_thin_pool(lv)) {
+ if (lv_is_pool(lv)) {
log_error("Can't use pool %s as external origin.",
display_lvname(lv));
return 0;
8 years, 6 months
master - snapshot: use lv_update_and_reload
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a84d0d0c7b8431...
Commit: a84d0d0c7b843168516a940a8bc4debafc5f980c
Parent: 29970b0c177d14dd041f0564a9bdcd0c3429a885
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 01:10:53 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:51:15 2014 +0200
snapshot: use lv_update_and_reload
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 18 ++----------------
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7f37f24..39282c2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Use lv_update_and_reload() for snapshot reload.
Don't print message in adjusted_mirror_region_size() in activation.
Improve lv_update_and_reload() to find out proper lock holding LV.
Improve search of LV in lv_ondisk().
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 14000b8..81cc997 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7124,22 +7124,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
/* store vg on disk(s) */
- if (!vg_write(vg))
- return_NULL;
-
- if (!suspend_lv(cmd, org)) {
- log_error("Failed to suspend origin %s", org->name);
- vg_revert(vg);
- return NULL;
- }
-
- if (!vg_commit(vg))
- return_NULL;
-
- if (!resume_lv(cmd, org)) {
- log_error("Problem reactivating origin %s", org->name);
- return NULL;
- }
+ if (!lv_update_and_reload(org))
+ return_0;
}
/* FIXME out of sequence */
backup(vg);
8 years, 6 months
master - snapshot: add missing vg_revert
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=29970b0c177d14...
Commit: 29970b0c177d14dd041f0564a9bdcd0c3429a885
Parent: 736f40134b5a9bcc0335a8054d1838129952a5fc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 01:10:06 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:50:29 2014 +0200
snapshot: add missing vg_revert
Error path missed vg_revert call.
---
WHATS_NEW | 2 +-
lib/metadata/snapshot_manip.c | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b0766a0..7f37f24 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -24,7 +24,7 @@ Version 2.02.112 -
Don't leak alloc_handle on raid target error path.
Properly validate raid leg names.
Archive metadata before starting their modification in raid target.
- Add missing vg_revert in suspend_lv() error path in raid target.
+ Add missing vg_revert() in suspend_lv() raid and snapshot error path.
Add missing backup of lvm2 metadata after some raid modifications.
Use vg memory pool for extent allocation.
Add allocation/physical_extent_size config option for default PE size of VGs.
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 36a685f..a52b00c 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -325,6 +325,7 @@ int vg_remove_snapshot(struct logical_volume *cow)
if (is_origin_active && !suspend_lv(origin->vg->cmd, origin)) {
log_error("Failed to refresh %s without snapshot.",
origin->name);
+ vg_revert(origin->vg);
return 0;
}
if (!vg_commit(origin->vg))
8 years, 6 months
master - mirror: extend adjusted_mirror_region_size API
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=736f40134b5a9b...
Commit: 736f40134b5a9bcc0335a8054d1838129952a5fc
Parent: fa6482344c9f2491d29008b00ac1a4089c883aa7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 15:54:33 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:48:02 2014 +0200
mirror: extend adjusted_mirror_region_size API
We use adjusted_mirror_region_size() in two different contexts.
Either on command line -
here we do want to inform user about reduction of size.
Or in pvmove activation context -
here we should only use 'verbose' info.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 2 +-
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/mirror.c | 14 ++++++++++----
lib/mirror/mirrored.c | 2 +-
tools/lvconvert.c | 4 ++--
6 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index dafa16f..b0766a0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Don't print message in adjusted_mirror_region_size() in activation.
Improve lv_update_and_reload() to find out proper lock holding LV.
Improve search of LV in lv_ondisk().
Do not scan sysfs in lv_check_not_in_use() when device is closed.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 277662e..14000b8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6849,7 +6849,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lp->region_size = adjusted_mirror_region_size(vg->extent_size,
lp->extents,
- lp->region_size);
+ lp->region_size, 0);
}
if (!(lv = lv_create_empty(new_lv_name ? : "lvol%d", NULL,
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0fa6c97..4993c22 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1000,7 +1000,7 @@ int is_temporary_mirror_layer(const struct logical_volume *lv);
struct logical_volume * find_temporary_mirror(const struct logical_volume *lv);
uint32_t lv_mirror_count(const struct logical_volume *lv);
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
- uint32_t region_size);
+ uint32_t region_size, int internal);
int remove_mirrors_from_segments(struct logical_volume *lv,
uint32_t new_mirrors, uint64_t status_mask);
int add_mirrors_to_segments(struct cmd_context *cmd, struct logical_volume *lv,
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 0fc9314..1206a1c 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -156,9 +156,11 @@ struct lv_segment *find_mirror_seg(struct lv_segment *seg)
/*
* Reduce the region size if necessary to ensure
* the volume size is a multiple of the region size.
+ *
+ * For internal use only log only in verbose mode
*/
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
- uint32_t region_size)
+ uint32_t region_size, int internal)
{
uint64_t region_max;
@@ -166,8 +168,12 @@ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
if (region_max < UINT32_MAX && region_size > region_max) {
region_size = (uint32_t) region_max;
- log_print_unless_silent("Using reduced mirror region size of %" PRIu32
- " sectors", region_size);
+ if (!internal)
+ log_print_unless_silent("Using reduced mirror region size of %"
+ PRIu32 " sectors.", region_size);
+ else
+ log_verbose("Using reduced mirror region size of %"
+ PRIu32 " sectors.", region_size);
}
return region_size;
@@ -1697,7 +1703,7 @@ static int _add_mirrors_that_preserve_segments(struct logical_volume *lv,
adjusted_region_size = adjusted_mirror_region_size(lv->vg->extent_size,
lv->le_count,
- region_size);
+ region_size, 1);
if (!(ah = allocate_extents(lv->vg, NULL, segtype, 1, mirrors, 0, 0,
lv->le_count, allocatable_pvs, alloc, 0,
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 74a8e37..411b4d4 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -440,7 +440,7 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
} else
region_size = adjusted_mirror_region_size(seg->lv->vg->extent_size,
seg->area_len,
- mirr_state->default_region_size);
+ mirr_state->default_region_size, 1);
if (!dm_tree_node_add_mirror_target(node, len))
return_0;
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6a2676b..e501978 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1155,7 +1155,7 @@ static int _lv_update_log_type(struct cmd_context *cmd,
if (old_log_count < log_count) {
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
lv->le_count,
- region_size);
+ region_size, 0);
if (!add_mirror_log(cmd, original_lv, log_count,
region_size, operable_pvs, alloc))
@@ -1386,7 +1386,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
lv->le_count,
- lp->region_size);
+ lp->region_size, 0);
if (!operable_pvs)
operable_pvs = lp->pvh;
8 years, 6 months
master - lv_update_and_reload: use proper lock holder
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fa6482344c9f24...
Commit: fa6482344c9f2491d29008b00ac1a4089c883aa7
Parent: 9776979b02ddd6405e13208a74fedfee0e1cfec3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 22 13:57:47 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:48:02 2014 +0200
lv_update_and_reload: use proper lock holder
When requesting to reload an LV imrove this API to
automatically reload its lock holding LV as in cluster
only top-level LVs are addressable with lock.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 13 +++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9869130..dafa16f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Improve lv_update_and_reload() to find out proper lock holding LV.
Improve search of LV in lv_ondisk().
Do not scan sysfs in lv_check_not_in_use() when device is closed.
Backup final metadata after resync of mirror/raid.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 968b8d0..277662e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5701,16 +5701,17 @@ static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
{
struct volume_group *vg = lv->vg;
int do_backup = 0, r = 0;
+ const struct logical_volume *lock_lv = lv_lock_holder(lv);
log_very_verbose("Updating logical volume %s on disk(s).",
- display_lvname(lv));
+ display_lvname(lock_lv));
if (!vg_write(vg))
return_0;
- if (!(origin_only ? suspend_lv_origin(vg->cmd, lv) : suspend_lv(vg->cmd, lv))) {
+ if (!(origin_only ? suspend_lv_origin(vg->cmd, lock_lv) : suspend_lv(vg->cmd, lock_lv))) {
log_error("Failed to lock logical volume %s.",
- display_lvname(lv));
+ display_lvname(lock_lv));
vg_revert(vg);
} else if (!(r = vg_commit(vg)))
stack; /* !vg_commit() has implict vg_revert() */
@@ -5718,11 +5719,11 @@ static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
do_backup = 1;
log_very_verbose("Updating logical volume %s in kernel.",
- display_lvname(lv));
+ display_lvname(lock_lv));
- if (!(origin_only ? resume_lv_origin(vg->cmd, lv) : resume_lv(vg->cmd, lv))) {
+ if (!(origin_only ? resume_lv_origin(vg->cmd, lock_lv) : resume_lv(vg->cmd, lock_lv))) {
log_error("Problem reactivating logical volume %s.",
- display_lvname(lv));
+ display_lvname(lock_lv));
r = 0;
}
8 years, 6 months
master - lv_ondisk: option search for lv without vg_ondisk
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9776979b02ddd6...
Commit: 9776979b02ddd6405e13208a74fedfee0e1cfec3
Parent: 0f2adcc9efc8621fa5cf3a1871f2294fa7da7f1f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 23:10:04 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:48:01 2014 +0200
lv_ondisk: option search for lv without vg_ondisk
When vg_ondisk is NULL we do not need to search
through the whole VG to find out the same LV.
NOTE: as of now - VG locking is not enabled as some code parts
are breaking memory locking rules (lvm2app).
Once we enforce VG locking for read-only commands the effect
will be much better for larger VGs.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b4ee934..9869130 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Improve search of LV in lv_ondisk().
Do not scan sysfs in lv_check_not_in_use() when device is closed.
Backup final metadata after resync of mirror/raid.
Unify handling of --persistent option for lvcreate and lvchange.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 0842563..464b8bc 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4813,10 +4813,10 @@ struct logical_volume *lv_ondisk(struct logical_volume *lv)
if (!lv)
return NULL;
- vg = lv->vg;
+ if (!lv->vg->vg_ondisk)
+ return lv;
- if (vg->vg_ondisk)
- vg = vg->vg_ondisk;
+ vg = lv->vg->vg_ondisk;
dm_list_iterate_items(lvl, &vg->lvs)
if (!strncmp(lvl->lv->lvid.s, lv->lvid.s, sizeof(lv->lvid)))
8 years, 6 months
master - activate: lv_check_not_in_use no check of closed
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0f2adcc9efc862...
Commit: 0f2adcc9efc8621fa5cf3a1871f2294fa7da7f1f
Parent: 392bb6f46eb73dcf725566fbdf006a4e02ae7502
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 21 23:07:02 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 24 10:47:00 2014 +0200
activate: lv_check_not_in_use no check of closed
Don't perform expensive sysfs tests when the device is closed.
(having open_count == 0).
---
WHATS_NEW | 1 +
lib/activate/activate.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c5ba9fa..b4ee934 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Do not scan sysfs in lv_check_not_in_use() when device is closed.
Backup final metadata after resync of mirror/raid.
Unify handling of --persistent option for lvcreate and lvchange.
Validate major and minor numbers stored in metadata.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 2091fa1..7f3a711 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -700,7 +700,7 @@ int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv,
{
unsigned int open_count_check_retries;
- if (!info->exists)
+ if (!info->exists || !info->open_count)
return 1;
/* If sysfs is not used, use open_count information only. */
8 years, 6 months