Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/metadata.c lib/d ...

PATCH [email protected] 1 participant 1 message Sep 19, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-09-19 05:19:09

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : metadata.c 
	lib/device     : dev-md.c device.h 

Log message:
adjust pe_align for md chunk size

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.957&r2=1.958
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.188&r2=1.189
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-md.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36

WHATS_NEW +1 -1
@@ -1,6 +1,6 @@
 Version 2.02.40 - 
 ================================
-  Pass struct physical_volume to pe_align.
+  Pass struct physical_volume to pe_align and adjust for md chunk size.
   Store sysfs location in struct cmd_context.
   Avoid shuffling remaining mirror images when removing one, retaining primary.
   Add missing LV error target activation in _remove_mirror_images.
lib/metadata/metadata.c +13 -2
@@ -66,9 +66,20 @@
 
 unsigned long pe_align(struct physical_volume *pv)
 {
-	if (!pv->pe_align)
-		pv->pe_align = MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
+	if (pv->pe_align)
+		goto out;
 
+	pv->pe_align = MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
+
+	/*
+	 * Align to chunk size of underlying md device if present
+	 */
+	if (pv->dev)
+		pv->pe_align = MAX(pv->pe_align,
+				   dev_md_chunk_size(pv->fmt->cmd->sysfs_dir,
+						     pv->dev));
+
+out:
 	return pv->pe_align;
 }
 
lib/device/dev-md.c +64 -1

86 lines not on this page · raw message

lib/device/device.h +1 -0
@@ -93,6 +93,7 @@
 
 /* Does device contain md superblock?  If so, where? */
 int dev_is_md(struct device *dev, uint64_t *sb);
+unsigned long dev_md_chunk_size(const char *sysfs_dir, struct device *dev);
 
 int is_partitioned_dev(struct device *dev);