From aed3f57b3b32e3f992824c39b055b124b63cebe2 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 10 Oct 2001 14:56:53 +0000 Subject: [PATCH] o allocate and zero the extents before exporting the lv's --- lib/format1/import-export.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index aab026161..e751f2ddf 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -372,13 +372,7 @@ int export_extents(struct disk_list *dl, int lv_num, struct physical_volume *pv) { struct pe_disk *ped; - int len = sizeof(struct pe_disk) * lv->le_count, le; - - if (!(dl->extents = pool_alloc(dl->mem, len))) { - stack; - return 0; - } - memset(&dl->extents, 0, len); + int le; for (le = 0; le < lv->le_count; le++) { if (lv->map[le].pv == pv) { @@ -474,7 +468,18 @@ int export_lvs(struct disk_list *dl, struct volume_group *vg, struct list_head *tmp; struct lv_list *ll; struct lvd_list *lvdl; - int lv_num = 1; + int lv_num = 1, len; + + /* + * setup the pv's extents array + */ + len = sizeof(struct pe_disk) * dl->pv.pe_total; + if (!(dl->extents = pool_alloc(dl->mem, len))) { + stack; + return 0; + } + memset(&dl->extents, 0, len); + list_for_each(tmp, &dl->lvs) { ll = list_entry(tmp, struct lv_list, list);