~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to lib/metadata/vg.c

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2012-05-01 20:27:50 UTC
  • mto: (3.1.23 sid)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20120501202750-gljjjtblowwq9mw8
Tags: upstream-2.02.95
ImportĀ upstreamĀ versionĀ 2.02.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        vg->vgmem = vgmem;
45
45
        vg->alloc = ALLOC_NORMAL;
46
46
 
 
47
        if (!(vg->hostnames = dm_hash_create(16))) {
 
48
                log_error("Failed to allocate VG hostname hashtable.");
 
49
                dm_pool_destroy(vgmem);
 
50
                return NULL;
 
51
        }
 
52
 
47
53
        dm_list_init(&vg->pvs);
48
54
        dm_list_init(&vg->pvs_to_create);
49
55
        dm_list_init(&vg->lvs);
67
73
 
68
74
        log_debug("Freeing VG %s at %p.", vg->name, vg);
69
75
 
 
76
        dm_hash_destroy(vg->hostnames);
70
77
        dm_pool_destroy(vg->vgmem);
71
78
}
72
79
 
73
80
void release_vg(struct volume_group *vg)
74
81
{
75
 
        if (!vg)
 
82
        if (!vg || (vg->fid && vg == vg->fid->fmt->orphan_vg))
76
83
                return;
77
84
 
78
85
        /* Check if there are any vginfo holders */
79
86
        if (vg->vginfo &&
80
 
            !vginfo_holders_dec_and_test_for_zero(vg->vginfo))
 
87
            !lvmcache_vginfo_holders_dec_and_test_for_zero(vg->vginfo))
81
88
                return;
82
89
 
83
90
        _free_vg(vg);
84
91
}
85
92
 
 
93
/*
 
94
 * FIXME out of place, but the main (cmd) pool has been already
 
95
 * destroyed and touching the fid (also via release_vg) will crash the
 
96
 * program
 
97
 *
 
98
 * For now quick wrapper to allow destroy of orphan vg
 
99
 */
 
100
void free_orphan_vg(struct volume_group *vg)
 
101
{
 
102
        _free_vg(vg);
 
103
}
 
104
 
86
105
char *vg_fmt_dup(const struct volume_group *vg)
87
106
{
88
107
        if (!vg->fid || !vg->fid->fmt)
261
280
 
262
281
        size /= new_size;
263
282
 
264
 
        if (size > UINT32_MAX) {
 
283
        if (size > MAX_EXTENT_COUNT) {
265
284
                log_error("New extent count %" PRIu64 " for %s%s exceeds "
266
285
                          "32 bits.", size, desc1, desc2);
267
286
                return 0;