struct format_instance *fid = vg->fid;
struct dm_pool *mem = vg->vgmem;
char uuid[64] __attribute((aligned(8)));
+ struct dm_list *mdas;
log_verbose("Adding physical volume '%s' to volume group '%s'",
pv_name, vg->name);
*/
pv->pe_alloc_count = 0;
+ /*
+ * FIXME: this does not work entirely correctly in the case where a PV
+ * has 2 mdas and only one is ignored; ideally all non-ignored mdas
+ * should be placed on metadata_areas list and ignored on the
+ * metadata_areas_ignored list; however this requires another
+ * fairly complex refactoring to remove the 'mdas' parameter from both
+ * pv_setup and pv_write. For now, we only put ignored mdas on the
+ * metadata_areas_ignored list if all mdas in the PV are ignored;
+ * otherwise, we use the non-ignored list.
+ */
+ if (!pv_mda_used_count(pv))
+ mdas = &fid->metadata_areas_ignored;
+ else
+ mdas = &fid->metadata_areas_in_use;
+
if (!fid->fmt->ops->pv_setup(fid->fmt, UINT64_C(0), 0,
vg->extent_size, 0, 0, 0UL, UINT64_C(0),
- &fid->metadata_areas_in_use, pv, vg)) {
+ mdas, pv, vg)) {
log_error("Format-specific setup of physical volume '%s' "
"failed.", pv_name);
return 0;