1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/format_text
Peter Rajnoha 303e86adc8 pvcreate: fix alignment to incorporate alignment offset if PV has 0 MDAs
If zero metadata copies are used, there's no further recalculation of
PV alignment that happens when adding metadata areas to the PV and
which actually calculates the alignment correctly as a matter of fact.
So fix this for "PV without MDA" case as well.

Before this patch:
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 1 /dev/sda
  Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
  PV         1st PE
  /dev/sda    12.00m
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 0 /dev/sda
  Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
  PV         1st PE
  /dev/sda     8.00m

After this patch:
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 1 /dev/sda
  Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
  PV         1st PE
  /dev/sda    12.00m
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 0 /dev/sda
  Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
  PV         1st PE
  /dev/sda    12.00m

Also, remove a superfluous condition "pv->pe_start < pv->pe_align" in:
  if (pe_start == PV_PE_START_CALC && pv->pe_start < pv->pe_align)
    pv->pe_start = pv->pe_align ...
This part of the condition is not reachable as with the PV_PE_START_CALC,
we always have pv->pe_start set to 0 from the PV struct initialisation
(...the pv->pe_start value is just being calculated).
2013-02-21 14:51:19 +01:00
..
archive.c cleanup: drop unneeded included header files 2012-08-23 14:37:20 +02:00
archiver.c thin: allow restore with --force 2012-11-27 14:08:24 +01:00
archiver.h thin: allow restore with --force 2012-11-27 14:08:24 +01:00
export.c logging: classify log_debug messages 2013-01-07 22:30:29 +00:00
flags.c cleanup: switch log_error to log_warn 2012-10-17 15:41:35 +02:00
format-text.c pvcreate: fix alignment to incorporate alignment offset if PV has 0 MDAs 2013-02-21 14:51:19 +01:00
format-text.h Move lvmcache data structures behind an API (making the structures private to 2012-02-10 01:28:27 +00:00
import_vsn1.c fix: 'Couldn't read extent size' --> '... extent start' 2013-02-21 13:33:27 +01:00
import-export.h Pass 'single_device' parameter down to suppress 'Can't find uuid' messages 2012-02-29 02:35:35 +00:00
import.c cleanup: drop unneeded included header files 2012-08-23 14:37:20 +02:00
layout.h Move lvmcache data structures behind an API (making the structures private to 2012-02-10 01:28:27 +00:00
tags.c Move the core of the lib/config/config.c functionality into libdevmapper, 2011-08-30 14:55:15 +00:00
text_export.h Move the core of the lib/config/config.c functionality into libdevmapper, 2011-08-30 14:55:15 +00:00
text_import.h Replace const usage of dm_config_find_node with more appropriate value-lookup 2011-08-31 15:19:19 +00:00
text_label.c logging: classify log_debug messages 2013-01-07 22:30:29 +00:00