1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

vg_write: add list of pvs to write

The vg->pv_write_list contains pv_list structs for which
vg_write() should call pv_write().

The new list will replace vg->pvs_to_write that contains
vg_to_create structs which are used to perform higher-level
pvcreate-related operations. The higher level pvcreate
operations will be moved out of vg_write() to higher levels.
This commit is contained in:
David Teigland 2016-02-16 12:43:24 -06:00
parent 3ac860334b
commit 5e5ad77f5f
3 changed files with 12 additions and 2 deletions

View File

@ -3146,7 +3146,8 @@ static int _check_old_pv_ext_for_vg(struct volume_group *vg)
int vg_write(struct volume_group *vg)
{
struct dm_list *mdah;
struct pv_to_write *pv_to_write, *pv_to_write_safe;
struct pv_to_write *pv_to_write, *pv_to_write_safe;
struct pv_list *pvl, *pvl_safe;
struct metadata_area *mda;
struct lv_list *lvl;
int revert = 0, wrote = 0;
@ -3207,6 +3208,12 @@ int vg_write(struct volume_group *vg)
memlock_unlock(vg->cmd);
vg->seqno++;
dm_list_iterate_items_safe(pvl, pvl_safe, &vg->pv_write_list) {
if (!pv_write(vg->cmd, pvl->pv, 1))
return_0;
dm_list_del(&pvl->list);
}
dm_list_iterate_items_safe(pv_to_write, pv_to_write_safe, &vg->pvs_to_write) {
if (!_pvcreate_write(vg->cmd, pv_to_write))
return_0;

View File

@ -61,6 +61,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->pvs);
dm_list_init(&vg->pvs_to_write);
dm_list_init(&vg->pv_write_list);
dm_list_init(&vg->pvs_outdated);
dm_list_init(&vg->lvs);
dm_list_init(&vg->tags);

View File

@ -91,7 +91,9 @@ struct volume_group {
* a PV label yet. They need to be pvcreate'd at vg_write time.
*/
struct dm_list pvs_to_write;
struct dm_list pvs_to_write; /* struct pv_to_write */
struct dm_list pv_write_list; /* struct pv_list */
/*
* List of physical volumes that carry outdated metadata that belongs