diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index cb8964008..84dca77da 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -254,10 +254,13 @@ int import_lv(struct pool *mem, struct logical_volume *lv, struct lv_disk *lvd) if (lvd->lv_badblock) lv->status |= BADBLOCK_ON; - if (lvd->lv_allocation == LV_STRICT) + if (lvd->lv_allocation & LV_STRICT) lv->status |= ALLOC_STRICT; - else + + if (lvd->lv_allocation & LV_CONTIGUOUS) lv->status |= ALLOC_CONTIGUOUS; + else + lv->status |= ALLOC_SIMPLE; lv->read_ahead = lvd->lv_read_ahead; lv->stripes = lvd->lv_stripes; @@ -314,9 +317,10 @@ void export_lv(struct lv_disk *lvd, struct volume_group *vg, lvd->lv_badblock = LV_BADBLOCK_ON; if (lv->status & ALLOC_STRICT) - lvd->lv_allocation = LV_STRICT; - else - lvd->lv_allocation = LV_CONTIGUOUS; + lvd->lv_allocation |= LV_STRICT; + + if (lv->status & ALLOC_CONTIGUOUS) + lvd->lv_allocation |= LV_CONTIGUOUS; } int import_extents(struct pool *mem, struct volume_group *vg, struct list *pvs) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index c410506b1..570c2d1f5 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -156,9 +156,15 @@ static int _allocate(struct volume_group *vg, struct logical_volume *lv, else if (lv->status & ALLOC_CONTIGUOUS) r = _alloc_contiguous(lv, pvms, allocated); - else + else if (lv->status & ALLOC_SIMPLE) r = _alloc_simple(lv, pvms, allocated); + else { + log_err("Unknown allocation policy, " + "unable to setup logical volume."); + goto out; + } + if (r) { vg->free_count -= lv->le_count - allocated; } diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index 9dfe55574..a708421d0 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -33,10 +33,11 @@ #define CLUSTERED 0x00000400 /* VG */ #define SHARED 0x00000800 /* VG */ -#define ALLOC_STRICT 0x00001000 /* LV */ -#define ALLOC_CONTIGUOUS 0x00002000 /* LV */ -#define SNAPSHOT 0x00004000 /* LV */ -#define SNAPSHOT_ORG 0x00008000 /* LV */ +#define ALLOC_SIMPLE 0x00001000 /* LVM */ +#define ALLOC_STRICT 0x00002000 /* LV */ +#define ALLOC_CONTIGUOUS 0x00004000 /* LV */ +#define SNAPSHOT 0x00008000 /* LV */ +#define SNAPSHOT_ORG 0x00010000 /* LV */ #define EXPORTED_TAG "PV_EXP" /* Identifier of exported PV */