master - cleanup: drop unneeded assigns
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5a32d2c1d95e5c...
Commit: 5a32d2c1d95e5cdd1849fc979353a81edf972878
Parent: 032cf8ade6904df38b25453d94169ae17fac003a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 8 13:14:43 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:35:07 2016 +0100
cleanup: drop unneeded assigns
---
tools/lvresize.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/lvresize.c b/tools/lvresize.c
index d1c20b6..af6ce07 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -168,7 +168,7 @@ static int _lvresize_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, struct processing_handle *handle)
{
struct lvresize_params *lp = (struct lvresize_params *) handle->custom_handle;
- struct dm_list *pvh = NULL;
+ struct dm_list *pvh;
struct logical_volume *lv;
int ret = ECMD_FAILED;
@@ -197,7 +197,7 @@ out:
int lvresize(struct cmd_context *cmd, int argc, char **argv)
{
- struct processing_handle *handle = NULL;
+ struct processing_handle *handle;
struct lvresize_params lp = { 0 };
int ret = ECMD_FAILED;
@@ -215,5 +215,6 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
&_lvresize_single);
destroy_processing_handle(cmd, handle);
+
return ret;
}
8 years, 1 month
master - cleanup: relocate function to vg.c
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=032cf8ade6904d...
Commit: 032cf8ade6904df38b25453d94169ae17fac003a
Parent: acf7815acaceb32133bcdf8160260622c2df2f82
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 8 12:53:54 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:35:06 2016 +0100
cleanup: relocate function to vg.c
---
lib/metadata/lv.c | 92 +++++++++++++++++++++++++++++++
lib/metadata/lv_manip.c | 137 -----------------------------------------------
lib/metadata/vg.c | 45 +++++++++++++++
3 files changed, 137 insertions(+), 137 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 9f745ca..c4e3437 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -347,6 +347,98 @@ uint32_t lv_kernel_read_ahead(const struct logical_volume *lv)
return info.read_ahead;
}
+struct pv_and_int {
+ struct physical_volume *pv;
+ int *i;
+};
+
+static int _lv_is_on_pv(struct logical_volume *lv, void *data)
+{
+ int *is_on_pv = ((struct pv_and_int *)data)->i;
+ struct physical_volume *pv = ((struct pv_and_int *)data)->pv;
+ uint32_t s;
+ struct physical_volume *pv2;
+ struct lv_segment *seg;
+
+ if (!lv || !(first_seg(lv)))
+ return_0;
+
+ /*
+ * If the LV has already been found to be on the PV, then
+ * we don't need to continue checking - just return.
+ */
+ if (*is_on_pv)
+ return 1;
+
+ dm_list_iterate_items(seg, &lv->segments) {
+ for (s = 0; s < seg->area_count; s++) {
+ if (seg_type(seg, s) != AREA_PV)
+ continue;
+
+ pv2 = seg_pv(seg, s);
+ if (id_equal(&pv->id, &pv2->id)) {
+ *is_on_pv = 1;
+ return 1;
+ }
+ if (pv->dev && pv2->dev &&
+ (pv->dev->dev == pv2->dev->dev)) {
+ *is_on_pv = 1;
+ return 1;
+ }
+ }
+ }
+
+ return 1;
+}
+
+/*
+ * lv_is_on_pv
+ * @lv:
+ * @pv:
+ *
+ * If any of the component devices of the LV are on the given PV, 1
+ * is returned; otherwise 0. For example if one of the images of a RAID
+ * (or its metadata device) is on the PV, 1 would be returned for the
+ * top-level LV.
+ * If you wish to check the images themselves, you should pass them.
+ *
+ * Returns: 1 if LV (or part of LV) is on PV, 0 otherwise
+ */
+int lv_is_on_pv(struct logical_volume *lv, struct physical_volume *pv)
+{
+ int is_on_pv = 0;
+ struct pv_and_int context = { pv, &is_on_pv };
+
+ if (!_lv_is_on_pv(lv, &context) ||
+ !for_each_sub_lv(lv, _lv_is_on_pv, &context))
+ /* Failure only happens if bad arguments are passed */
+ log_error(INTERNAL_ERROR "for_each_sub_lv failure.");
+
+ log_debug_metadata("%s is %son %s", lv->name,
+ is_on_pv ? "" : "not ", pv_dev_name(pv));
+ return is_on_pv;
+}
+
+/*
+ * lv_is_on_pvs
+ * @lv
+ * @pvs
+ *
+ * Returns 1 if the LV (or part of the LV) is on any of the pvs
+ * in the list, 0 otherwise.
+ */
+int lv_is_on_pvs(struct logical_volume *lv, struct dm_list *pvs)
+{
+ struct pv_list *pvl;
+
+ dm_list_iterate_items(pvl, pvs)
+ if (lv_is_on_pv(lv, pvl->pv))
+ return 1;
+
+ return 0;
+}
+
+
struct logical_volume *lv_origin_lv(const struct logical_volume *lv)
{
struct logical_volume *origin = NULL;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 6c6a03c..d5105e1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -82,11 +82,6 @@ struct lv_names {
const char *new;
};
-struct pv_and_int {
- struct physical_volume *pv;
- int *i;
-};
-
enum {
LV_TYPE_UNKNOWN,
LV_TYPE_PUBLIC,
@@ -569,93 +564,6 @@ bad:
return 0;
}
-
-static int _lv_is_on_pv(struct logical_volume *lv, void *data)
-{
- int *is_on_pv = ((struct pv_and_int *)data)->i;
- struct physical_volume *pv = ((struct pv_and_int *)data)->pv;
- uint32_t s;
- struct physical_volume *pv2;
- struct lv_segment *seg;
-
- if (!lv || !(first_seg(lv)))
- return_0;
-
- /*
- * If the LV has already been found to be on the PV, then
- * we don't need to continue checking - just return.
- */
- if (*is_on_pv)
- return 1;
-
- dm_list_iterate_items(seg, &lv->segments) {
- for (s = 0; s < seg->area_count; s++) {
- if (seg_type(seg, s) != AREA_PV)
- continue;
-
- pv2 = seg_pv(seg, s);
- if (id_equal(&pv->id, &pv2->id)) {
- *is_on_pv = 1;
- return 1;
- }
- if (pv->dev && pv2->dev &&
- (pv->dev->dev == pv2->dev->dev)) {
- *is_on_pv = 1;
- return 1;
- }
- }
- }
-
- return 1;
-}
-
-/*
- * lv_is_on_pv
- * @lv:
- * @pv:
- *
- * If any of the component devices of the LV are on the given PV, 1
- * is returned; otherwise 0. For example if one of the images of a RAID
- * (or its metadata device) is on the PV, 1 would be returned for the
- * top-level LV.
- * If you wish to check the images themselves, you should pass them.
- *
- * Returns: 1 if LV (or part of LV) is on PV, 0 otherwise
- */
-int lv_is_on_pv(struct logical_volume *lv, struct physical_volume *pv)
-{
- int is_on_pv = 0;
- struct pv_and_int context = { pv, &is_on_pv };
-
- if (!_lv_is_on_pv(lv, &context) ||
- !for_each_sub_lv(lv, _lv_is_on_pv, &context))
- /* Failure only happens if bad arguments are passed */
- log_error(INTERNAL_ERROR "for_each_sub_lv failure.");
-
- log_debug_metadata("%s is %son %s", lv->name,
- is_on_pv ? "" : "not ", pv_dev_name(pv));
- return is_on_pv;
-}
-
-/*
- * lv_is_on_pvs
- * @lv
- * @pvs
- *
- * Returns 1 if the LV (or part of the LV) is on any of the pvs
- * in the list, 0 otherwise.
- */
-int lv_is_on_pvs(struct logical_volume *lv, struct dm_list *pvs)
-{
- struct pv_list *pvl;
-
- dm_list_iterate_items(pvl, pvs)
- if (lv_is_on_pv(lv, pvl->pv))
- return 1;
-
- return 0;
-}
-
struct dm_list_and_mempool {
struct dm_list *list;
struct dm_pool *mem;
@@ -5395,20 +5303,6 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
return buffer;
}
-int vg_max_lv_reached(struct volume_group *vg)
-{
- if (!vg->max_lv)
- return 0;
-
- if (vg->max_lv > vg_visible_lvs(vg))
- return 0;
-
- log_verbose("Maximum number of logical volumes (%u) reached "
- "in volume group %s", vg->max_lv, vg->name);
-
- return 1;
-}
-
struct logical_volume *alloc_lv(struct dm_pool *mem)
{
struct logical_volume *lv;
@@ -5598,37 +5492,6 @@ struct dm_list *build_parallel_areas_from_lv(struct logical_volume *lv,
return parallel_areas;
}
-int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv)
-{
- struct lv_list *lvl;
-
- if (vg_max_lv_reached(vg))
- stack;
-
- if (!(lvl = dm_pool_zalloc(vg->vgmem, sizeof(*lvl))))
- return_0;
-
- lvl->lv = lv;
- lv->vg = vg;
- dm_list_add(&vg->lvs, &lvl->list);
- lv->status &= ~LV_REMOVED;
-
- return 1;
-}
-
-int unlink_lv_from_vg(struct logical_volume *lv)
-{
- struct lv_list *lvl;
-
- if (!(lvl = find_lv_in_vg(lv->vg, lv->name)))
- return_0;
-
- dm_list_move(&lv->vg->removed_lvs, &lvl->list);
- lv->status |= LV_REMOVED;
-
- return 1;
-}
-
void lv_set_visible(struct logical_volume *lv)
{
if (lv_is_visible(lv))
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index f1005e7..59af13e 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -117,6 +117,51 @@ void free_orphan_vg(struct volume_group *vg)
_free_vg(vg);
}
+int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv)
+{
+ struct lv_list *lvl;
+
+ if (vg_max_lv_reached(vg))
+ stack;
+
+ if (!(lvl = dm_pool_zalloc(vg->vgmem, sizeof(*lvl))))
+ return_0;
+
+ lvl->lv = lv;
+ lv->vg = vg;
+ dm_list_add(&vg->lvs, &lvl->list);
+ lv->status &= ~LV_REMOVED;
+
+ return 1;
+}
+
+int unlink_lv_from_vg(struct logical_volume *lv)
+{
+ struct lv_list *lvl;
+
+ if (!(lvl = find_lv_in_vg(lv->vg, lv->name)))
+ return_0;
+
+ dm_list_move(&lv->vg->removed_lvs, &lvl->list);
+ lv->status |= LV_REMOVED;
+
+ return 1;
+}
+
+int vg_max_lv_reached(struct volume_group *vg)
+{
+ if (!vg->max_lv)
+ return 0;
+
+ if (vg->max_lv > vg_visible_lvs(vg))
+ return 0;
+
+ log_verbose("Maximum number of logical volumes (%u) reached "
+ "in volume group %s", vg->max_lv, vg->name);
+
+ return 1;
+}
+
char *vg_fmt_dup(const struct volume_group *vg)
{
if (!vg->fid || !vg->fid->fmt)
8 years, 1 month
master - cleanup: stripes_extents
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=acf7815acaceb3...
Commit: acf7815acaceb32133bcdf8160260622c2df2f82
Parent: 740d27f9fea2596d0f4bcf32c07cd72bad798537
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jan 22 16:11:29 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:35:06 2016 +0100
cleanup: stripes_extents
Simplify calculation of extents rounding needed for
segment size.
Segment size has to divisible by 'extent count' needed to contain
whole stripe. LVM currently does not support stripes across segment.
In case the stripe size is bigger then extent size,
require bigger rounding.
---
lib/metadata/lv_manip.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 1e1d1b4..6c6a03c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4822,7 +4822,7 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
uint32_t seg_logical_extents;
uint32_t seg_physical_extents;
uint32_t area_multiple;
- uint32_t stripesize_extents;
+ uint32_t stripes_extents;
uint32_t size_rest;
uint32_t existing_logical_extents = lv->le_count;
uint32_t existing_physical_extents, saved_existing_physical_extents;
@@ -5053,22 +5053,24 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
return 0;
}
- if (!(stripesize_extents = lp->stripe_size / vg->extent_size))
- stripesize_extents = 1;
+ /* Segment size in extents must be divisible by stripes */
+ stripes_extents = lp->stripes;
+ if (lp->stripe_size > vg->extent_size)
+ /* Strip size is bigger then extent size needs more extents */
+ stripes_extents *= (lp->stripe_size / vg->extent_size);
- size_rest = seg_size % (lp->stripes * stripesize_extents);
+ size_rest = seg_size % stripes_extents;
/* Round toward the original size. */
if (size_rest &&
((lp->extents < existing_logical_extents) ||
!lp->percent ||
(vg->free_count >= (lp->extents - existing_logical_extents - size_rest +
- (lp->stripes * stripesize_extents))))) {
+ stripes_extents)))) {
log_print_unless_silent("Rounding size (%d extents) up to stripe "
"boundary size for segment (%d extents)",
- lp->extents, lp->extents - size_rest +
- (lp->stripes * stripesize_extents));
- lp->extents = lp->extents - size_rest +
- (lp->stripes * stripesize_extents);
+ lp->extents,
+ lp->extents - size_rest + stripes_extents);
+ lp->extents = lp->extents - size_rest + stripes_extents;
} else if (size_rest) {
log_print_unless_silent("Rounding size (%d extents) down to stripe "
"boundary size for segment (%d extents)",
8 years, 1 month
master - cleanup: rename usepolicies
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=740d27f9fea259...
Commit: 740d27f9fea2596d0f4bcf32c07cd72bad798537
Parent: 3f916e8285a8f164927a68082ac6dc759d6720a0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 8 13:09:37 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:35:06 2016 +0100
cleanup: rename usepolicies
Switch to ARG name without '_' in the middle (like all others args).
---
tools/args.h | 2 +-
tools/commands.h | 6 +++---
tools/lvconvert.c | 14 +++++++-------
tools/lvresize.c | 4 ++--
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index 991d250..68de524 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -123,7 +123,7 @@ arg(cachesettings_ARG, '\0', "cachesettings", string_arg, ARG_GROUPABLE)
arg(unconfigured_ARG, '\0', "unconfigured", NULL, 0)
arg(units_ARG, '\0', "units", string_arg, 0)
arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
-arg(use_policies_ARG, '\0', "usepolicies", NULL, 0)
+arg(usepolicies_ARG, '\0', "usepolicies", NULL, 0)
arg(validate_ARG, '\0', "validate", NULL, 0)
arg(version_ARG, '\0', "version", NULL, 0)
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index 651852d..0748568 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -294,7 +294,7 @@ xx(lvconvert,
repair_ARG, replace_ARG, snapshot_ARG,
split_ARG, splitcache_ARG, splitmirrors_ARG, splitsnapshot_ARG,
stripes_long_ARG, stripesize_ARG, test_ARG, thin_ARG, thinpool_ARG,
- trackchanges_ARG, type_ARG, uncache_ARG, use_policies_ARG, zero_ARG)
+ trackchanges_ARG, type_ARG, uncache_ARG, usepolicies_ARG, zero_ARG)
xx(lvcreate,
"Create a logical volume",
@@ -480,8 +480,8 @@ xx(lvextend,
alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, mirrors_ARG,
nofsck_ARG, nosync_ARG, noudevsync_ARG, poolmetadatasize_ARG,
- resizefs_ARG, size_ARG, stripes_ARG,
- stripesize_ARG, test_ARG, type_ARG, use_policies_ARG)
+ resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG,
+ test_ARG, type_ARG, usepolicies_ARG)
xx(lvmchange,
"With the device mapper, this is obsolete and does nothing.",
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e2b91fa..4e6d91b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -387,7 +387,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (arg_count(cmd, repair_ARG) &&
arg_outside_list_is_set(cmd, "cannot be used with --repair",
repair_ARG,
- alloc_ARG, use_policies_ARG,
+ alloc_ARG, usepolicies_ARG,
stripes_long_ARG, stripesize_ARG,
force_ARG, noudevsync_ARG, test_ARG,
-1))
@@ -953,7 +953,7 @@ static void _lvconvert_mirrors_repair_ask(struct cmd_context *cmd,
int force = arg_count(cmd, force_ARG);
int yes = arg_count(cmd, yes_ARG);
- if (arg_count(cmd, use_policies_ARG)) {
+ if (arg_count(cmd, usepolicies_ARG)) {
leg_policy = find_config_tree_str(cmd, activation_mirror_image_fault_policy_CFG, NULL);
log_policy = find_config_tree_str(cmd, activation_mirror_log_fault_policy_CFG, NULL);
*replace_mirrors = strcmp(leg_policy, "remove");
@@ -1686,7 +1686,7 @@ static void _lvconvert_raid_repair_ask(struct cmd_context *cmd,
*replace_dev = 1;
- if (arg_count(cmd, use_policies_ARG)) {
+ if (arg_count(cmd, usepolicies_ARG)) {
dev_policy = find_config_tree_str(cmd, activation_raid_fault_policy_CFG, NULL);
if (!strcmp(dev_policy, "allocate") ||
@@ -1822,7 +1822,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
}
/* "warn" if policy not set to replace */
- if (arg_count(cmd, use_policies_ARG))
+ if (arg_count(cmd, usepolicies_ARG))
log_warn("Use 'lvconvert --repair %s/%s' to replace "
"failed device.", lv->vg->name, lv->name);
return 1;
@@ -3286,7 +3286,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_PROCESSED;
}
if (!lv_is_mirrored(lv) && !lv_is_raid(lv)) {
- if (arg_count(cmd, use_policies_ARG))
+ if (arg_count(cmd, usepolicies_ARG))
return ECMD_PROCESSED; /* nothing to be done here */
log_error("Can't repair LV \"%s\" of segtype %s.",
lv->name, lvseg_name(first_seg(lv)));
@@ -3345,7 +3345,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return_ECMD_FAILED;
/* If repairing and using policies, remove missing PVs from VG */
- if (arg_count(cmd, repair_ARG) && arg_count(cmd, use_policies_ARG))
+ if (arg_count(cmd, repair_ARG) && arg_count(cmd, usepolicies_ARG))
_remove_missing_empty_pv(lv->vg, failed_pvs);
} else if (arg_count(cmd, mirrors_ARG) ||
arg_count(cmd, splitmirrors_ARG) ||
@@ -3360,7 +3360,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return_ECMD_FAILED;
/* If repairing and using policies, remove missing PVs from VG */
- if (arg_count(cmd, repair_ARG) && arg_count(cmd, use_policies_ARG))
+ if (arg_count(cmd, repair_ARG) && arg_count(cmd, usepolicies_ARG))
_remove_missing_empty_pv(lv->vg, failed_pvs);
}
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 602cbb8..d1c20b6 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -20,7 +20,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
{
const char *cmd_name;
char *st;
- int use_policy = arg_count(cmd, use_policies_ARG);
+ int use_policy = arg_count(cmd, usepolicies_ARG);
lp->sign = SIGN_NONE;
lp->poolmetadatasign = SIGN_NONE;
@@ -124,7 +124,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
lp->argc = argc;
lp->argv = argv;
- lp->ac_policy = arg_count(cmd, use_policies_ARG);
+ lp->ac_policy = arg_count(cmd, usepolicies_ARG);
lp->ac_stripes = arg_count(cmd, stripes_ARG);
if (lp->ac_stripes) {
lp->ac_stripes_value = arg_uint_value(cmd, stripes_ARG, 1);
8 years, 1 month
master - lvresize: check for given parameters
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3f916e8285a8f1...
Commit: 3f916e8285a8f164927a68082ac6dc759d6720a0
Parent: 0baf66a992fbac92fa2c30e9bb8e74a5535ff45a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jan 22 13:08:13 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:35:06 2016 +0100
lvresize: check for given parameters
Check ac_ value as passed args.
Also drop reseting 'computed' values - since they get
assigned values later.
---
lib/metadata/lv_manip.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f339d9e..1e1d1b4 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4974,11 +4974,9 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
}
}
} else { /* If reducing, find stripes, stripesize & size of last segment */
- if (lp->stripes || lp->stripe_size || lp->mirrors) {
- lp->stripes = lp->stripe_size = lp->mirrors = 0;
+ if (lp->ac_stripes || lp->ac_stripesize || lp->ac_mirrors)
log_print_unless_silent("Ignoring stripes, stripesize and mirrors "
"arguments when reducing.");
- }
if (lp->sign == SIGN_MINUS) {
if (lp->extents >= existing_extents) {
8 years, 1 month
master - dm: alloc always 8byte aligned
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0baf66a992fbac...
Commit: 0baf66a992fbac92fa2c30e9bb8e74a5535ff45a
Parent: f91622741f95713539b863338743eb217e0731c2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 11 12:00:28 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:35:05 2016 +0100
dm: alloc always 8byte aligned
Fixing regression caused by 197b5e6dc7dd8ec161ebe43c97fd2ac8384b3433.
So the 'TODO' part now finally know the answer - there is 'sparc64'
architecture which imposes limitation to read 64b words only through
64b aligned address.
Since we never could know how is the user going to use the returned
pointer and the userusually expects it's aligned on the highest CPU
required alignement, preserve it also for char*.
Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809685
Reported-by: Anatoly Pugachev <matorola(a)gmail.com>
---
WHATS_NEW_DM | 1 +
libdm/mm/pool.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index f54868f..693667b 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.116 -
====================================
+ Use fully aligned allocations for dm_pool_strdup/strndup() (1.02.64).
Fix thin-pool table parameter feature order to match kernel output.
Version 1.02.115 - 25th January 2016
diff --git a/libdm/mm/pool.c b/libdm/mm/pool.c
index ec6f1b8..c1cb61e 100644
--- a/libdm/mm/pool.c
+++ b/libdm/mm/pool.c
@@ -48,17 +48,18 @@ static size_t pagesize_mask = 0;
char *dm_pool_strdup(struct dm_pool *p, const char *str)
{
- char *ret = dm_pool_alloc_aligned(p, strlen(str) + 1, 2);
+ size_t len = strlen(str) + 1;
+ char *ret = dm_pool_alloc(p, len);
if (ret)
- strcpy(ret, str);
+ memcpy(ret, str, len);
return ret;
}
char *dm_pool_strndup(struct dm_pool *p, const char *str, size_t n)
{
- char *ret = dm_pool_alloc_aligned(p, n + 1, 2);
+ char *ret = dm_pool_alloc(p, n + 1);
if (ret) {
strncpy(ret, str, n);
8 years, 1 month
master - dm: fix thin-pool targer params order
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f91622741f9571...
Commit: f91622741f95713539b863338743eb217e0731c2
Parent: e32e793c43280c898ff6b20d22488af568825287
Author: M.H. Tsai <mingnus(a)gmail.com>
AuthorDate: Wed Jan 27 19:11:03 2016 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:32:24 2016 +0100
dm: fix thin-pool targer params order
Wrong thin-pool feature flag ordering in dm table: It will lead to
unnecessary table reload.
Fix it by placeing feature flags in order they are returned from the
kernel so current 'table line diff' code will not see a difference.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 2fb1274..f54868f 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.116 -
====================================
+ Fix thin-pool table parameter feature order to match kernel output.
Version 1.02.115 - 25th January 2016
====================================
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 1b9d6d3..f8b6d89 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2477,11 +2477,11 @@ static int _thin_pool_emit_segment_line(struct dm_task *dmt,
EMIT_PARAMS(pos, "%s %s %d %" PRIu64 " %d%s%s%s%s%s", metadata, pool,
seg->data_block_size, seg->low_water_mark, features,
- seg->error_if_no_space ? " error_if_no_space" : "",
- seg->read_only ? " read_only" : "",
seg->skip_block_zeroing ? " skip_block_zeroing" : "",
seg->ignore_discard ? " ignore_discard" : "",
- seg->no_discard_passdown ? " no_discard_passdown" : ""
+ seg->no_discard_passdown ? " no_discard_passdown" : "",
+ seg->error_if_no_space ? " error_if_no_space" : "",
+ seg->read_only ? " read_only" : ""
);
return 1;
8 years, 1 month
master - lvconvert: enable spare creation during conversion
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e32e793c43280c...
Commit: e32e793c43280c898ff6b20d22488af568825287
Parent: 3b76e9fd98bcbe89e1a73c8a0f7419c21799eecb
Author: M.H. Tsai <mingnus(a)gmail.com>
AuthorDate: Wed Jan 27 19:11:03 2016 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:30:40 2016 +0100
lvconvert: enable spare creation during conversion
Let user control pool metadata spare creation after repair as
the VG might not have enough free space.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a757f79..7b10da8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.142 -
====================================
+ Support control of spare metadata creation when repairing thin-pool.
Fix config type of 'log/verbose' from bool to int (2.02.99).
Fix thinp watermark calc for data LV for faster dmeventd responce (2.02.133).
Use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index fbec9b0..e2b91fa 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2481,7 +2481,8 @@ deactivate_pmslv:
}
/* Try to allocate new pool metadata spare LV */
- if (!handle_pool_metadata_spare(pool_lv->vg, 0, lp->pvh, 1))
+ if (!handle_pool_metadata_spare(pool_lv->vg, 0, lp->pvh,
+ lp->poolmetadataspare))
stack;
if (dm_snprintf(meta_path, sizeof(meta_path), "%s_meta%%d", pool_lv->name) < 0) {
8 years, 1 month
master - config: fix verbose type to int
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3b76e9fd98bcbe...
Commit: 3b76e9fd98bcbe89e1a73c8a0f7419c21799eecb
Parent: 02f2916b5be3f2f1dfdb9d1a76c753e46f1e480f
Author: M.H. Tsai <mingnus(a)gmail.com>
AuthorDate: Wed Jan 27 19:11:03 2016 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:30:39 2016 +0100
config: fix verbose type to int
'verbose' was marked as a boolean option while it
takes integer args - so it has limited usage to 0 or 1,
but we supported 0-4 at least.
Fix it by switching to corrent int type.
(Hopefully noone was trying to use this variable as true/yes/false/no
way - as the would be unsupported/undocumented).
---
WHATS_NEW | 1 +
lib/commands/toolcontext.c | 2 +-
lib/config/config_settings.h | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 002217d..a757f79 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.142 -
====================================
+ Fix config type of 'log/verbose' from bool to int (2.02.99).
Fix thinp watermark calc for data LV for faster dmeventd responce (2.02.133).
Use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in.
Do not check for suspended devices if scanning for lvmetad update.
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 4f94df4..1d7ca58 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -315,7 +315,7 @@ static void _init_logging(struct cmd_context *cmd)
init_silent(cmd->default_settings.silent);
/* Verbose level for tty output */
- cmd->default_settings.verbose = find_config_tree_bool(cmd, log_verbose_CFG, NULL);
+ cmd->default_settings.verbose = find_config_tree_int(cmd, log_verbose_CFG, NULL);
init_verbose(cmd->default_settings.verbose + VERBOSE_BASE_LEVEL);
/* Log message formatting */
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index e554b8e..1143c8b 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -535,7 +535,7 @@ cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocat
cfg(allocation_physical_extent_size_CFG, "physical_extent_size", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_EXTENT_SIZE, vsn(2, 2, 112), NULL, 0, NULL,
"Default physical extent size in KiB to use for new VGs.\n")
-cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL, 0, NULL,
+cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL, 0, NULL,
"Controls the messages sent to stdout or stderr.\n")
cfg(log_silent_CFG, "silent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SILENT, vsn(2, 2, 98), NULL, 0, NULL,
8 years, 1 month
master - thin: fix low_water_mark threshold calc
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=02f2916b5be3f2...
Commit: 02f2916b5be3f2f1dfdb9d1a76c753e46f1e480f
Parent: 8423be80eea3af40355edbdb1e14eed5cd3000a2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 11 18:05:36 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 11 18:30:24 2016 +0100
thin: fix low_water_mark threshold calc
Reporter noticed lvm2 incorrectly translated
lvm2 threshold value to water mark in commit:
99237f0908d87592815f4bdf3c239e8a108e835c
Fix it by properly translating size to number of
blocks in thin-pool and then calc for free blocks
matching configured lvm2 threshold value.
Reported-by: Ming-Hung Tsai <mingnus(a)gmail.com>
---
WHATS_NEW | 1 +
lib/thin/thin.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6ae8126..002217d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.142 -
====================================
+ Fix thinp watermark calc for data LV for faster dmeventd responce (2.02.133).
Use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in.
Do not check for suspended devices if scanning for lvmetad update.
Fix part. table filter with external_device_info_source="udev" and blkid<2.20.
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 9fbad32..c9ee9f5 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -295,9 +295,10 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
if (threshold < 50)
threshold = 50;
if (threshold < 100)
- low_water_mark = (len * threshold + 99) / 100;
+ /* Translate to number of free pool blocks to trigger watermark */
+ low_water_mark = len / seg->chunk_size * (100 - threshold) / 100;
else
- low_water_mark = len;
+ low_water_mark = 0;
if (!dm_tree_node_add_thin_pool_target(node, len,
seg->transaction_id,
8 years, 1 month