summaryrefslogtreecommitdiffstats
path: root/tools/vgreduce.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2011-03-11 14:56:56 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2011-03-11 14:56:56 +0000
commit84f48499a3213f425f3d96e45cf7a80071f3022c (patch)
tree1a806f2b77d921cf7509fb032cb9b99cd9a3213f /tools/vgreduce.c
parent1307ddf4cfefd68b2fea4a3b6551777f1d2b9b25 (diff)
downloadlvm2-84f48499a3213f425f3d96e45cf7a80071f3022c.tar.gz
lvm2-84f48499a3213f425f3d96e45cf7a80071f3022c.tar.xz
lvm2-84f48499a3213f425f3d96e45cf7a80071f3022c.zip
Add new free_pv_fid fn and use it throughout to free all attached fids.
Since format instances will use own memory pool, it's necessary to properly deallocate it. For now, only fid is deallocated. The PV structure itself still uses cmd mempool mostly, but anytime we'd like to add a mempool in the struct physical_volume, we can just rename this fn to free_pv and add the code (like we have free_vg fn for VGs).
Diffstat (limited to 'tools/vgreduce.c')
-rw-r--r--tools/vgreduce.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index d497c762..1cabc8de 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -40,6 +40,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;
del_pvl_from_vgs(vg, pvl);
+ free_pv_fid(pvl->pv);
return 1;
}
@@ -450,6 +451,8 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
log_print("Removed \"%s\" from volume group \"%s\"", name, vg->name);
r = ECMD_PROCESSED;
bad:
+ if (pvl)
+ free_pv_fid(pvl->pv);
unlock_and_free_vg(cmd, orphan_vg, VG_ORPHANS);
return r;
}