[dm-devel] [PATCH 6 of 10] LVM: allow lv_add_segment to use log_areas

Jonathan Brassow jbrassow at redhat.com
Thu Oct 8 21:19:17 UTC 2009


Patch name: lvm-allow-lv_add_segment-to-use-log_areas.patch

Use the (so far unused) parameter 'log_lv' to determine
whether or not to allocate from 'alloced_areas' or
'log_areas'.

RFC: Jonathan Brassow <jbrassow at redhat.com>

Index: LVM2/lib/metadata/lv_manip.c
===================================================================
--- LVM2.orig/lib/metadata/lv_manip.c
+++ LVM2/lib/metadata/lv_manip.c
@@ -1386,6 +1386,18 @@ int lv_add_segment(struct alloc_handle *
 		   uint32_t region_size,
 		   struct logical_volume *log_lv)
 {
+	int i;
+	struct dm_list *aa_list;
+
+	/*
+	 * We don't actually use the 'log_lv' parameter for anything more
+	 * than just figuring out that this allocation is for a log device
+	 * It'd be nice to change the arguments type, but the function is
+	 * exported.
+	 */
+	aa_list = (log_lv) ? &ah->log_areas :
+		&ah->alloced_areas[first_area];
+
 	if (!segtype) {
 		log_error("Missing segtype in lv_add_segment().");
 		return 0;
@@ -1396,10 +1408,8 @@ int lv_add_segment(struct alloc_handle *
 		return 0;
 	}
 
-	if (!_setup_alloced_segments(lv, &ah->alloced_areas[first_area],
-				     num_areas, status,
-				     stripe_size, segtype,
-				     region_size))
+	if (!_setup_alloced_segments(lv, aa_list, num_areas, status,
+				     stripe_size, segtype, region_size))
 		return_0;
 
 	if ((segtype->flags & SEG_CAN_SPLIT) && !lv_merge_segments(lv)) {




More information about the dm-devel mailing list