From 94d501edd9e8954e505668357ac6373ff2bd1413 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 17 Aug 2006 19:53:36 +0000 Subject: [PATCH] Fix PE_ALIGN for pagesize over 32KB. --- WHATS_NEW | 1 + lib/format_text/format-text.c | 2 +- lib/metadata/metadata.c | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 30c54d689..c210957f7 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.09 - ================================== + Fix PE_ALIGN for pagesize over 32KB. Separate out LVM1_PE_ALIGN and pe_align(). Add lvm_getpagesize wrapper. Add --maxphysicalvolumes to vgchange. diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 2647a03f7..56318ea05 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1193,7 +1193,7 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume list_iterate_items(mda, &info->mdas) { mdac = (struct mda_context *) mda->metadata_locn; if (pv->dev == mdac->area.dev && - (mdac->area.start < (pv->pe_start << SECTOR_SHIFT)) && + (mdac->area.start <= (pv->pe_start << SECTOR_SHIFT)) && (mdac->area.start + mdac->area.size > (pv->pe_start << SECTOR_SHIFT))) { pv->pe_start = (mdac->area.start + mdac->area.size) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index a04ab9371..f565329bb 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -24,9 +24,11 @@ #include "pv_alloc.h" #include "activate.h" +#include + unsigned long pe_align(void) { - return (65536UL >> SECTOR_SHIFT); + return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT; } static int _add_pv_to_vg(struct format_instance *fid, struct volume_group *vg,