return_NULL;
fid->fmt = fmt;
- dm_list_init(&fid->metadata_areas);
+ dm_list_init(&fid->metadata_areas_in_use);
/* Define a NULL metadata area */
if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda)))) {
mda->ops = &_metadata_format1_ops;
mda->metadata_locn = NULL;
- dm_list_add(&fid->metadata_areas, &mda->list);
+ dm_list_add(&fid->metadata_areas_in_use, &mda->list);
return fid;
}
}
fid->fmt = fmt;
- dm_list_init(&fid->metadata_areas);
+ dm_list_init(&fid->metadata_areas_in_use);
/* Define a NULL metadata area */
if (!(mda = dm_pool_zalloc(fmt->cmd->mem, sizeof(*mda)))) {
mda->ops = &_metadata_format_pool_ops;
mda->metadata_locn = NULL;
- dm_list_add(&fid->metadata_areas, &mda->list);
+ dm_list_add(&fid->metadata_areas_in_use, &mda->list);
return fid;
}
return NULL;
}
- dm_list_iterate_items(mda, &tf->metadata_areas) {
+ dm_list_iterate_items(mda, &tf->metadata_areas_in_use) {
if (!(vg = mda->ops->vg_read(tf, vg_name, mda)))
stack;
break;
}
if (!vg->fid->fmt->ops->
pv_setup(vg->fid->fmt, UINT64_C(0), 0, 0, 0, 0, 0UL,
- UINT64_C(0), &vg->fid->metadata_areas, pv, vg)) {
+ UINT64_C(0), &vg->fid->metadata_areas_in_use, pv, vg)) {
log_error("Format-specific setup for %s failed",
pv_dev_name(pv));
return 0;
}
/* Write and commit the metadata area */
- dm_list_iterate_items(mda, &tf->metadata_areas) {
+ dm_list_iterate_items(mda, &tf->metadata_areas_in_use) {
if (!(r = mda->ops->vg_write(tf, vg, mda))) {
stack;
continue;
raw_list = &((struct mda_lists *) fmt->private)->raws;
fid.fmt = fmt;
- dm_list_init(&fid.metadata_areas);
+ dm_list_init(&fid.metadata_areas_in_use);
dm_list_iterate_items(rl, raw_list) {
/* FIXME We're reading mdah twice here... */
fid->private = (void *) fidtc;
fid->fmt = fmt;
- dm_list_init(&fid->metadata_areas);
+ dm_list_init(&fid->metadata_areas_in_use);
if (!vgname) {
if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda))))
return_NULL;
mda->ops = &_metadata_text_file_backup_ops;
mda->metadata_locn = context;
- dm_list_add(&fid->metadata_areas, &mda->list);
+ dm_list_add(&fid->metadata_areas_in_use, &mda->list);
} else {
dir_list = &((struct mda_lists *) fmt->private)->dirs;
return_NULL;
mda->ops = &_metadata_text_file_ops;
mda->metadata_locn = context;
- dm_list_add(&fid->metadata_areas, &mda->list);
+ dm_list_add(&fid->metadata_areas_in_use, &mda->list);
}
raw_list = &((struct mda_lists *) fmt->private)->raws;
memcpy(&mdac->area, &rl->dev_area, sizeof(mdac->area));
mda->ops = &_metadata_text_raw_ops;
/* FIXME MISTAKE? mda->metadata_locn = context; */
- dm_list_add(&fid->metadata_areas, &mda->list);
+ dm_list_add(&fid->metadata_areas_in_use, &mda->list);
}
/* Scan PVs in VG for any further MDAs */
mda_new = mda_copy(fmt->cmd->mem, mda);
if (!mda_new)
return_NULL;
- dm_list_add(&fid->metadata_areas, &mda_new->list);
+ dm_list_add(&fid->metadata_areas_in_use, &mda_new->list);
}
}
/* FIXME Check raw metadata area count - rescan if required */
struct format_instance {
const struct format_type *fmt;
- struct dm_list metadata_areas; /* e.g. metadata locations */
+ struct dm_list metadata_areas_in_use; /* e.g. metadata locations */
void *private;
};
if (!fid->fmt->ops->pv_setup(fid->fmt, UINT64_C(0), 0,
vg->extent_size, 0, 0, 0UL, UINT64_C(0),
- &fid->metadata_areas, pv, vg)) {
+ &fid->metadata_areas_in_use, pv, vg)) {
log_error("Format-specific setup of physical volume '%s' "
"failed.", pv_name);
return 0;
struct dm_list *mdas_from, *mdas_to;
int common_mda = 0;
- mdas_from = &vg_from->fid->metadata_areas;
- mdas_to = &vg_to->fid->metadata_areas;
+ mdas_from = &vg_from->fid->metadata_areas_in_use;
+ mdas_to = &vg_to->fid->metadata_areas_in_use;
dm_list_iterate_items_safe(mda, mda2, mdas_from) {
if (!mda->ops->mda_in_vg) {
/* FIXME Improve recovery situation? */
/* Remove each copy of the metadata */
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->ops->vg_remove &&
!mda->ops->vg_remove(vg->fid, vg, mda))
return_0;
}
- if (dm_list_empty(&vg->fid->metadata_areas)) {
+ if (dm_list_empty(&vg->fid->metadata_areas_in_use)) {
log_error("Aborting vg_write: No metadata areas to write to!");
return 0;
}
vg->seqno++;
/* Write to each copy of the metadata area */
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (!mda->ops->vg_write) {
log_error("Format does not support writing volume"
"group metadata areas");
/* Revert */
- dm_list_uniterate(mdah, &vg->fid->metadata_areas, &mda->list) {
+ dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
mda = dm_list_item(mdah, struct metadata_area);
if (mda->ops->vg_revert &&
if (!mda->ops->vg_write(vg->fid, vg, mda)) {
stack;
/* Revert */
- dm_list_uniterate(mdah, &vg->fid->metadata_areas, &mda->list) {
+ dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
mda = dm_list_item(mdah, struct metadata_area);
if (mda->ops->vg_revert &&
}
/* Now pre-commit each copy of the new metadata */
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->ops->vg_precommit &&
!mda->ops->vg_precommit(vg->fid, vg, mda)) {
stack;
/* Revert */
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->ops->vg_revert &&
!mda->ops->vg_revert(vg->fid, vg, mda)) {
stack;
}
/* Commit to each copy of the metadata area */
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
failed = 0;
if (mda->ops->vg_commit &&
!mda->ops->vg_commit(vg->fid, vg, mda)) {
{
struct metadata_area *mda;
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->ops->vg_revert &&
!mda->ops->vg_revert(vg->fid, vg, mda)) {
stack;
return_NULL;
/* Ensure contents of all metadata areas match - else do recovery */
- dm_list_iterate_items(mda, &fid->metadata_areas) {
+ dm_list_iterate_items(mda, &fid->metadata_areas_in_use) {
if ((use_precommitted &&
!(vg = mda->ops->vg_read_precommit(fid, vgname, mda))) ||
(!use_precommitted &&
}
/* Ensure contents of all metadata areas match - else recover */
- dm_list_iterate_items(mda, &fid->metadata_areas) {
+ dm_list_iterate_items(mda, &fid->metadata_areas_in_use) {
if ((use_precommitted &&
!(vg = mda->ops->vg_read_precommit(fid, vgname,
mda))) ||
* physical_volume. The location of the mda depends on whether
* the PV is in a volume group. A PV not in a VG has an mda on the
* 'info->mda' list in lvmcache, while a PV in a VG has an mda on
- * the vg->fid->metadata_areas list. For further details, see _vg_read(),
- * and the sequence of creating the format_instance with fid->metadata_areas
+ * the vg->fid->metadata_areas_in_use list. For further details, see _vg_read(),
+ * and the sequence of creating the format_instance with fid->metadata_areas_in_use
* list, as well as the construction of the VG, with list of PVs (comes
* after the construction of the fid and list of mdas).
*/
uint32_t vg_mda_count(const struct volume_group *vg)
{
- return dm_list_size(&vg->fid->metadata_areas);
+ return dm_list_size(&vg->fid->metadata_areas_in_use);
}
uint64_t lv_size(const struct logical_volume *lv)
struct metadata_area *mda);
/*
- * Do these two metadata_areas match with respect to their underlying
- * location?
+ * Do these two metadata_area structures match with respect to
+ * their underlying location?
*/
unsigned (*mda_locns_match)(struct metadata_area *mda1,
struct metadata_area *mda2);
const struct volume_group *vg = (const struct volume_group *) data;
uint64_t min_mda_size;
- min_mda_size = _find_min_mda_size(&vg->fid->metadata_areas);
+ min_mda_size = _find_min_mda_size(&vg->fid->metadata_areas_in_use);
return _size64_disp(rh, mem, field, &min_mda_size, private);
}
uint64_t freespace = UINT64_MAX, mda_free;
struct metadata_area *mda;
- dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+ dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (!mda->ops->mda_free_sectors)
continue;
mda_free = mda->ops->mda_free_sectors(mda);
/* necessary for displaying something for PVs not belonging to VG */
static struct format_instance _dummy_fid = {
- .metadata_areas = { &(_dummy_fid.metadata_areas), &(_dummy_fid.metadata_areas) },
+ .metadata_areas_in_use = { &(_dummy_fid.metadata_areas_in_use), &(_dummy_fid.metadata_areas_in_use) },
};
static struct volume_group _dummy_vg = {
dm_list_move(&vg_to->lvs, lvh);
}
- while (!dm_list_empty(&vg_from->fid->metadata_areas)) {
- struct dm_list *mdah = vg_from->fid->metadata_areas.n;
+ while (!dm_list_empty(&vg_from->fid->metadata_areas_in_use)) {
+ struct dm_list *mdah = vg_from->fid->metadata_areas_in_use.n;
- dm_list_move(&vg_to->fid->metadata_areas, mdah);
+ dm_list_move(&vg_to->fid->metadata_areas_in_use, mdah);
}
vg_to->extent_count += vg_from->extent_count;