Skip to contentSkip to conversation

master - cleanup: consolidate lv_layout and lv_role reporting

PATCH Peter Rajnoha 1 participant 1 message Aug 25, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f4e56b28299680783b8375235bdd2bd48a9934e5
Commit:        f4e56b28299680783b8375235bdd2bd48a9934e5
Parent:        2d344c2e4509af34df219a0c9727902ab73b219c
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Mon Aug 25 10:02:32 2014 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Mon Aug 25 16:14:40 2014 +0200

cleanup: consolidate lv_layout and lv_role reporting

This patch makes the keyword combinations found in "lv_layout" and "lv_role" much more understandable - there were some ambiguities for some of the combinations which lead to confusion before.

Now, the scheme used is:

LAYOUTS ("how the LV is laid out"):
===================================
[linear] (all segments have number of stripes = 1)

[striped] (all segments have number of stripes > 1)

[linear,striped] (mixed linear and striped)

raid (raid layout always reported together with raid level, raid layout == image + metadata LVs underneath that make up raid LV)
[raid,raid1]
[raid,raid10]
[raid,raid4]
[raid,raid5] (exact sublayout not specified during creation - default one used - raid5_ls)

    [raid,raid5,raid5_ls]
    [raid,raid5,raid6_rs]
    [raid,raid5,raid5_la]
    [raid,raid5,raid5_ra]
  [raid6,raid] (exact sublayout not specified during creation - default one used - raid6_zr)
    [raid,raid6,raid6_zr]
    [raid,raid6,raid6_nc]
    [raid,raid6,raid6_ns]

[mirror] (mirror layout == log + image LVs underneath that make up mirror LV)

thin (thin layout always reported together with sublayout)
[thin,sparse] (thin layout == allocated out of thin pool)
[thin,pool] (thin pool layout == data + metadata volumes underneath that make up thin pool LV, not supposed to be used for direct use!!!)

[cache] (cache layout == allocated out of cache pool in conjunction with cache origin)
[cache,pool] (cache pool layout == data + metadata volumes underneath that make up cache pool LV, not supposed to be used for direct use!!!)

[virtual] (virtual layout == not hitting disk underneath, currently this layout denotes only 'zero' device used for origin,thickorigin role)

[unknown] (either error state or missing recognition for such layout)

ROLES ("what's the purpose or use of the LV - what is its role"):
=================================================================
- each LV has either of these two roles at least: [public] (public LV that users may use freely to write their data to)

[public] (public LV that users may use freely to write their data to)
[private] (private LV that LVM maintains; not supposed to be directly used by user to write his data to)

- and then some special-purpose roles in addition to that:

[origin,thickorigin] (origin for thick-style snapshot; "thick" as opposed to "thin") [origin,multithickorigin] (there are more than 2 thick-style snapshots for this origin) [origin,thinorigin] (origin for thin snapshot)
[origin,multithinorigin] (there are more than 2 thin snapshots for this origin) [origin,extorigin] (external origin for thin snapshot) [origin,multiextoriginl (there are more than 2 thin snapshots using this external origin) [origin,cacheorigin] (cache origin)

[snapshot,thicksnapshot] (thick-style snapshot; "thick" as opposed to "thin") [snapshot,thinsnapshot] (thin-style snapshot)

[raid,metadata] (raid metadata LV)
[raid,image] (raid image LV)

[mirror,image] (mirror image LV)
[mirror,log] (mirror log LV)
[pvmove] (pvmove LV)

[thin,pool,data] (thin pool data LV)
[thin,pool,metadata] (thin pool metadata LV)

[cache,pool,data] (cache pool data LV)
[cache,pool,metadata] (cache pool metadata LV)

[pool,spare] (pool spare LV - common role of LV that makes it used for both thin and cache repairs)

---
 lib/datastruct/str_list.c |   17 ++-
 lib/datastruct/str_list.h |    1 +
 lib/metadata/lv_manip.c   |  375 +++++++++++++++++++++++++++------------------
 3 files changed, 238 insertions(+), 155 deletions(-)
lib/datastruct/str_list.c +15 -2
index 3e429ab..feec8b6 100644
@@ -30,7 +30,7 @@ struct dm_list *str_list_create(struct dm_pool *mem)
 	return sl;
 }
 
-int str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str)
+static int _str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str, int as_first)
 {
 	struct dm_str_list *sln;
 
@@ -41,11 +41,24 @@ int str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const ch
 		return_0;
 
 	sln->str = str;
-	dm_list_add(sll, &sln->list);
+	if (as_first)
+		dm_list_add_h(sll, &sln->list);
+	else
+		dm_list_add(sll, &sln->list);
 
 	return 1;
 }
 
+int str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str)
+{
+	return _str_list_add_no_dup_check(mem, sll, str, 0);
+}
+
+int str_list_add_h_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str)
+{
+	return _str_list_add_no_dup_check(mem, sll, str, 1);
+}
+
 int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str)
 {
 	if (!str)
lib/datastruct/str_list.h +1 -0
index a052df6..0046fe4 100644
@@ -22,6 +22,7 @@ struct dm_pool;
 struct dm_list *str_list_create(struct dm_pool *mem);
 int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str);
 int str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str);
+int str_list_add_h_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str);
 void str_list_del(struct dm_list *sll, const char *str);
 int str_list_match_item(const struct dm_list *sll, const char *str);
 int str_list_match_list(const struct dm_list *sll, const struct dm_list *sll2, const char **tag_matched);
lib/metadata/lv_manip.c +222 -153

558 lines not on this page · raw message