1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

metadata: Remove unused vg.cft_precommitted

The precommitted metadata config_tree is now only referenced from a
single function so just use a local variable instead.
This commit is contained in:
Alasdair G Kergon 2017-11-14 01:09:58 +00:00
parent 6bf0f04ae2
commit 00acae12a4
3 changed files with 9 additions and 25 deletions

View File

@ -905,23 +905,22 @@ int vgcreate_params_validate(struct cmd_context *cmd,
*/
static int _vg_update_vg_precommitted(struct volume_group *vg)
{
struct dm_config_tree *cft_precommitted;
release_vg(vg->vg_precommitted);
vg->vg_precommitted = NULL;
if (vg->cft_precommitted) {
dm_config_destroy(vg->cft_precommitted);
vg->cft_precommitted = NULL;
}
if (!(vg->cft_precommitted = export_vg_to_config_tree(vg)))
/* Copy the VG using an export followed by import */
if (!(cft_precommitted = export_vg_to_config_tree(vg)))
return_0;
if (!(vg->vg_precommitted = import_vg_from_config_tree(vg->cft_precommitted, vg->fid))) {
dm_config_destroy(vg->cft_precommitted);
vg->cft_precommitted = NULL;
if (!(vg->vg_precommitted = import_vg_from_config_tree(cft_precommitted, vg->fid))) {
dm_config_destroy(cft_precommitted);
return_0;
}
dm_config_destroy(cft_precommitted);
return 1;
}
@ -938,10 +937,6 @@ static int _vg_update_vg_committed(struct volume_group *vg)
vg->vg_committed = vg->vg_precommitted;
vg->vg_precommitted = NULL;
if (vg->cft_precommitted) {
dm_config_destroy(vg->cft_precommitted);
vg->cft_precommitted = NULL;
}
return 1;
}
@ -3185,10 +3180,6 @@ int vg_commit(struct volume_group *vg)
release_vg(vg->vg_committed);
vg->vg_committed = vg->vg_precommitted;
vg->vg_precommitted = NULL;
if (vg->cft_precommitted) {
dm_config_destroy(vg->cft_precommitted);
vg->cft_precommitted = NULL;
}
}
/* If update failed, remove any cached precommitted metadata. */
@ -3223,10 +3214,6 @@ void vg_revert(struct volume_group *vg)
release_vg(vg->vg_precommitted); /* VG is no longer needed */
vg->vg_precommitted = NULL;
if (vg->cft_precommitted) {
dm_config_destroy(vg->cft_precommitted);
vg->cft_precommitted = NULL;
}
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->ops->vg_revert &&

View File

@ -104,8 +104,6 @@ void release_vg(struct volume_group *vg)
release_vg(vg->vg_committed);
release_vg(vg->vg_precommitted);
if (vg->cft_precommitted)
dm_config_destroy(vg->cft_precommitted);
_free_vg(vg);
}

View File

@ -59,8 +59,7 @@ struct volume_group {
* _vg_update_vg_committed.
*/
struct volume_group *vg_committed;
struct dm_config_tree *cft_precommitted; /* Precommitted metadata */
struct volume_group *vg_precommitted; /* Parsed from cft */
struct volume_group *vg_precommitted;
alloc_policy_t alloc;
struct profile *profile;