diff --git a/WHATS_NEW b/WHATS_NEW index 6d51ab0d0..8c465bde7 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix PV datalignment for values starting prior to MDA area. (2.02.45) Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). Add lvs origin_size field. Fix linux configure --enable-debug to exclude -O2. diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 5488d32be..4181335e1 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1372,7 +1372,9 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume dm_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 <= lvm_getpagesize() && + pv->pe_start < (lvm_getpagesize() >> 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/test/t-pvcreate-usage.sh b/test/t-pvcreate-usage.sh index dc4537e90..eabdd5d1e 100755 --- a/test/t-pvcreate-usage.sh +++ b/test/t-pvcreate-usage.sh @@ -94,6 +94,12 @@ check_pv_field_ $dev1 pe_start 512.00K pvcreate --metadatasize 100k --dataalignment 100k $dev1 check_pv_field_ $dev1 pe_start 200.00K +pvcreate --metadatasize 128k --dataalignment 3.5k $dev1 +check_pv_field_ $dev1 pe_start 133.00K + +pvcreate --metadatasize 128k --metadatacopies 2 --dataalignment 3.5k $dev1 +check_pv_field_ $dev1 pe_start 133.00K + #COMM 'pv with LVM1 compatible data alignment can be convereted' #compatible == LVM1_PE_ALIGN == 64k pvcreate --dataalignment 256k $dev1