[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH LVM2] Use parallel areas constraint for mirror log addition



Hi,

This patch fixes the problem that lvconvert-ing corelog mirror
to disklog mirror allocates the mirror log on the same device
with the mirror images, which is not good from both performance
and redundancy view point.

Example of "lvs -a -o lv_name,devices" after lvconvert:
  LV             Devices
  lv0            lv0_mimage_0(0),lv0_mimage_1(0)
  [lv0_mimage_0] /dev/mapper/pv0(0)
  [lv0_mimage_1] /dev/mapper/pv1(0)
  [lv0_mlog]     /dev/mapper/pv1(1)

Shell script to reproduce the problem and the sample metadata
is attached for reference.
You can reproduce the problem with just executing the script
without additional parameters.



While this patch fixes the most simple case (i.e. the original
LV is contiguous), there is another problem not yet fixed:
  if the original LV was split into multiple segments,
  the log device allocation only the PVs used for the first segment.
Key to fix the another problem is avoiding all PVs in ah->parallel_areas
for the log device allocation instead of the subset of it.

There were attempts to fix it along with other allocation issues
but not yet accpeted for some reasons.

  [PATCH LVM2 0/2] fix alloc anywhere and addition of disklog
  https://www.redhat.com/archives/linux-lvm/2006-September/msg00108.html

  [PATCH LVM2] (0/12) LVM2 allocation rewrites
  https://www.redhat.com/archives/lvm-devel/2006-October/msg00030.html

I'm trying to find less intrusive approach to fix it.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
lvconvert() should use build_parallel_areas_from_lv() to
avoid the log device allocation on the same PV with mirror images.

Patch applicable to LVM2 2.02.16.

---
 tools/lvconvert.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Index: LVM2.cvs/tools/lvconvert.c
===================================================================
--- LVM2.cvs.orig/tools/lvconvert.c	2006-12-13 00:08:43.000000000 -0500
+++ LVM2.cvs/tools/lvconvert.c	2006-12-13 00:08:47.000000000 -0500
@@ -281,15 +281,10 @@ static int lvconvert_mirrors(struct cmd_
 			if (lp->mirrors == existing_mirrors) {
 				if (!seg->log_lv && !arg_count(cmd, corelog_ARG)) {
 					/* No disk log present, add one. */
-					/* FIXME: Why doesn't this work?  Without
-					   it, we will probably put the log on the
-					   same device as a mirror leg.
-					  if (!(parallel_areas = build_parallel_areas_from_lv(cmd, lv))) {
-					  stack;
-					  return 0;
-					  }
-					*/
-					parallel_areas = NULL;
+					if (!(parallel_areas = build_parallel_areas_from_lv(cmd, lv))) {
+						stack;
+						return 0;
+					}
 					if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
 						log_error("Unable to determine mirror sync status.");
 						return 0;

Attachment: lvm2-addlog-2PV.sh
Description: Bourne shell script

# Generated by LVM2: Tue Dec 12 23:37:16 2006

contents = "Text Format Volume Group"
version = 1

description = "Created *before* executing 'lvconvert -m1 vg0/lv0'"

creation_host = "tetsuo.lab"	# Linux tetsuo.lab 2.6.18-1.2839.el5 #1 SMP Wed Dec 6 01:01:57 EST 2006 i686
creation_time = 1165984636	# Tue Dec 12 23:37:16 2006

vg0 {
	id = "VtEj9d-3Lfb-5I50-kFfK-VS0F-tLJD-OVKpBk"
	seqno = 2
	status = ["RESIZEABLE", "READ", "WRITE"]
	extent_size = 8192		# 4 Megabytes
	max_lv = 0
	max_pv = 0

	physical_volumes {

		pv0 {
			id = "Qec4pp-Skg2-4wpk-97lm-cA2W-oRXX-WWLHyp"
			device = "/dev/mapper/pv0"	# Hint only

			status = ["ALLOCATABLE"]
			dev_size = 40960	# 20 Megabytes
			pe_start = 384
			pe_count = 4	# 16 Megabytes
		}

		pv1 {
			id = "0M3wt3-tX2s-xFuS-kB1z-WETR-12I0-sTkFKK"
			device = "/dev/mapper/pv1"	# Hint only

			status = ["ALLOCATABLE"]
			dev_size = 40960	# 20 Megabytes
			pe_start = 384
			pe_count = 4	# 16 Megabytes
		}
	}

	logical_volumes {

		lv0 {
			id = "nn8RVr-ebk7-EeUc-IdYg-WRbb-zmlV-kWFHER"
			status = ["READ", "WRITE", "VISIBLE"]
			segment_count = 1

			segment1 {
				start_extent = 0
				extent_count = 1	# 4 Megabytes

				type = "mirror"
				mirror_count = 2
				region_size = 1024

				mirrors = [
					"lv0_mimage_0", 0,
					"lv0_mimage_1", 0
				]
			}
		}

		lv0_mimage_0 {
			id = "DdRgxZ-PBJy-Zc5j-v20B-GVSY-BGbT-kja7dd"
			status = ["READ", "WRITE"]
			segment_count = 1

			segment1 {
				start_extent = 0
				extent_count = 1	# 4 Megabytes

				type = "striped"
				stripe_count = 1	# linear

				stripes = [
					"pv0", 0
				]
			}
		}

		lv0_mimage_1 {
			id = "eOELFy-DAgs-81dx-mtNu-p3W1-Oolp-wHP0eq"
			status = ["READ", "WRITE"]
			segment_count = 1

			segment1 {
				start_extent = 0
				extent_count = 1	# 4 Megabytes

				type = "striped"
				stripe_count = 1	# linear

				stripes = [
					"pv1", 0
				]
			}
		}
	}
}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]