mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Call add_pvl_to_vgs() and del_pvl_from_vgs() from more places.
Now that we have library functions to add/delete a pv from the vg->pvs list, call them from everywhere. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
parent
8cfd64de78
commit
0adfbfd5ea
@ -119,8 +119,7 @@ int import_pool_pvs(const struct format_type *fmt, struct volume_group *vg,
|
||||
pl->pv = pvl->pv;
|
||||
pvl->mdas = NULL;
|
||||
pvl->pe_ranges = NULL;
|
||||
vg->pv_count++;
|
||||
dm_list_add(&vg->pvs, &pvl->list);
|
||||
add_pvl_to_vgs(vg, pvl);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -347,10 +347,8 @@ int move_pv(struct volume_group *vg_from, struct volume_group *vg_to,
|
||||
_vg_bad_status_bits(vg_to, RESIZEABLE_VG))
|
||||
return 0;
|
||||
|
||||
dm_list_move(&vg_to->pvs, &pvl->list);
|
||||
|
||||
vg_from->pv_count--;
|
||||
vg_to->pv_count++;
|
||||
del_pvl_from_vgs(vg_from, pvl);
|
||||
add_pvl_to_vgs(vg_to, pvl);
|
||||
|
||||
pv = pvl->pv;
|
||||
|
||||
@ -517,7 +515,7 @@ int vg_remove_check(struct volume_group *vg)
|
||||
return 0;
|
||||
|
||||
dm_list_iterate_items_safe(pvl, tpvl, &vg->pvs) {
|
||||
dm_list_del(&pvl->list);
|
||||
del_pvl_from_vgs(vg, pvl);
|
||||
dm_list_add(&vg->removed_pvs, &pvl->list);
|
||||
}
|
||||
return 1;
|
||||
@ -2510,8 +2508,7 @@ static struct volume_group *_vg_read_orphans(struct cmd_context *cmd,
|
||||
goto bad;
|
||||
}
|
||||
pvl->pv = pv;
|
||||
dm_list_add(&vg->pvs, &pvl->list);
|
||||
vg->pv_count++;
|
||||
add_pvl_to_vgs(vg, pvl);
|
||||
}
|
||||
|
||||
return vg;
|
||||
|
@ -751,8 +751,7 @@ static void _remove_missing_empty_pv(struct volume_group *vg, struct dm_list *re
|
||||
/* FIXME: duplication of vgreduce code, move this to library */
|
||||
vg->free_count -= pvl_vg->pv->pe_count;
|
||||
vg->extent_count -= pvl_vg->pv->pe_count;
|
||||
vg->pv_count--;
|
||||
dm_list_del(&pvl_vg->list);
|
||||
del_pvl_from_vgs(vg, pvl_vg);
|
||||
|
||||
removed++;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ static struct volume_group *_vgmerge_vg_read(struct cmd_context *cmd,
|
||||
static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
||||
const char *vg_name_from)
|
||||
{
|
||||
struct pv_list *pvl, *tpvl;
|
||||
struct volume_group *vg_to, *vg_from;
|
||||
struct lv_list *lvl1, *lvl2;
|
||||
int r = ECMD_FAILED;
|
||||
@ -82,16 +83,11 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
||||
drop_cached_metadata(vg_from);
|
||||
|
||||
/* Merge volume groups */
|
||||
while (!dm_list_empty(&vg_from->pvs)) {
|
||||
struct dm_list *pvh = vg_from->pvs.n;
|
||||
struct physical_volume *pv;
|
||||
|
||||
dm_list_move(&vg_to->pvs, pvh);
|
||||
|
||||
pv = dm_list_item(pvh, struct pv_list)->pv;
|
||||
pv->vg_name = dm_pool_strdup(cmd->mem, vg_to->name);
|
||||
dm_list_iterate_items_safe(pvl, tpvl, &vg_from->pvs) {
|
||||
del_pvl_from_vgs(vg_from, pvl);
|
||||
add_pvl_to_vgs(vg_to, pvl);
|
||||
pvl->pv->vg_name = dm_pool_strdup(cmd->mem, vg_to->name);
|
||||
}
|
||||
vg_to->pv_count += vg_from->pv_count;
|
||||
|
||||
/* Fix up LVIDs */
|
||||
dm_list_iterate_items(lvl1, &vg_to->lvs) {
|
||||
|
@ -39,9 +39,7 @@ static int _remove_pv(struct volume_group *vg, struct pv_list *pvl, int silent)
|
||||
|
||||
vg->free_count -= pvl->pv->pe_count;
|
||||
vg->extent_count -= pvl->pv->pe_count;
|
||||
vg->pv_count--;
|
||||
|
||||
dm_list_del(&pvl->list);
|
||||
del_pvl_from_vgs(vg, pvl);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user