master - metadata: add add_glv_to_indirect_glvs and remove_glv_from_indirect_glvs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eeaa5a4481e04c...
Commit: eeaa5a4481e04c0131152fd88e6ea2651949ae35
Parent: 937f72b168302c9d8acb1a8e06525106df00fe2f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:19:57 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 11:26:51 2016 +0100
metadata: add add_glv_to_indirect_glvs and remove_glv_from_indirect_glvs
The add_glv_to_indirect_glvs is a helper function that registers a
volume represented by struct generic_logical_volume instance ("glv")
as an indirect user of another volume ("origin_glv") and vice versa -
it also registers the other volume ("origin_glv") as indirect_origin
of user volume ("glv").
The remove_glv_from_indirect_glvs does the opposite.
---
lib/metadata/lv_manip.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++
lib/metadata/metadata.h | 6 +++++
2 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index da60770..399668c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5343,6 +5343,64 @@ struct glv_list *get_or_create_glvl(struct dm_pool *mem, struct logical_volume *
return glvl;
}
+int add_glv_to_indirect_glvs(struct dm_pool *mem,
+ struct generic_logical_volume *origin_glv,
+ struct generic_logical_volume *glv)
+{
+ struct glv_list *glvl;
+
+ if (!(glvl = dm_pool_zalloc(mem, sizeof(struct glv_list)))) {
+ log_error("Failed to allocate generic volume list item "
+ "for indirect glv %s", glv->is_historical ? glv->historical->name
+ : glv->live->name);
+ return 0;
+ }
+
+ glvl->glv = glv;
+
+ if (glv->is_historical)
+ glv->historical->indirect_origin = origin_glv;
+ else
+ first_seg(glv->live)->indirect_origin = origin_glv;
+
+ if (origin_glv) {
+ if (origin_glv->is_historical)
+ dm_list_add(&origin_glv->historical->indirect_glvs, &glvl->list);
+ else
+ dm_list_add(&origin_glv->live->indirect_glvs, &glvl->list);
+ }
+
+ return 1;
+}
+
+int remove_glv_from_indirect_glvs(struct generic_logical_volume *origin_glv,
+ struct generic_logical_volume *glv)
+{
+ struct glv_list *glvl, *tglvl;
+ struct dm_list *list = origin_glv->is_historical ? &origin_glv->historical->indirect_glvs
+ : &origin_glv->live->indirect_glvs;
+
+ dm_list_iterate_items_safe(glvl, tglvl, list) {
+ if (glvl->glv != glv)
+ continue;
+
+ dm_list_del(&glvl->list);
+
+ if (glvl->glv->is_historical)
+ glvl->glv->historical->indirect_origin = NULL;
+ else
+ first_seg(glvl->glv->live)->indirect_origin = NULL;
+
+ return 1;
+ }
+
+ log_error(INTERNAL_ERROR "%s logical volume %s is not a user of %s.",
+ glv->is_historical ? "historical" : "Live",
+ glv->is_historical ? glv->historical->name : glv->live->name,
+ origin_glv->is_historical ? origin_glv->historical->name : origin_glv->live->name);
+ return 0;
+}
+
struct logical_volume *alloc_lv(struct dm_pool *mem)
{
struct logical_volume *lv;
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index 91e5961..33cbfa6 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -440,6 +440,12 @@ int lv_split_segment(struct logical_volume *lv, uint32_t le);
int add_seg_to_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *seg);
int remove_seg_from_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *seg);
+int add_glv_to_indirect_glvs(struct dm_pool *mem,
+ struct generic_logical_volume *origin_glv,
+ struct generic_logical_volume *user_glv);
+int remove_glv_from_indirect_glvs(struct generic_logical_volume *glv,
+ struct generic_logical_volume *user_glv);
+
int for_each_sub_lv_except_pools(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data);
7 years
master - metadata: add get_or_create_glv and get_or_create_glvl
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=937f72b168302c...
Commit: 937f72b168302c9d8acb1a8e06525106df00fe2f
Parent: e573eca554374ba6889a7f89fcb9850ae13c793e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:19:23 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 11:26:51 2016 +0100
metadata: add get_or_create_glv and get_or_create_glvl
The get_or_create_glv is helper function that retrieves any existing
generic_logical_volume wrapper for the LV. If the wrapper does not exist
yet, it's created.
The get_org_create_glvl is the same as get_or_create_glv but it creates
the glv_list wrapper in addition so it can be added to a list.
---
lib/metadata/lv_manip.c | 36 ++++++++++++++++++++++++++++++++++++
lib/metadata/metadata-exported.h | 3 +++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 069042c..da60770 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5307,6 +5307,42 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
return buffer;
}
+struct generic_logical_volume *get_or_create_glv(struct dm_pool*mem, struct logical_volume *lv, int *glv_created)
+{
+ struct generic_logical_volume *glv;
+
+ if (!(glv = lv->this_glv)) {
+ if (!(glv = dm_pool_zalloc(mem, sizeof(struct generic_logical_volume)))) {
+ log_error("Failed to allocate generic logical volume structure.");
+ return NULL;
+ }
+ glv->live = lv;
+ lv->this_glv = glv;
+ if (glv_created)
+ *glv_created = 1;
+ } else if (glv_created)
+ *glv_created = 0;
+
+ return glv;
+}
+
+struct glv_list *get_or_create_glvl(struct dm_pool *mem, struct logical_volume *lv, int *glv_created)
+{
+ struct glv_list *glvl;
+
+ if (!(glvl = dm_pool_zalloc(mem, sizeof(struct glv_list)))) {
+ log_error("Failed to allocate generic logical volume list item.");
+ return NULL;
+ }
+
+ if (!(glvl->glv = get_or_create_glv(mem, lv, glv_created))) {
+ dm_pool_free(mem, glvl);
+ return_NULL;
+ }
+
+ return glvl;
+}
+
struct logical_volume *alloc_lv(struct dm_pool *mem)
{
struct logical_volume *lv;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 97cba51..76597ba 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1238,6 +1238,9 @@ dm_percent_t copy_percent(const struct logical_volume *lv_mirr);
char *generate_lv_name(struct volume_group *vg, const char *format,
char *buffer, size_t len);
+struct generic_logical_volume *get_or_create_glv(struct dm_pool *mem, struct logical_volume *lv, int *glv_created);
+struct glv_list *get_or_create_glvl(struct dm_pool *mem, struct logical_volume *lv, int *glv_created);
+
/*
* Begin skeleton for external LVM library
*/
7 years
master - metadata: add infrastructure to track LV history
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e573eca554374b...
Commit: e573eca554374ba6889a7f89fcb9850ae13c793e
Parent: 5e718ec66679aad42773901a40e168ba4c3f3f50
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:18:42 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 11:26:51 2016 +0100
metadata: add infrastructure to track LV history
Add new structures and new fields in existing structures to support
tracking history of LVs (the LVs which don't exist - the have been
removed already):
- new "struct historical_logical_volume"
This structure keeps information specific to historical LVs
(historical LV is very reduced form of struct logical_volume +
it contains a few specific fields to track historical LV
properties like removal time and connections among other LVs).
- new "struct generic_logical_volume"
Wrapper for "struct historical_logical_volume" and
"struct logical_volume" to make it possible to handle volumes
in uniform way, no matter if it's live or historical one.
- new "struct glv_list"
Wrapper for "struct generic_logical_volume" so it can be
added to a list.
- new "indirect_glvs" field in "struct logical_volume"
List that stores references to all indirect users of this LV - this
interconnects live LV with historical descendant LVs or even live
descendant LVs.
- new "indirect_origin" field in "struct lv_segment"
Reference to indirect origin of this segment - this interconnects
live LV (segment) with historical ancestor.
- new "this_glv" field in "struct logical_volume"
This references an existing generic_logical_volume wrapper for this
LV, if used. It can be NULL if not needed - which means we're not
handling historical LVs at all.
- new "historical_lvs" field in "struct volume group
List of all historical LVs read from VG metadata.
---
lib/metadata/lv.h | 48 ++++++++++++++++++++++++++++++++++++++
lib/metadata/lv_manip.c | 1 +
lib/metadata/metadata-exported.h | 6 ++++
lib/metadata/vg.c | 1 +
lib/metadata/vg.h | 1 +
lib/report/report.c | 2 +
tools/reporter.c | 2 +
7 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index 4b42eb7..f554bce 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -49,6 +49,15 @@ struct logical_volume {
struct dm_list segments;
struct dm_list tags;
struct dm_list segs_using_this_lv;
+ struct dm_list indirect_glvs; /* For keeping track of historical LVs in ancestry chain */
+
+ /*
+ * this_glv variable is used as a helper for handling historical LVs.
+ * If this LVs has no role at all in keeping track of historical LVs,
+ * the this_glv variable is NULL. See also comments for struct
+ * generic_logical_volume and struct historical_logical_volume below.
+ */
+ struct generic_logical_volume *this_glv;
uint64_t timestamp;
unsigned new_lock_args:1;
@@ -56,6 +65,45 @@ struct logical_volume {
const char *lock_args;
};
+/*
+ * With the introduction of tracking historical LVs, we need to make
+ * a difference between live LV (struct logical_volume) and historical LV
+ * (struct historical_logical_volume). To minimize the impact of this change
+ * and to minimize the changes needed in the existing code, we use a
+ * little trick here - when processing LVs (e.g. while reporting LV
+ * properties), each historical LV is represented as dummy LV which is
+ * an instance of struct logical_volume with all its properties set to
+ * blank (hence "dummy LV") and with this_glv pointing to the struct
+ * historical_logical_volume. This way all the existing code working with
+ * struct logical_volume will see this historical LV as dummy live LV while
+ * the code that needs to recognize between live and historical LV will
+ * check this_glv first and then it will work either with the live
+ * or historical LV properties appropriately.
+ */
+struct generic_logical_volume;
+
+/*
+ * historical logical volume is an LV that has been removed already.
+ * This is used to keep track of LV history.
+ */
+struct historical_logical_volume {
+ union lvid lvid;
+ const char *name;
+ struct volume_group *vg;
+ uint64_t timestamp;
+ uint64_t timestamp_removed;
+ struct generic_logical_volume *indirect_origin;
+ struct dm_list indirect_glvs; /* list of struct generic_logical_volume */
+};
+
+struct generic_logical_volume {
+ int is_historical;
+ union {
+ struct logical_volume *live; /* is_historical=0 */
+ struct historical_logical_volume *historical; /* is_historical=1 */
+ };
+};
+
struct lv_with_info_and_seg_status;
/* LV dependencies */
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 1b431c1..069042c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5320,6 +5320,7 @@ struct logical_volume *alloc_lv(struct dm_pool *mem)
dm_list_init(&lv->segments);
dm_list_init(&lv->tags);
dm_list_init(&lv->segs_using_this_lv);
+ dm_list_init(&lv->indirect_glvs);
dm_list_init(&lv->rsites);
return lv;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 8376a54..97cba51 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -447,6 +447,7 @@ struct lv_segment {
uint32_t chunk_size; /* For snapshots/thin_pool. In sectors. */
/* For thin_pool, 128..2097152. */
struct logical_volume *origin; /* snap and thin */
+ struct generic_logical_volume *indirect_origin;
struct logical_volume *merge_lv; /* thin, merge descendent lv into this ancestor */
struct logical_volume *cow;
struct dm_list origin_list;
@@ -505,6 +506,11 @@ struct lv_list {
struct logical_volume *lv;
};
+struct glv_list {
+ struct dm_list list;
+ struct generic_logical_volume *glv;
+};
+
struct vg_list {
struct dm_list list;
struct volume_group *vg;
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 1456fbb..90c459e 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -64,6 +64,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->pv_write_list);
dm_list_init(&vg->pvs_outdated);
dm_list_init(&vg->lvs);
+ dm_list_init(&vg->historical_lvs);
dm_list_init(&vg->tags);
dm_list_init(&vg->removed_lvs);
dm_list_init(&vg->removed_pvs);
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index f41def8..c5197cb 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -128,6 +128,7 @@ struct volume_group {
* - one for the user-visible mirror LV
*/
struct dm_list lvs;
+ struct dm_list historical_lvs;
struct dm_list tags;
diff --git a/lib/report/report.c b/lib/report/report.c
index 43987b1..056afd2 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3386,6 +3386,7 @@ static struct volume_group _dummy_vg = {
.lvm1_system_id = (char *) "",
.pvs = DM_LIST_HEAD_INIT(_dummy_vg.pvs),
.lvs = DM_LIST_HEAD_INIT(_dummy_vg.lvs),
+ .historical_lvs = DM_LIST_HEAD_INIT(_dummy_vg.historical_lvs),
.tags = DM_LIST_HEAD_INIT(_dummy_vg.tags),
};
@@ -3396,6 +3397,7 @@ static struct volume_group _unknown_vg = {
.lvm1_system_id = (char *) "",
.pvs = DM_LIST_HEAD_INIT(_unknown_vg.pvs),
.lvs = DM_LIST_HEAD_INIT(_unknown_vg.lvs),
+ .historical_lvs = DM_LIST_HEAD_INIT(_unknown_vg.historical_lvs),
.tags = DM_LIST_HEAD_INIT(_unknown_vg.tags),
};
diff --git a/tools/reporter.c b/tools/reporter.c
index 1a24698..0c73a09 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -244,6 +244,7 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
.name = "",
.pvs = DM_LIST_HEAD_INIT(_free_vg.pvs),
.lvs = DM_LIST_HEAD_INIT(_free_vg.lvs),
+ .historical_lvs = DM_LIST_HEAD_INIT(_free_vg.historical_lvs),
.tags = DM_LIST_HEAD_INIT(_free_vg.tags),
};
@@ -256,6 +257,7 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
.tags = DM_LIST_HEAD_INIT(_free_logical_volume.tags),
.segments = DM_LIST_HEAD_INIT(_free_logical_volume.segments),
.segs_using_this_lv = DM_LIST_HEAD_INIT(_free_logical_volume.segs_using_this_lv),
+ .indirect_glvs = DM_LIST_HEAD_INIT(_free_logical_volume.indirect_glvs),
.snapshot_segs = DM_LIST_HEAD_INIT(_free_logical_volume.snapshot_segs),
};
7 years
master - tests: drop check for md5sum
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e718ec66679aa...
Commit: 5e718ec66679aad42773901a40e168ba4c3f3f50
Parent: 49839b6d9677f40993b2468bc85e8cc8c82f9a8e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 11:12:00 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:17:03 2016 +0100
tests: drop check for md5sum
---
test/shell/error-usage.sh | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/test/shell/error-usage.sh b/test/shell/error-usage.sh
index 3f6bf97..531dad3 100644
--- a/test/shell/error-usage.sh
+++ b/test/shell/error-usage.sh
@@ -16,8 +16,6 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
-which md5sum || skip
-
aux prepare_pvs 1
vgcreate -s 256k $vg $(cat DEVICES)
7 years
master - tests: check kernel_cache_ funcs
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=49839b6d9677f4...
Commit: 49839b6d9677f40993b2468bc85e8cc8c82f9a8e
Parent: e04a0184cb046c28428c65e52afc28ec591c50cf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 11:12:14 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:17:03 2016 +0100
tests: check kernel_cache_ funcs
---
test/shell/lvchange-cache.sh | 52 ++++++++++++++++++++++++-----------------
1 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index 3fd326a..ca7522a 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014-2016 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -31,44 +31,52 @@ not lvchange --cachepolicy mq $vg/noncache
not lvchange --cachesettings foo=bar $vg/noncache
lvchange --cachepolicy cleaner $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'cleaner'
+check lv_field $vg/corigin kernel_cache_policy "cleaner"
lvchange --cachepolicy mq --cachesettings migration_threshold=333 $vg/corigin
-dmsetup status | grep $vg-corigin | not grep 'cleaner'
-dmsetup status | grep $vg-corigin | grep 'mq'
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 333'
+
+# TODO once mq->smq happens we will get here some 0 for mq settings
+check lv_field $vg/corigin kernel_cache_policy "mq"
+get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
+
lvchange --refresh $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 333'
+get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
lvchange -an $vg
lvchange -ay $vg
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 333'
+get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13' $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 233'
-dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13'
+get lv_field $vg/corigin kernel_cache_settings | tee out
+grep 'migration_threshold=233' out
+grep 'sequential_threshold=13' out
lvchange --cachesettings 'migration_threshold = 17' $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 17'
-dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13'
+get lv_field $vg/corigin kernel_cache_settings | tee out
+grep 'migration_threshold=17' out
+grep 'sequential_threshold=13' out
lvchange --cachesettings 'migration_threshold = default' $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 2048'
-dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13'
+get lv_field $vg/corigin kernel_cache_settings | tee out
+grep 'migration_threshold=2048' out
+grep 'sequential_threshold=13' out
lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13 random_threshold = 1' $vg/corigin
lvchange --cachesettings 'random_threshold = default migration_threshold = default' $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 2048'
-dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13'
-dmsetup status | grep $vg-corigin | grep 'random_threshold 4'
+get lv_field $vg/corigin kernel_cache_settings | tee out
+grep 'migration_threshold=2048' out
+grep 'sequential_threshold=13' out
+grep 'random_threshold=4' out
lvchange --cachesettings migration_threshold=233 --cachesettings sequential_threshold=13 --cachesettings random_threshold=1 $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 233 '
-dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13 '
-dmsetup status | grep $vg-corigin | grep 'random_threshold 1 '
+get lv_field $vg/corigin kernel_cache_settings | tee out
+grep 'migration_threshold=233' out
+grep 'sequential_threshold=13' out
+grep 'random_threshold=1' out
lvchange --cachesettings random_threshold=default --cachesettings migration_threshold=default $vg/corigin
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 2048 '
-dmsetup status | grep $vg-corigin | grep 'sequential_threshold 13 '
-dmsetup status | grep $vg-corigin | grep 'random_threshold 4 '
+get lv_field $vg/corigin kernel_cache_settings | tee out
+grep 'migration_threshold=2048' out
+grep 'sequential_threshold=13' out
+grep 'random_threshold=4' out
vgremove -f $vg
7 years
master - cleanup: use lv_is_partial
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e04a0184cb046c...
Commit: e04a0184cb046c28428c65e52afc28ec591c50cf
Parent: a975dc530e31fec883bbf6e2db7a6b48cb3b789d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 20:59:03 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:17:03 2016 +0100
cleanup: use lv_is_partial
Check for PARTIAL_LV flag in standard way.
---
lib/activate/activate.c | 2 +-
lib/metadata/lv.c | 2 +-
lib/metadata/lv_manip.c | 2 +-
lib/metadata/metadata-exported.h | 1 +
lib/metadata/metadata.c | 3 ++-
lib/metadata/mirror.c | 4 ++--
lib/metadata/raid_manip.c | 29 ++++++++++++++---------------
lib/report/report.c | 2 +-
tools/lvconvert.c | 8 ++++----
tools/vgreduce.c | 4 ++--
10 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index a7ac608..2eb24d4 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2243,7 +2243,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
goto out;
}
- if ((!lv->vg->cmd->partial_activation) && (lv->status & PARTIAL_LV)) {
+ if ((!lv->vg->cmd->partial_activation) && lv_is_partial(lv)) {
if (!lv_is_raid_type(lv) || !partial_raid_lv_supports_degraded_activation(lv)) {
log_error("Refusing activation of partial LV %s. "
"Use '--activationmode partial' to override.",
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 98b1ddb..459de6e 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -1173,7 +1173,7 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
repstr[7] = '-';
repstr[8] = '-';
- if (lv->status & PARTIAL_LV)
+ if (lv_is_partial(lv))
repstr[8] = 'p';
else if (lv_is_raid_type(lv)) {
uint64_t n;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 5e4a81f..1b431c1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1360,7 +1360,7 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv)
{
- if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
+ if (!cmd->partial_activation && lv_is_partial(lv)) {
log_error("Refusing refresh of partial LV %s."
" Use '--activationmode partial' to override.",
display_lvname(lv));
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 6b39de4..8376a54 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -193,6 +193,7 @@
#define vg_is_archived(vg) (((vg)->status & ARCHIVED_VG) ? 1 : 0)
#define lv_is_locked(lv) (((lv)->status & LOCKED) ? 1 : 0)
+#define lv_is_partial(lv) (((lv)->status & PARTIAL_LV) ? 1 : 0)
#define lv_is_virtual(lv) (((lv)->status & VIRTUAL) ? 1 : 0)
#define lv_is_merging(lv) (((lv)->status & MERGING) ? 1 : 0)
#define lv_is_merging_origin(lv) (lv_is_merging(lv))
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 6ec0a0e..5e84e96 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2471,7 +2471,8 @@ struct _lv_mark_if_partial_baton {
static int _lv_mark_if_partial_collect(struct logical_volume *lv, void *data)
{
struct _lv_mark_if_partial_baton *baton = data;
- if (baton && lv->status & PARTIAL_LV)
+
+ if (baton && lv_is_partial(lv))
baton->partial = 1;
return 1;
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index fa1cc35..2a72209 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -935,7 +935,7 @@ static int _remove_mirror_images(struct logical_volume *lv,
* not in-sync.
*/
if ((s == 0) && !_mirrored_lv_in_sync(lv) &&
- !(lv->status & PARTIAL_LV)) {
+ !(lv_is_partial(lv))) {
log_error("Unable to remove primary mirror image while mirror is not in-sync");
return 0;
}
@@ -1034,7 +1034,7 @@ static int _remove_mirror_images(struct logical_volume *lv,
* the only way to release the pending writes.
*/
if (detached_log_lv && lv_is_mirrored(detached_log_lv) &&
- (detached_log_lv->status & PARTIAL_LV)) {
+ lv_is_partial(detached_log_lv)) {
struct lv_segment *seg = first_seg(detached_log_lv);
log_very_verbose("%s being removed due to failures",
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index e6684fc..e66b533 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1500,18 +1500,18 @@ static int _remove_partial_multi_segment_image(struct logical_volume *lv,
struct logical_volume *rm_image = NULL;
struct physical_volume *pv;
- if (!(lv->status & PARTIAL_LV))
+ if (!lv_is_partial(lv))
return_0;
for (s = 0; s < raid_seg->area_count; s++) {
extents_needed = 0;
- if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) &&
+ if (lv_is_partial(seg_lv(raid_seg, s)) &&
lv_is_on_pvs(seg_lv(raid_seg, s), remove_pvs) &&
(dm_list_size(&(seg_lv(raid_seg, s)->segments)) > 1)) {
rm_image = seg_lv(raid_seg, s);
/* First, how many damaged extents are there */
- if (seg_metalv(raid_seg, s)->status & PARTIAL_LV)
+ if (lv_is_partial(seg_metalv(raid_seg, s)))
extents_needed += seg_metalv(raid_seg, s)->le_count;
dm_list_iterate_items(rm_seg, &rm_image->segments) {
/*
@@ -1576,8 +1576,7 @@ static int _avoid_pvs_of_lv(struct logical_volume *lv, void *data)
struct pv_list *pvl;
dm_list_iterate_items(pvl, allocate_pvs)
- if (!(lv->status & PARTIAL_LV) &&
- lv_is_on_pv(lv, pvl->pv))
+ if (!lv_is_partial(lv) && lv_is_on_pv(lv, pvl->pv))
pvl->pv->status |= PV_ALLOCATION_PROHIBITED;
return 1;
@@ -1617,7 +1616,7 @@ int lv_raid_replace(struct logical_volume *lv,
dm_list_init(&new_meta_lvs);
dm_list_init(&new_data_lvs);
- if (lv->status & PARTIAL_LV)
+ if (lv_is_partial(lv))
lv->vg->cmd->partial_activation = 1;
if (!lv_is_active_exclusive_locally(lv_lock_holder(lv))) {
@@ -1708,7 +1707,7 @@ int lv_raid_replace(struct logical_volume *lv,
try_again:
if (!_alloc_image_components(lv, allocate_pvs, match_count,
&new_meta_lvs, &new_data_lvs)) {
- if (!(lv->status & PARTIAL_LV)) {
+ if (!lv_is_partial(lv)) {
log_error("LV %s in not partial.", display_lvname(lv));
return 0;
}
@@ -1853,7 +1852,7 @@ int lv_raid_remove_missing(struct logical_volume *lv)
uint32_t s;
struct lv_segment *seg = first_seg(lv);
- if (!(lv->status & PARTIAL_LV)) {
+ if (!lv_is_partial(lv)) {
log_error(INTERNAL_ERROR "%s/%s is not a partial LV",
lv->vg->name, lv->name);
return 0;
@@ -1870,8 +1869,8 @@ int lv_raid_remove_missing(struct logical_volume *lv)
*/
for (s = 0; s < seg->area_count; s++) {
- if (!(seg_lv(seg, s)->status & PARTIAL_LV) &&
- !(seg_metalv(seg, s)->status & PARTIAL_LV))
+ if (!lv_is_partial(seg_lv(seg, s)) &&
+ !lv_is_partial(seg_metalv(seg, s)))
continue;
log_debug("Replacing %s and %s segments with error target",
@@ -1911,8 +1910,8 @@ static int _partial_raid_lv_is_redundant(const struct logical_volume *lv)
if (!(i % copies))
rebuilds_per_group = 0;
- if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) ||
- (seg_metalv(raid_seg, s)->status & PARTIAL_LV) ||
+ if (lv_is_partial(seg_lv(raid_seg, s)) ||
+ lv_is_partial(seg_metalv(raid_seg, s)) ||
lv_is_virtual(seg_lv(raid_seg, s)) ||
lv_is_virtual(seg_metalv(raid_seg, s)))
rebuilds_per_group++;
@@ -1928,8 +1927,8 @@ static int _partial_raid_lv_is_redundant(const struct logical_volume *lv)
}
for (s = 0; s < raid_seg->area_count; s++) {
- if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) ||
- (seg_metalv(raid_seg, s)->status & PARTIAL_LV) ||
+ if (lv_is_partial(seg_lv(raid_seg, s)) ||
+ lv_is_partial(seg_metalv(raid_seg, s)) ||
lv_is_virtual(seg_lv(raid_seg, s)) ||
lv_is_virtual(seg_metalv(raid_seg, s)))
failed_components++;
@@ -1961,7 +1960,7 @@ static int _lv_may_be_activated_in_degraded_mode(struct logical_volume *lv, void
if (*not_capable)
return 1; /* No further checks needed */
- if (!(lv->status & PARTIAL_LV))
+ if (!lv_is_partial(lv))
return 1;
if (lv_is_raid(lv)) {
diff --git a/lib/report/report.c b/lib/report/report.c
index 631a1bf..43987b1 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3298,7 +3298,7 @@ static int _lvhealthstatus_disp(struct dm_report *rh, struct dm_pool *mem,
const char *health = "";
uint64_t n;
- if (lv->status & PARTIAL_LV)
+ if (lv_is_partial(lv))
health = "partial";
else if (lv_is_raid_type(lv)) {
if (!activation())
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f6ea614..db1c7f7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -854,7 +854,7 @@ static int _failed_mirrors_count(struct logical_volume *lv)
if (seg_type(lvseg, s) == AREA_LV) {
if (is_temporary_mirror_layer(seg_lv(lvseg, s)))
ret += _failed_mirrors_count(seg_lv(lvseg, s));
- else if (seg_lv(lvseg, s)->status & PARTIAL_LV)
+ else if (lv_is_partial(seg_lv(lvseg, s)))
++ ret;
}
else if (seg_type(lvseg, s) == AREA_PV &&
@@ -871,7 +871,7 @@ static int _failed_logs_count(struct logical_volume *lv)
int ret = 0;
unsigned s;
struct logical_volume *log_lv = first_seg(lv)->log_lv;
- if (log_lv && (log_lv->status & PARTIAL_LV)) {
+ if (log_lv && lv_is_partial(log_lv)) {
if (lv_is_mirrored(log_lv))
ret += _failed_mirrors_count(log_lv);
else
@@ -926,7 +926,7 @@ static struct dm_list *_failed_pv_list(struct volume_group *vg)
static int _is_partial_lv(struct logical_volume *lv,
void *baton __attribute__((unused)))
{
- return lv->status & PARTIAL_LV;
+ return lv_is_partial(lv);
}
/*
@@ -1499,7 +1499,7 @@ static int _lvconvert_mirrors_repair(struct cmd_context *cmd,
lv_check_transient(lv); /* TODO check this in lib for all commands? */
- if (!(lv->status & PARTIAL_LV)) {
+ if (!lv_is_partial(lv)) {
log_print_unless_silent("Volume %s is consistent. Nothing to repair.",
display_lvname(lv));
return 1;
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index 41b5b83..e7c66fe 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -51,7 +51,7 @@ static int _consolidate_vg(struct cmd_context *cmd, struct volume_group *vg)
int r = 1;
dm_list_iterate_items(lvl, &vg->lvs)
- if (lvl->lv->status & PARTIAL_LV) {
+ if (lv_is_partial(lvl->lv)) {
log_warn("WARNING: Partial LV %s needs to be repaired "
"or removed. ", lvl->lv->name);
r = 0;
@@ -88,7 +88,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
lv = lvl->lv;
/* Are any segments of this LV on missing PVs? */
- if (lv->status & PARTIAL_LV) {
+ if (lv_is_partial(lv)) {
if (seg_is_raid(first_seg(lv))) {
if (!lv_raid_remove_missing(lv))
return_0;
7 years
master - cleanup: use _field_string
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a975dc530e31fe...
Commit: a975dc530e31fec883bbf6e2db7a6b48cb3b789d
Parent: 25bf0beedb8042ed77d97a79289168255b451475
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 11:50:12 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:17:03 2016 +0100
cleanup: use _field_string
Make at least some 'advantage' in use local func and do dereference
internally from char pointer and use short list of params.
---
lib/report/report.c | 61 +++++++++++++++++++++++++--------------------------
1 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index ff54cc4..631a1bf 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1209,6 +1209,11 @@ static const struct dm_report_reserved_value _report_reserved_values[] = {
#undef FIELD_RESERVED_VALUE
#undef FIELD_RESERVED_BINARY_VALUE
+static int _field_string(struct dm_report *rh, struct dm_report_field *field, const char *data)
+{
+ return dm_report_field_string(rh, field, &data);
+}
+
static int _field_set_value(struct dm_report_field *field, const void *data, const void *sort)
{
dm_report_field_set_value(field, data, sort);
@@ -1269,7 +1274,7 @@ static int _chars_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
{
- return dm_report_field_string(rh, field, (const char * const *) &data);
+ return _field_string(rh, field, data);
}
static int _uuid_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -1288,9 +1293,7 @@ static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const char *name = dev_name(*(const struct device * const *) data);
-
- return _string_disp(rh, mem, field, &name, private);
+ return _field_string(rh, field, dev_name(*(const struct device * const *) data));
}
static int _devices_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -1507,7 +1510,7 @@ static int _kernel_cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
if ((lvdm->seg_status.type == SEG_STATUS_CACHE) &&
lvdm->seg_status.cache->policy_name)
- return _string_disp(rh, mem, field, &lvdm->seg_status.cache->policy_name, NULL);
+ return _field_string(rh, field, lvdm->seg_status.cache->policy_name);
return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
GET_FIELD_RESERVED_VALUE(cache_policy_undef));
@@ -1530,7 +1533,7 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
return 0;
}
- return _string_disp(rh, mem, field, &seg->policy_name, private);
+ return _field_string(rh, field, seg->policy_name);
}
static int _modules_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -1558,7 +1561,7 @@ static int _lvprofile_disp(struct dm_report *rh, struct dm_pool *mem,
const struct logical_volume *lv = (const struct logical_volume *) data;
if (lv->profile)
- return _string_disp(rh, mem, field, &lv->profile->name, private);
+ return _field_string(rh, field, lv->profile->name);
return _field_set_value(field, "", NULL);
}
@@ -1568,9 +1571,8 @@ static int _lvlockargs_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- const char *repstr = lv->lock_args ? lv->lock_args : "";
- return _string_disp(rh, mem, field, &repstr, private);
+ return _field_string(rh, field, lv->lock_args ? : "");
}
static int _vgfmt_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -1580,7 +1582,7 @@ static int _vgfmt_disp(struct dm_report *rh, struct dm_pool *mem,
const struct volume_group *vg = (const struct volume_group *) data;
if (vg->fid && vg->fid->fmt)
- return _string_disp(rh, mem, field, &vg->fid->fmt->name, private);
+ return _field_string(rh, field, vg->fid->fmt->name);
return _field_set_value(field, "", NULL);
}
@@ -1589,13 +1591,12 @@ static int _pvfmt_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct label *l =
- (const struct label *) data;
+ const struct label *l = (const struct label *) data;
- if (!l->labeller || !l->labeller->fmt)
- return _field_set_value(field, "", NULL);
+ if (l->labeller && l->labeller->fmt)
+ return _field_string(rh, field, l->labeller->fmt->name);
- return _string_disp(rh, mem, field, &l->labeller->fmt->name, private);
+ return _field_set_value(field, "", NULL);
}
static int _lvkmaj_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
@@ -1688,7 +1689,7 @@ static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem,
size_t len;
if (lv_is_visible(lv) || !cmd->report_mark_hidden_devices)
- return _string_disp(rh, mem, field, &lv->name, private);
+ return _field_string(rh, field, lv->name);
len = strlen(lv->name) + 3;
if (!(repstr = dm_pool_zalloc(mem, len))) {
@@ -2030,7 +2031,7 @@ static int _do_movepv_disp(struct dm_report *rh, struct dm_pool *mem,
repstr = lv_move_pv_dup(mem, lv);
if (repstr)
- return _string_disp(rh, mem, field, &repstr, private);
+ return _field_string(rh, field, repstr);
return _field_set_value(field, "", NULL);
}
@@ -2316,7 +2317,7 @@ static int _discards_disp(struct dm_report *rh, struct dm_pool *mem,
if (seg_is_thin_pool(seg)) {
discards_str = get_pool_discards_name(seg->discards);
- return _string_disp(rh, mem, field, &discards_str, private);
+ return _field_string(rh, field, discards_str);
}
return _field_set_value(field, "", NULL);
@@ -2353,7 +2354,7 @@ static int _cachemode_disp(struct dm_report *rh, struct dm_pool *mem,
if (!(cachemode_str = get_cache_mode_name(seg)))
return_0;
- return _string_disp(rh, mem, field, &cachemode_str, private);
+ return _field_string(rh, field, cachemode_str);
}
return _field_set_value(field, "", NULL);
@@ -2441,7 +2442,7 @@ static int _vgsystemid_disp(struct dm_report *rh, struct dm_pool *mem,
const struct volume_group *vg = (const struct volume_group *) data;
const char *repstr = (vg->system_id && *vg->system_id) ? vg->system_id : vg->lvm1_system_id ? : "";
- return _string_disp(rh, mem, field, &repstr, private);
+ return _field_string(rh, field, repstr);
}
static int _vglocktype_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -2449,9 +2450,8 @@ static int _vglocktype_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- const char *repstr = vg->lock_type ? vg->lock_type : "";
- return _string_disp(rh, mem, field, &repstr, private);
+ return _field_string(rh, field, vg->lock_type ? : "");
}
static int _vglockargs_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -2459,9 +2459,8 @@ static int _vglockargs_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- const char *repstr = vg->lock_args ? vg->lock_args : "";
- return _string_disp(rh, mem, field, &repstr, private);
+ return _field_string(rh, field, vg->lock_args ? : "");
}
static int _pvuuid_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem,
@@ -2539,7 +2538,7 @@ static int _vgprofile_disp(struct dm_report *rh, struct dm_pool *mem,
const struct volume_group *vg = (const struct volume_group *) data;
if (vg->profile)
- return _string_disp(rh, mem, field, &vg->profile->name, private);
+ return _field_string(rh, field, vg->profile->name);
return _field_set_value(field, "", NULL);
}
@@ -2703,7 +2702,7 @@ static int _raidsyncaction_disp(struct dm_report *rh __attribute__((unused)),
char *sync_action;
if (lv_is_raid(lv) && lv_raid_sync_action(lv, &sync_action))
- return _string_disp(rh, mem, field, &sync_action, private);
+ return _field_string(rh, field, sync_action);
return _field_set_value(field, "", NULL);
}
@@ -2923,7 +2922,7 @@ static int _vgpermissions_disp(struct dm_report *rh, struct dm_pool *mem,
{
const char *perms = ((const struct volume_group *) data)->status & LVM_WRITE ? GET_FIRST_RESERVED_NAME(vg_permissions_rw)
: GET_FIRST_RESERVED_NAME(vg_permissions_r);
- return _string_disp(rh, mem, field, &perms, private);
+ return _field_string(rh, field, perms);
}
static int _vgextendable_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -2955,7 +2954,7 @@ static int _vgallocationpolicy_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const char *alloc_policy = get_alloc_string(((const struct volume_group *) data)->alloc) ? : _str_unknown;
- return _string_disp(rh, mem, field, &alloc_policy, private);
+ return _field_string(rh, field, alloc_policy);
}
static int _vgclustered_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -3079,7 +3078,7 @@ static int _lvpermissions_disp(struct dm_report *rh, struct dm_pool *mem,
perms = _str_unknown;
}
- return _string_disp(rh, mem, field, &perms, private);
+ return _field_string(rh, field, perms);
}
static int _lvallocationpolicy_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -3087,7 +3086,7 @@ static int _lvallocationpolicy_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const char *alloc_policy = get_alloc_string(((const struct logical_volume *) data)->alloc) ? : _str_unknown;
- return _string_disp(rh, mem, field, &alloc_policy, private);
+ return _field_string(rh, field, alloc_policy);
}
static int _lvallocationlocked_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -3323,7 +3322,7 @@ static int _lvhealthstatus_disp(struct dm_report *rh, struct dm_pool *mem,
health = "metadata_read_only";
}
- return _string_disp(rh, mem, field, &health, private);
+ return _field_string(rh, field, health);
}
static int _lvcheckneeded_disp(struct dm_report *rh, struct dm_pool *mem,
7 years
master - man: minor updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=25bf0beedb8042...
Commit: 25bf0beedb8042ed77d97a79289168255b451475
Parent: fd349cb2e50ff60abb5c79d2aab60cc753faa174
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 23:51:59 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:17:03 2016 +0100
man: minor updates
Minor fixes in few pages.
---
man/lvchange.8.in | 2 +-
man/vgcfgbackup.8.in | 7 ++++---
man/vgchange.8.in | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index 8ae17a0..fb16530 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -410,7 +410,7 @@ If \fB\-\-sysinit\fP is used in conjunction with
\fBlvmetad\fP(8) enabled and running,
autoactivation is preferred over manual activation via direct lvchange call.
Logical volumes are autoactivated according to
-\fB auto_activation_volume_list\fP set in \fBlvm.conf\fP(5).
+\fBauto_activation_volume_list\fP set in \fBlvm.conf\fP(5).
.
.HP
.BR \-Z | \-\-zero
diff --git a/man/vgcfgbackup.8.in b/man/vgcfgbackup.8.in
index 17b3bcb..898764a 100644
--- a/man/vgcfgbackup.8.in
+++ b/man/vgcfgbackup.8.in
@@ -7,7 +7,7 @@ vgcfgbackup \(em backup volume group descriptor area
.IR ProfileName ]
.RB [ \-d | \-\-debug ]
.RB [ \-f | \-\-file
-.RI < filename >]
+.IR Filename ]
.RB [ \-h | \-\-help ]
.RB [ \-\-ignorelockingfailure ]
.RB [ \-P | \-\-partial ]
@@ -19,13 +19,14 @@ If you don't name any volume groups on the command line, all of them
will be backed up.
.sp
In a default installation, each volume group gets backed up into a separate
-file bearing the name of the volume group in the directory #DEFAULT_BACKUP_DIR#.
+file bearing the name of the volume group in the directory
+\fI#DEFAULT_BACKUP_DIR#\fP.
You can write the backup to an alternative file using \fB\-f\fP. In this case
if you are backing up more than one volume group the filename is
treated as a template, and %s gets replaced by the volume group name.
.sp
NB. This DOESN'T backup user/system data in logical
-volume(s)! Backup #DEFAULT_SYS_DIR# regularly too.
+volume(s)! Backup \fI#DEFAULT_SYS_DIR#\fP regularly too.
.SH OPTIONS
See \fBlvm\fP(8) for common options.
.SH SEE ALSO
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index 77ab70e..fd7ee9d 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -13,7 +13,7 @@ vgchange \(em change attributes of a volume group
.RI [ a | e | s | l ]
.RI { y | n }]
.RB [ \-\-activationmode
-.IR { complete | degraded | partial } ]
+.IB { complete | degraded | partial } ]
.RB [ \-K | \-\-ignoreactivationskip ]
.RB [ \-\-monitor
.RI { y | n }]
7 years
master - man: lvconvert updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fd349cb2e50ff6...
Commit: fd349cb2e50ff60abb5c79d2aab60cc753faa174
Parent: 88ce15004e414a64a3f967908cb2721671a191ba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 23:51:16 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:17:03 2016 +0100
man: lvconvert updates
Improving style (following lvcreate way).
Sorting options alphabetically.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 612 +++++++++++++++++++++++++++++++---------------------
2 files changed, 369 insertions(+), 244 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 668e8a4..f623226 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.145 -
=====================================
+ Improve lvconvert man page.
Add kernel_cache_policy lvs field.
Display [unknown] instead of 'unknown device' in pvs output.
Fix error path when pvcreate allocation fails (2.02.144).
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index 4438893..b889345 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -1,19 +1,22 @@
.TH LVCONVERT 8 "LVM TOOLS #VERSION#" "Red Hat, Inc" \" -*- nroff -*-
.SH NAME
lvconvert \(em convert a logical volume from linear to mirror or snapshot
+.
.SH SYNOPSIS
+.
+.ad l
.B lvconvert
.BR \-m | \-\-mirrors
-.I Mirrors
+.IR Mirrors
.RB [ \-\-type
.IR SegmentType ]
.RB [ \-\-mirrorlog
-.RI { disk | core | mirrored }]
+.RB { disk | core | mirrored }]
.RB [ \-\-corelog ]
.RB [ \-R | \-\-regionsize
.IR MirrorLogRegionSize ]
.RB [ \-\-stripes
-.I Stripes
+.IR Stripes
.RB [ \-I | \-\-stripesize
.IR StripeSize ]]
.RB [ \-A | \-\-alloc
@@ -29,76 +32,80 @@ lvconvert \(em convert a logical volume from linear to mirror or snapshot
.RB [ \-v | \-\-verbose ]
.RB [ \-y | \-\-yes ]
.RB [ \-\-version ]
-.IR LogicalVolume [ Path ]
-.RI [ PhysicalVolume [ Path ][ :PE [ \-PE ]]...]
+.IR LogicalVolume
+.RI [ PhysicalVolume [ Path ]\:[ \fB: \fIPE \fR[ \fB\- PE ]]...]
.sp
.B lvconvert
-.BR \-\-split
+.BR \-\-merge
+.RB [ \-b | \-\-background ]
+.RB [ \-i | \-\-interval
+.IR Seconds ]
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
-.RB [ \-\-noudevsync ]
.RB [ \-v | \-\-verbose ]
-.IR SplitableLogicalVolume { Name | Path }
+.RB [ \-\-version ]
+.IR LogicalVolume...
.sp
.B lvconvert
-.BR \-\-splitcache | \-\-uncache
+.BR \-s | \-\-snapshot
+.RB [ \-c | \-\-chunksize
+.IR ChunkSize ]
+.RB [ \-Z | \-\-zero
+.RB { y | n }]
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-\-noudevsync ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.IR CacheLogicalVolume { Name | Path }
-.sp
-.B lvconvert \-\-splitmirrors \fIImages
-.RB [ \-\-name
-.IR SplitLogicalVolumeName ]
-.RB [ \-\-trackchanges ]
-.IR MirrorLogicalVolume [ Path ]
-.RB [ \-\-commandprofile
-.IR ProfileName ]
-.RI [ SplittablePhysicalVolume [ Path ][ :PE [ \-PE ]]...]
+.IR OriginalLogicalVolume
+.IR SnapshotLogicalVolume
.sp
.B lvconvert
-.BR \-\-splitsnapshot
+.BR \-\-split
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-\-noudevsync ]
.RB [ \-v | \-\-verbose ]
-.RB [ \-\-version ]
-.IR SnapshotLogicalVolume [ Path ]
+.IR SplitableLogicalVolume
.sp
.B lvconvert
-.BR \-s | \-\-snapshot
-.RB [ \-c | \-\-chunksize
-.IR ChunkSize [ bBsSkK ]]
-.RB [ \-Z | \-\-zero
-.RI { y | n }]
+.BR \-\-splitcache | \-\-uncache
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-\-noudevsync ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.IR OriginalLogicalVolume [ Path ]
-.IR SnapshotLogicalVolume [ Path ]
+.IR CacheLogicalVolume
.sp
-.B lvconvert \-\-merge
-.RB [ \-b | \-\-background ]
-.RB [ \-i | \-\-interval
-.IR Seconds ]
+.B lvconvert
+.BR \-\-splitmirrors
+.IR Images
+.RB [ \-\-name
+.IR SplitLogicalVolumeName ]
+.RB [ \-\-trackchanges ]
+.IR MirrorLogicalVolume
+.RB [ \-\-commandprofile
+.IR ProfileName ]
+.RI [ SplittablePhysicalVolume [ Path ]\:[ \fB: \fIPE \fR[ \fB\- PE ]]...]
+.sp
+.B lvconvert
+.BR \-\-splitsnapshot
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
+.RB [ \-\-noudevsync ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.IR LogicalVolume [ Path ]...
+.IR SnapshotLogicalVolume
.sp
-.B lvconvert \-\-repair
+.B lvconvert
+.BR \-\-repair
.RB [ \-\-stripes
-.I Stripes
+.IR Stripes
.RB [ \-I | \-\-stripesize
.IR StripeSize ]]
.RB [ \-\-commandprofile
@@ -106,82 +113,87 @@ lvconvert \(em convert a logical volume from linear to mirror or snapshot
.RB [ \-h | \-? | \-\-help ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.IR LogicalVolume [ Path ]
+.IR LogicalVolume
.RI [ PhysicalVolume [ Path ]...]
.sp
-.B lvconvert \-\-replace \fIPhysicalVolume
+.B lvconvert
+.BR \-\-replace
+.IR PhysicalVolume
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.IR LogicalVolume [ Path ]
+.IR LogicalVolume
.RI [ PhysicalVolume [ Path ]...]
.sp
.B lvconvert
-.B \-\-type
-.BR \fIthin [ \fI\-pool ]| \-T | \-\-thin
-.RB [ \-\-originname
-.IR NewExternalOriginVolumeName ]
-.RB [ \-\-thinpool
-.IR ThinPoolLogicalVolume { Name | Path }
+.BR \-\-type
+.BR cache [ \-pool ]| \-H | \-\-cache
+.RB [ \-\-cachepool
+.IR CachePoolLogicalVolume ]
+.\" |
+.\" .B \-\-pooldatasize
+.\" .IR CachePoolMetadataSize ]
.RB [ \-c | \-\-chunksize
-.IR ChunkSize [ bBsSkKmMgG ]]
-.RB [ \-\-discards
-.RI { ignore | nopassdown | passdown }]
+.IR ChunkSize ]
+.RB [ \-\-cachemode
+.RB { writeback | writethrough }]
+.RB [ \-\-cachepolicy
+.IR Policy ]
+.RB [ \-\-cachesettings
+.IR Key \fB= Value ]...
.RB [ \-\-poolmetadata
-.IR ThinPoolMetadataLogicalVolume { Name | Path }
-|
-.B \-\-poolmetadatasize
-.IR ThinPoolMetadataSize [ bBsSkKmMgG ]]
-.RB [ \-r | \-\-readahead
-.RI { ReadAheadSectors | auto | none }]
-.RB [ \-\-stripes \ \fIStripes
-.RB [ \-I | \-\-stripesize \ \fIStripeSize ]]]
+.IR CachePoolMetadataLogicalVolume
+.RB |
+.BR \-\-poolmetadatasize
+.IR CachePoolMetadataSize ]
.RB [ \-\-poolmetadataspare
-.RI { y | n }]
-.RB [ \-Z | \-\-zero \ { \fIy | \fIn }]]
+.RB { y | n }]
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.RI [[ ExternalOrigin | ThinPool ] LogicalVolume { Name | Path }]
-.RI [ PhysicalVolume [ Path ][ :PE
-.RI [ \-PE ]]\ \.\|\.\|\.
+.IR LogicalVolume
+.RI [ PhysicalVolume [ Path ]\:[ \fB: \fIPE \fR[ \fB\- PE ]]...]
.sp
.B lvconvert
-.B \-\-type
-.BR \fIcache [ \fI\-pool ]| \-H | \-\-cache
-.RB [ \-\-cachepool
-.IR CachePoolLogicalVolume { Name | Path }]
-.\" |
-.\" .B \-\-pooldatasize
-.\" .IR CachePoolMetadataSize [ bBsSkKmMgGtTpPeE ]]
+.BR \-\-type
+.BR thin [ \-pool ]| \-T | \-\-thin
+.RB [ \-\-originname
+.IR NewExternalOriginVolumeName ]
+.RB [ \-\-thinpool
+.IR ThinPoolLogicalVolume
.RB [ \-c | \-\-chunksize
-.IR ChunkSize [ bBsSkKmMgG ]]
-.RB [ \-\-cachemode
-.RI { writeback | writethrough }]
-.RB [ \-\-cachepolicy
-.IR policy ]
-.RB [ \-\-cachesettings
-.IR key=value ]
+.IR ChunkSize ]
+.RB [ \-\-discards
+.RB { ignore | nopassdown | passdown }]
.RB [ \-\-poolmetadata
-.IR CachePoolMetadataLogicalVolume { Name | Path }
-|
-.B \-\-poolmetadatasize
-.IR CachePoolMetadataSize [ bBsSkKmMgG ]]
+.IR ThinPoolMetadataLogicalVolume
+.RB |
+.BR \-\-poolmetadatasize
+.IR ThinPoolMetadataSize ]
+.RB [ \-r | \-\-readahead
+.RB { \fIReadAheadSectors | auto | none }]
+.RB [ \-\-stripes
+.IR Stripes
+.RB [ \-I | \-\-stripesize
+.IR StripeSize ]]]
.RB [ \-\-poolmetadataspare
-.RI { y | n }]
+.RB { y | n }]
+.RB [ \-Z | \-\-zero
+.RB { y | n }]]
.RB [ \-\-commandprofile
.IR ProfileName ]
.RB [ \-h | \-? | \-\-help ]
.RB [ \-v | \-\-verbose ]
.RB [ \-\-version ]
-.IR LogicalVolume { Name | Path }
-.RI [ PhysicalVolume [ Path ][ :PE [ \-PE ]]...]
+.RI [[ ExternalOrigin | ThinPool ] LogicalVolume ]
+.RI [ PhysicalVolume [ Path ]\:[ \fB: \fIPE \fR[ \fB\- PE ]]...]
+.ad b
.sp
-
+.
.SH DESCRIPTION
lvconvert is used to change the segment type (i.e. linear, mirror, etc) or
characteristics of a logical volume. For example, it can add or remove the
@@ -196,7 +208,9 @@ these physical extents. If the conversion frees physical extents
(for example, when converting from a mirror to a linear, or reducing
mirror legs) and you specify one or more PhysicalVolumes,
the freed extents come first from the specified PhysicalVolumes.
+.
.SH OPTIONS
+.
See \fBlvm\fP(8) for common options.
.br
Exactly one of
@@ -217,140 +231,58 @@ Exactly one of
or
.BR \-\-uncache
arguments is required.
-.TP
-.BR \-b ", " \-\-background
+.
+.HP
+.BR \-b ,
+.BR \-\-background
+.br
Run the daemon in the background.
-.TP
-.BR \-H ", " \-\-cache ", " \-\-type\ \fIcache
+.
+.HP
+.BR \-H ,
+.BR \-\-cache ,
+.BR \-\-type\ cache
+.br
Converts logical volume to a cached LV with the use of cache pool
specified with \fB\-\-cachepool\fP.
For more information on cache pool LVs and cache LVs, see \fBlvmcache\fP(7).
-.TP
-.B \-\-cachepolicy \fIpolicy
-Only applicable to cached LVs; see also \fBlvmcache(7)\fP. Sets
-the cache policy. \fImq\fP is the basic policy name. \fIsmq\fP is more advanced
+.
+.HP
+.BR \-\-cachepolicy
+.IR Policy
+.br
+Only applicable to cached LVs; see also \fBlvmcache\fP(7). Sets
+the cache policy. \fBmq\fP is the basic policy name. \fBsmq\fP is more advanced
version available in newer kernels.
-.TP
-.BR \-\-cachepool " " \fICachePoolLV
+.
+.HP
+.BR \-\-cachepool
+.IR CachePoolLV
+.br
This argument is necessary when converting a logical volume to a cache LV.
For more information on cache pool LVs and cache LVs, see \fBlvmcache\fP(7).
-.TP
-.BR \-\-cachesettings " " \fIkey=value
+.
+.HP
+.BR \-\-cachesettings
+.IR Key \fB= Value
+.br
Only applicable to cached LVs; see also \fBlvmcache(7)\fP. Sets
the cache tunable settings. In most use-cases, default values should be adequate.
-Special string value \fIdefault\fP switches setting back to its default kernel value
+Special string value \fBdefault\fP switches setting back to its default kernel value
and removes it from the list of settings stored in lvm2 metadata.
-.TP
-.BR \-m ", " \-\-mirrors " " \fIMirrors
-Specifies the degree of the mirror you wish to create.
-For example, "\fB\-m 1\fP" would convert the original logical
-volume to a mirror volume with 2-sides; that is, a
-linear volume plus one copy. There are two implementations of mirroring
-which correspond to the "\fIraid1\fP" and "\fImirror\fP" segment types. The default
-mirroring segment type is "\fIraid1\fP". If the legacy "\fImirror\fP" segment type
-is desired, the \fB\-\-type\fP argument must be used to explicitly
-select the desired type. The \fB\-\-mirrorlog\fP and \fB\-\-corelog\fP
-options below are only relevant to the legacy "\fImirror\fP" segment type.
-.TP
-.IR \fB\-\-mirrorlog " {" disk | core | mirrored }
-Specifies the type of log to use.
-The default is \fIdisk\fP, which is persistent and requires
-a small amount of storage space, usually on a separate device
-from the data being mirrored.
-\fICore\fP may be useful for short-lived mirrors: It means the mirror is
-regenerated by copying the data from the first device again every
-time the device is activated - perhaps, for example, after every reboot.
-Using \fImirrored\fP will create a persistent log that is itself mirrored.
-.TP
-.B \-\-corelog
-The optional argument \fB\-\-corelog\fP is the same as specifying
-\fB\-\-mirrorlog\fP \fIcore\fP.
-.TP
-.BR \-R ", " \-\-regionsize " " \fIMirrorLogRegionSize
-A mirror is divided into regions of this size (in MB), and the mirror log
-uses this granularity to track which regions are in sync.
-.TP
-.B \-\-type \fISegmentType
-Used to convert a logical volume to another segment type, like
-.IR cache ,
-.IR cache-pool ,
-.IR raid1 ,
-.IR snapshot ,
-.IR thin ,
-or
-.IR thin-pool .
-When converting a logical volume to a cache LV, the
-.B \-\-cachepool
-argument is required.
-When converting a logical volume to a thin LV, the
-.B \-\-thinpool
-argument is required.
-See \fBlvmcache\fP(7) for more info about caching support
-and \fBlvmthin\fP(7) for thin provisioning support.
-.TP
-.BR \-i ", " \-\-interval " " \fISeconds
-Report progress as a percentage at regular intervals.
-.TP
-.B \-\-noudevsync
-Disables udev synchronisation. The
-process will not wait for notification from udev.
-It will continue irrespective of any possible udev processing
-in the background. You should only use this if udev is not running
-or has rules that ignore the devices LVM2 creates.
-.TP
-.B \-\-splitmirrors \fIImages
-The number of redundant \fIImages\fP of a mirror to be split off and used
-to form a new logical volume. A name must be supplied for the
-newly-split-off logical volume using the \fB\-\-name\fP argument, unless
-the \fB\-\-trackchanges\fP argument is given.
-.TP
-.BR \-n ", " \-\-name\ \fIName
-The name to apply to a logical volume which has been split off from
-a mirror logical volume.
-.TP
-.B \-\-trackchanges
-Used with \fB\-\-splitmirrors\fP on a raid1 device, this tracks changes so
-that the read-only detached image can be merged efficiently back into
-the mirror later. Only the regions of the detached device where
-the data changed get resynchronized.
-
-Please note that this feature is only supported with the new md-based mirror
-implementation and not with the original device-mapper mirror implementation.
-.TP
-.B \-\-split
-Separates \fISplitableLogicalVolume\fP.
-Option is agregating various split commands and tries to detect necessary split
-operation from its arguments.
-.TP
-.BR \-\-splitcache
-Separates \fICacheLogicalVolume\fP from cache pool.
-Before the logical volume becomes uncached, cache is flushed.
-The cache pool volume is then left unused and
-could be used e.g. for caching another volume.
-See also the option \fB\-\-uncache\fP for uncaching and removing
-cache pool with one command.
-.TP
-.B \-\-splitsnapshot
-Separates \fISnapshotLogicalVolume\fP from its origin.
-The volume that is split off contains the chunks that differ from the origin
-along with the metadata describing them. This volume can be wiped and then
-destroyed with lvremove.
-The inverse of \fB\-\-snapshot\fP.
-.TP
-.BR \-s ", " \-\-snapshot ", " \-\-type\ \fIsnapshot
-Recreates a snapshot from constituent logical volumes (or copies of them) after
-having been separated using \fB\-\-splitsnapshot\fP.
-For this to work correctly, no changes may be made to the contents
-of either volume after the split.
-.TP
-.BR \-c ", " \-\-chunksize " " \fIChunkSize [ \fIbBsSkKmMgG ]
+.
+.HP
+.BR \-c ,
+.BR \-\-chunksize
+.BR \fIChunkSize [ b | B | s | S | k | K | m | M | g | G ]
+.br
Gives the size of chunk for snapshot, cache pool and thin pool logical volumes.
Default unit is in kilobytes.
.sp
For snapshots the value must be power of 2 between 4KiB and 512KiB
and the default value is 4.
.sp
-For cache pools the value must be between 32KiB and 1GiB and
+For cache the value must be between 32KiB and 1GiB and
the default value is 64.
.sp
For thin pools the value must be between 64KiB and
@@ -361,20 +293,32 @@ The value must be a multiple of 64KiB.
(Early kernel support until thin target version 1.4 required the value
to be a power of 2. Discards weren't supported for non-power of 2 values
until thin target version 1.5.)
-.TP
-.BR \-\-discards " {" \fIignore | \fInopassdown | \fIpassdown }
+.
+.HP
+.BR \-\-corelog
+.br
+The optional argument \fB\-\-corelog\fP is the same as specifying
+\fB\-\-mirrorlog core\fP.
+.
+.HP
+.BR \-\-discards
+.RB { ignore | nopassdown | passdown }
+.br
Specifies whether or not discards will be processed by the thin layer in the
kernel and passed down to the Physical Volume.
Options is currently supported only with thin pools.
-Default is \fIpassdown\fP.
-.TP
-.BR \-Z ", " \-\-zero " {" \fIy | \fIn }
-Controls zeroing of the first 4KiB of data in the snapshot.
-If the volume is read-only the snapshot will not be zeroed.
-For thin pool volumes it controls zeroing of provisioned blocks.
-Note: Provisioning of large zeroed chunks negatively impacts performance.
-.TP
-.B \-\-merge
+Default is \fBpassdown\fP.
+.
+.HP
+.BR \-i ,
+.BR \-\-interval
+.IR Seconds
+.br
+Report progress as a percentage at regular intervals.
+.
+.HP
+.BR \-\-merge
+.br
Merges a snapshot into its origin volume or merges a raid1 image that has
been split from its mirror with \fB\-\-trackchanges\fP back into its mirror.
@@ -391,8 +335,56 @@ origin appear as they were directed to the snapshot being merged. When the
merge finishes, the merged snapshot is removed. Multiple snapshots may
be specified on the commandline or a @tag may be used to specify
multiple snapshots be merged to their respective origin.
-.TP
-.B \-\-originname \fINewExternalOriginVolumeName\fP
+.
+.HP
+.BR \-m ,
+.BR \-\-mirrors
+.IR Mirrors
+.br
+Specifies the degree of the mirror you wish to create.
+For example, "\fB\-m 1\fP" would convert the original logical
+volume to a mirror volume with 2-sides; that is, a
+linear volume plus one copy. There are two implementations of mirroring
+which correspond to the "\fIraid1\fP" and "\fImirror\fP" segment types. The default
+mirroring segment type is "\fIraid1\fP". If the legacy "\fImirror\fP" segment type
+is desired, the \fB\-\-type\fP argument must be used to explicitly
+select the desired type. The \fB\-\-mirrorlog\fP and \fB\-\-corelog\fP
+options below are only relevant to the legacy "\fImirror\fP" segment type.
+.
+.HP
+.BR \-\-mirrorlog
+.RB { disk | core | mirrored }
+.br
+Specifies the type of log to use.
+The default is \fBdisk\fP, which is persistent and requires
+a small amount of storage space, usually on a separate device
+from the data being mirrored.
+\fBCore\fP may be useful for short-lived mirrors: It means the mirror is
+regenerated by copying the data from the first device again every
+time the device is activated - perhaps, for example, after every reboot.
+Using \fBmirrored\fP will create a persistent log that is itself mirrored.
+.
+.HP
+.BR \-n ,
+.BR \-\-name
+.IR Name
+.br
+The name to apply to a logical volume which has been split off from
+a mirror logical volume.
+.
+.HP
+.BR \-\-noudevsync
+.br
+Disables udev synchronisation. The
+process will not wait for notification from udev.
+It will continue irrespective of any possible udev processing
+in the background. You should only use this if udev is not running
+or has rules that ignore the devices LVM2 creates.
+.
+.HP
+.BR \-\-originname
+.IR NewExternalOriginVolumeName
+.br
The new name for original logical volume, which becomes external origin volume
for a thin logical volume that will use given \fB\-\-thinpool\fP.
.br
@@ -400,12 +392,18 @@ Without this option a default name of "lvol<n>" will be generated where
<n> is the LVM internal number of the logical volume.
This volume will be read-only and cannot be further modified as long,
as it is being used as the external origin.
-.TP
-.\" .IR \fB\-\-pooldatasize " " PoolDataVolumeSize [ bBsSkKmMgGtTpPeE ]
+.
+.\" .HP
+.\" .BR \-\-pooldatasize
+.\" .IR PoolDataVolumeSize [ \fBbBsSkKmMgGtTpPeE ]
+.\" .br
.\" Sets the size of pool's data logical volume.
.\" The option \fB\-\-size\fP could be still used with thin pools.
-.\" .TP
-.BR \-\-poolmetadata " " \fIPoolMetadataLogicalVolume { \fIName | \fIPath }
+.
+.HP
+.BR \-\-poolmetadata
+.IR PoolMetadataLogicalVolume
+.br
Specifies cache or thin pool metadata logical volume.
The size should be in between 2MiB and 16GiB.
Cache pool is specified with the option
@@ -426,8 +424,11 @@ thin provisioning tools
.BR thin_repair (8)
and
.BR thin_restore (8).
-.TP
-.BR \-\-poolmetadatasize " " \fIPoolMetadataSize [ \fIbBsSkKmMgG ]
+.
+.HP
+.BR \-\-poolmetadatasize
+.BR \fIPoolMetadataSize [ b | B | s | S | k | K | m | M | g | G ]
+.br
Sets the size of cache or thin pool's metadata logical volume,
if the pool metadata volume is undefined.
Pool is specified with the option
@@ -436,21 +437,38 @@ For thin pool supported value is in the range between 2MiB and 16GiB.
The default value is estimated with this formula
(Pool_LV_size / Pool_LV_chunk_size * 64b).
Default unit is megabytes.
-.TP
-.IR \fB\-\-poolmetadataspare " {" y | n }
+.
+.HP
+.BR \-\-poolmetadataspare
+.RB { y | n }
+.br
Controls creation and maintanence of pool metadata spare logical volume
that will be used for automated pool recovery.
Only one such volume is maintained within a volume group
with the size of the biggest pool metadata volume.
-Default is \fIy\fPes.
-.TP
-.IR \fB\-r ", " \fB\-\-readahead " {" ReadAheadSectors | auto | none }
+Default is \fBy\fPes.
+.
+.HP
+.BR \-r ,
+.BR \-\-readahead
+.RB { \fIReadAheadSectors | auto | none }
+.br
Sets read ahead sector count of thin pool metadata logical volume.
-The default value is "\fIauto\fP" which allows the kernel to choose
+The default value is \fBauto\fP which allows the kernel to choose
a suitable value automatically.
-"\fINone\fP" is equivalent to specifying zero.
-.TP
-.B \-\-repair
+\fBNone\fP is equivalent to specifying zero.
+.
+.HP
+.BR \-R ,
+.BR \-\-regionsize
+.IR MirrorLogRegionSize
+.br
+A mirror is divided into regions of this size (in MB), and the mirror log
+uses this granularity to track which regions are in sync.
+.
+.HP
+.BR \-\-repair
+.br
Repair a mirror after suffering a disk failure or try to fix thin pool metadata.
The mirror will be brought back into a consistent state.
@@ -459,8 +477,8 @@ restored if possible. Specify \fB\-y\fP on the command line to skip
the prompts. Use \fB\-f\fP if you do not want any replacement.
Additionally, you may use \fB\-\-use\-policies\fP to use the device
replacement policy specified in \fBlvm.conf\fP(5),
-viz. activation/mirror_log_fault_policy or
-activation/mirror_device_fault_policy.
+see \fBactivation/mirror_log_fault_policy\fP or
+\fBactivation/mirror_device_fault_policy\fP.
Thin pool repair automates the use of \fBthin_repair\fP(8) tool.
Only inactive thin pool volumes can be repaired.
@@ -468,8 +486,11 @@ There is no validation of metadata between kernel and lvm2.
This requires further manual work.
After successfull repair the old unmodified metadata are still
available in "<pool>_meta<n>" LV.
-.TP
-.B \-\-replace \fIPhysicalVolume
+.
+.HP
+.BR \-\-replace
+.IR PhysicalVolume
+.br
Remove the specified device (\fIPhysicalVolume\fP) and replace it with one
that is available in the volume group or from the specific list provided.
This option is only available to RAID segment types
@@ -477,43 +498,146 @@ This option is only available to RAID segment types
.IR raid1 ,
.IR raid5 ,
etc).
-.TP
-.BR \-\-stripes " " \fIStripes
+.
+.HP
+.BR \-\-splitmirrors
+.IR Images
+.br
+The number of redundant \fIImages\fP of a mirror to be split off and used
+to form a new logical volume. A name must be supplied for the
+newly-split-off logical volume using the \fB\-\-name\fP argument, unless
+the \fB\-\-trackchanges\fP argument is given.
+.
+.HP
+.BR \-s ,
+.BR \-\-snapshot ,
+.BR \-\-type\ snapshot
+.br
+Recreates a snapshot from constituent logical volumes (or copies of them) after
+having been separated using \fB\-\-splitsnapshot\fP.
+For this to work correctly, no changes may be made to the contents
+of either volume after the split.
+.
+.HP
+.BR \-\-split
+.br
+Separates \fISplitableLogicalVolume\fP.
+Option is agregating various split commands and tries to detect necessary split
+operation from its arguments.
+.
+.HP
+.BR \-\-splitcache
+.br
+Separates \fICacheLogicalVolume\fP from cache pool.
+Before the logical volume becomes uncached, cache is flushed.
+The cache pool volume is then left unused and
+could be used e.g. for caching another volume.
+See also the option \fB\-\-uncache\fP for uncaching and removing
+cache pool with one command.
+.
+.HP
+.BR \-\-splitsnapshot
+.br
+Separates \fISnapshotLogicalVolume\fP from its origin.
+The volume that is split off contains the chunks that differ from the origin
+along with the metadata describing them. This volume can be wiped and then
+destroyed with lvremove.
+The inverse of \fB\-\-snapshot\fP.
+.
+.HP
+.BR \-\-stripes
+.IR Stripes
+.br
Gives the number of stripes.
This is equal to the number of physical volumes to scatter
the logical volume. This does not apply to existing allocated
space, only newly allocated space can be striped.
-.TP
-.BR \-I ", " \-\-stripesize " " \fIStripeSize
+.
+.HP
+.BR \-I ,
+.BR \-\-stripesize
+.IR StripeSize
+.br
Gives the number of kilobytes for the granularity of the stripes.
.br
StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
For metadata in LVM2 format, the stripe size may be a larger
power of 2 but must not exceed the physical extent size.
-.TP
-.IR \fB\-T ", " \fB\-\-thin ", " \fB\-\-type " " thin
+.
+.HP
+.BR \-T ,
+.BR \-\-thin ,
+.BR \-\-type
+.BR thin
+.br
Converts the logical volume into a thin logical volume of the thin pool
specified with \fB\-\-thinpool\fP. The original logical volume
-.I ExternalOriginLogicalVolume
+\fIExternalOriginLogicalVolume\fP
is renamed into a new read-only logical volume.
For the non-default name for this volume use \fB\-\-originname\fP.
The volume cannot be further modified as long as it is used as an
external origin volume for unprovisioned areas of any thin logical volume.
-.TP
-.IR \fB\-\-thinpool " " ThinPoolLogicalVolume { Name | Path }
+.
+.HP
+.BR \-\-thinpool
+.IR ThinPoolLogicalVolume
+.br
Specifies or converts logical volume into a thin pool's data volume.
Content of converted volume is lost.
Thin pool's metadata logical volume can be specified with the option
\fB\-\-poolmetadata\fP or allocated with \fB\-\-poolmetadatasize\fP.
See \fBlvmthin\fP(7) for more info about thin provisioning support.
-.TP
+.
+.HP
+.BR \-\-trackchanges
+.br
+Used with \fB\-\-splitmirrors\fP on a raid1 device, this tracks changes so
+that the read-only detached image can be merged efficiently back into
+the mirror later. Only the regions of the detached device where
+the data changed get resynchronized.
+
+Please note that this feature is only supported with the new md-based mirror
+implementation and not with the original device-mapper mirror implementation.
+.
+.HP
+.BR \-\-type
+.IR SegmentType
+.br
+Used to convert a logical volume to another segment type, like
+.BR cache ,
+.BR cache-pool ,
+.BR raid1 ,
+.BR snapshot ,
+.BR thin ,
+or
+.BR thin-pool .
+When converting a logical volume to a cache LV, the
+\fB\-\-cachepool\fP argument is required.
+When converting a logical volume to a thin LV, the
+\fB\-\-thinpool\fP argument is required.
+See \fBlvmcache\fP(7) for more info about caching support
+and \fBlvmthin\fP(7) for thin provisioning support.
+.
+.HP
.BR \-\-uncache
+.br
Uncaches \fICacheLogicalVolume\fP.
Before the volume becomes uncached, cache is flushed.
Unlike with \fB\-\-splitcache\fP the cache pool volume is removed.
This option could be seen as an inverse of \fB\-\-cache\fP.
-
+.
+.HP
+.BR \-Z ,
+.BR \-\-zero
+.RB { y | n }
+.br
+Controls zeroing of the first 4KiB of data in the snapshot.
+If the volume is read-only the snapshot will not be zeroed.
+For thin pool volumes it controls zeroing of provisioned blocks.
+Note: Provisioning of large zeroed chunks negatively impacts performance.
+.
.SH Examples
+.
Converts the linear logical volume "vg00/lvol1" to a two-way mirror
logical volume:
.sp
7 years
master - cache: add kernel_cache_policy option
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88ce15004e414a...
Commit: 88ce15004e414a64a3f967908cb2721671a191ba
Parent: 3d610fabbdb5f63e6e46661f7080f74852b118b0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 2 11:12:46 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 3 10:14:23 2016 +0100
cache: add kernel_cache_policy option
Pair kernel_cache_settings with kernel_cache_policy.
There is very small chance in error case that the value in table
might be differnet from the value stored in metadata
so make it 'checkable'.
---
WHATS_NEW | 1 +
lib/report/columns.h | 1 +
lib/report/properties.c | 2 ++
lib/report/report.c | 14 ++++++++++++++
4 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7602fa4..668e8a4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.145 -
=====================================
+ Add kernel_cache_policy lvs field.
Display [unknown] instead of 'unknown device' in pvs output.
Fix error path when pvcreate allocation fails (2.02.144).
Display [unknown] instead of blank for unknown VG names in pvs output.
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 040caf3..56a8628 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -113,6 +113,7 @@ FIELD(LVSSTATUS, lv, NUM, "CacheReadMisses", lvid, 16, cache_read_misses, cache_
FIELD(LVSSTATUS, lv, NUM, "CacheWriteHits", lvid, 16, cache_write_hits, cache_write_hits, "Cache write hits.", 0)
FIELD(LVSSTATUS, lv, NUM, "CacheWriteMisses", lvid, 16, cache_write_misses, cache_write_misses, "Cache write misses.", 0)
FIELD(LVSSTATUS, lv, STR_LIST, "KCache Settings", lvid, 18, kernel_cache_settings, kernel_cache_settings, "Cache settings/parameters as set in kernel, including default values (cached segments only).", 0)
+FIELD(LVSSTATUS, lv, STR, "KCache Policy", lvid, 18, kernel_cache_policy, kernel_cache_policy, "Cache policy used in kernel.", 0)
FIELD(LVSSTATUS, lv, STR, "Health", lvid, 15, lvhealthstatus, lv_health_status, "LV health status.", 0)
FIELD(LVSSTATUS, lv, STR, "KDiscards", lvid, 8, kdiscards, kernel_discards, "For thin pools, how discards are handled in kernel.", 0)
FIELD(LVSSTATUS, lv, BIN, "CheckNeeded", lvid, 15, lvcheckneeded, lv_check_needed, "For thin pools, whether metadata check is needed.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 024919c..76a72be 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -489,6 +489,8 @@ GET_LVSEG_STR_PROPERTY_FN(seg_monitor, lvseg_monitor_dup(lvseg->lv->vg->vgmem, l
#define _cache_settings_set prop_not_implemented_set
#define _kernel_cache_settings_get prop_not_implemented_get
#define _kernel_cache_settings_set prop_not_implemented_set
+#define _kernel_cache_policy_get prop_not_implemented_get
+#define _kernel_cache_policy_set prop_not_implemented_set
/* PVSEG */
GET_PVSEG_NUM_PROPERTY_FN(pvseg_start, pvseg->pe)
diff --git a/lib/report/report.c b/lib/report/report.c
index 39dbb67..ff54cc4 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1499,6 +1499,20 @@ out:
return r;
}
+static int _kernel_cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
+
+ if ((lvdm->seg_status.type == SEG_STATUS_CACHE) &&
+ lvdm->seg_status.cache->policy_name)
+ return _string_disp(rh, mem, field, &lvdm->seg_status.cache->policy_name, NULL);
+
+ return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
+ GET_FIELD_RESERVED_VALUE(cache_policy_undef));
+}
+
static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
7 years