1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

Relax restriction on pe_start location when re-writing LVM1 metadata.

This commit is contained in:
Alasdair Kergon 2003-12-09 17:51:39 +00:00
parent e19f549a11
commit 50b39413ac
3 changed files with 7 additions and 5 deletions

View File

@ -173,7 +173,7 @@ struct disk_list {
*/
int calculate_layout(struct disk_list *dl);
int calculate_extent_count(struct physical_volume *pv, uint32_t extent_size,
uint32_t max_extent_count);
uint32_t max_extent_count, uint64_t pe_start);
/*
* Low level io routines which read/write

View File

@ -317,14 +317,12 @@ static int _pv_setup(const struct format_type *fmt,
/*
* This works out pe_start and pe_count.
*/
if (!calculate_extent_count(pv, extent_size, extent_count)) {
if (!calculate_extent_count(pv, extent_size, extent_count, pe_start)) {
stack;
return 0;
}
/* Retain existing extent locations exactly */
/* FIXME Relax this so a non-overlapping existing pe_start can also
* be used in place of the calculated one */
if (((pe_start || extent_count) && (pe_start != pv->pe_start)) ||
(extent_count && (extent_count != pv->pe_count))) {
log_error("Metadata would overwrite physical extents");

View File

@ -103,9 +103,10 @@ int calculate_layout(struct disk_list *dl)
/*
* The number of extents that can fit on a disk is metadata format dependant.
* pe_start is any existing value for pe_start
*/
int calculate_extent_count(struct physical_volume *pv, uint32_t extent_size,
uint32_t max_extent_count)
uint32_t max_extent_count, uint64_t pe_start)
{
struct pv_disk *pvd = dbg_malloc(sizeof(*pvd));
uint32_t end;
@ -138,6 +139,9 @@ int calculate_extent_count(struct physical_volume *pv, uint32_t extent_size,
end = ((pvd->pe_on_disk.base + pvd->pe_on_disk.size +
SECTOR_SIZE - 1) >> SECTOR_SHIFT);
if (pe_start && end < pe_start)
end = pe_start;
pvd->pe_start = _round_up(end, PE_ALIGN);
} while ((pvd->pe_start + (pvd->pe_total * extent_size))