Skip to contentSkip to conversation

master - thin: simplify thin volume creation

PATCH Zdenek Kabelac 1 participant 1 message Oct 26, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ff2e8b0de6aafcf304b30e5f90501f3638ead22f
Commit:        ff2e8b0de6aafcf304b30e5f90501f3638ead22f
Parent:        52dfa6dd4491fd6f584b83d0924b82bea3bc1092
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sun Oct 26 08:13:59 2014 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sun Oct 26 18:37:13 2014 +0100

thin: simplify thin volume creation

Move code for creation of thin volume into a single place out of lv_extend(). This allows to drop extra pool arg for alloc_lv_segment() && lv_extend() and makes code more easier to read and follow.

---
 lib/format1/import-extents.c     |    4 +-
 lib/format_pool/import_export.c  |    4 +-
 lib/format_text/import_vsn1.c    |    2 +-
 lib/metadata/lv_alloc.h          |    5 +-
 lib/metadata/lv_manip.c          |  135 ++++++++++++-------------------------
 lib/metadata/merge.c             |    2 +-
 lib/metadata/metadata-exported.h |    2 +-
 lib/metadata/pool_manip.c        |    2 +-
 tools/lvconvert.c                |    2 +-
 9 files changed, 54 insertions(+), 104 deletions(-)
lib/format1/import-extents.c +2 -2
index f0f4f65..bfcf0de 100644
@@ -226,7 +226,7 @@ static int _read_linear(struct cmd_context *cmd, struct lv_map *lvm)
 		len = _area_length(lvm, le);
 
 		if (!(seg = alloc_lv_segment(segtype, lvm->lv, le, len, 0, 0,
-					     NULL, NULL, 1, len, 0, 0, 0, NULL))) {
+					     NULL, 1, len, 0, 0, 0, NULL))) {
 			log_error("Failed to allocate linear segment.");
 			return 0;
 		}
@@ -298,7 +298,7 @@ static int _read_stripes(struct cmd_context *cmd, struct lv_map *lvm)
 		if (!(seg = alloc_lv_segment(segtype, lvm->lv,
 					     lvm->stripes * first_area_le,
 					     lvm->stripes * area_len,
-					     0, lvm->stripe_size, NULL, NULL,
+					     0, lvm->stripe_size, NULL,
 					     lvm->stripes,
 					     area_len, 0, 0, 0, NULL))) {
 			log_error("Failed to allocate striped segment.");
lib/format_pool/import_export.c +2 -2
index 6ef0757..1aeabe2 100644
@@ -194,7 +194,7 @@ static int _add_stripe_seg(struct dm_pool *mem,
 
 	if (!(seg = alloc_lv_segment(segtype, lv, *le_cur,
 				     area_len * usp->num_devs, 0,
-				     usp->striping, NULL, NULL, usp->num_devs,
+				     usp->striping, NULL, usp->num_devs,
 				     area_len, 0, 0, 0, NULL))) {
 		log_error("Unable to allocate striped lv_segment structure");
 		return 0;
@@ -234,7 +234,7 @@ static int _add_linear_seg(struct dm_pool *mem,
 
 		if (!(seg = alloc_lv_segment(segtype, lv, *le_cur,
 					     area_len, 0, usp->striping,
-					     NULL, NULL, 1, area_len,
+					     NULL, 1, area_len,
 					     POOL_PE_SIZE, 0, 0, NULL))) {
 			log_error("Unable to allocate linear lv_segment "
 				  "structure");
lib/format_text/import_vsn1.c +1 -1
index 1783b1e..c6a0cf9 100644
@@ -363,7 +363,7 @@ static int _read_segment(struct logical_volume *lv, const struct dm_config_node
 		return_0;
 
 	if (!(seg = alloc_lv_segment(segtype, lv, start_extent,
-				     extent_count, 0, 0, NULL, NULL, area_count,
+				     extent_count, 0, 0, NULL, area_count,
 				     extent_count, 0, 0, 0, NULL))) {
 		log_error("Segment allocation failed");
 		return 0;
lib/metadata/lv_alloc.h +1 -4
index 9824c67..1ac3f1f 100644
@@ -24,7 +24,6 @@ struct lv_segment *alloc_lv_segment(const struct segment_type *segtype,
 				    uint64_t status,
 				    uint32_t stripe_size,
 				    struct logical_volume *log_lv,
-				    struct logical_volume *thin_pool_lv,
 				    uint32_t area_count,
 				    uint32_t area_len,
 				    uint32_t chunk_size,
@@ -79,9 +78,7 @@ int lv_add_mirror_lvs(struct logical_volume *lv,
 int lv_add_log_segment(struct alloc_handle *ah, uint32_t first_area,
 		       struct logical_volume *log_lv, uint64_t status);
 int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status,
-                           uint32_t extents,
-			   const struct segment_type *segtype,
-			   const char *thin_pool_name);
+			   uint32_t extents, const struct segment_type *segtype);
 
 void alloc_destroy(struct alloc_handle *ah);
 
lib/metadata/lv_manip.c +44 -91

302 lines not on this page · raw message

lib/metadata/merge.c +1 -1
index c8c9543..5e09123 100644
@@ -489,7 +489,7 @@ static int _lv_split_segment(struct logical_volume *lv, struct lv_segment *seg,
 	if (!(split_seg = alloc_lv_segment(seg->segtype,
 					   seg->lv, seg->le, seg->len,
 					   seg->status, seg->stripe_size,
-					   seg->log_lv, seg->pool_lv,
+					   seg->log_lv,
 					   seg->area_count, seg->area_len,
 					   seg->chunk_size, seg->region_size,
 					   seg->extents_copied, seg->pvmove_source_seg))) {
lib/metadata/metadata-exported.h +1 -1
index d05333c..5ac68bf 100644
@@ -709,7 +709,7 @@ int lv_extend(struct logical_volume *lv,
 	      const struct segment_type *segtype,
 	      uint32_t stripes, uint32_t stripe_size,
 	      uint32_t mirrors, uint32_t region_size,
-	      uint32_t extents, const char *thin_pool_name,
+	      uint32_t extents,
 	      struct dm_list *allocatable_pvs, alloc_policy_t alloc,
 	      int approx_alloc);
 
lib/metadata/pool_manip.c +1 -1
index b4259a8..b84950c 100644
@@ -638,7 +638,7 @@ int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents,
 		       seg->stripe_size,
 		       seg_mirrors,
 		       seg->region_size,
-		       extents - lv->le_count, NULL,
+		       extents - lv->le_count,
 		       pvh, lv->alloc, 0))
 		return_0;
 
tools/lvconvert.c +1 -1
index 6d6d305..f22c84b 100644
@@ -3088,7 +3088,7 @@ static int _lvconvert_pool(struct cmd_context *cmd,
 
 	/* Allocate a new pool segment */
 	if (!(seg = alloc_lv_segment(lp->segtype, pool_lv, 0, data_lv->le_count,
-				     pool_lv->status, 0, NULL, NULL, 1,
+				     pool_lv->status, 0, NULL, 1,
 				     data_lv->le_count, 0, 0, 0, NULL)))
 		return_0;