]> sourceware.org Git - lvm2.git/commitdiff
Initialise a new PV-based format instance for a PV that is being created.
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 21 Feb 2011 12:12:32 +0000 (12:12 +0000)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 21 Feb 2011 12:12:32 +0000 (12:12 +0000)
lib/metadata/metadata.c
lib/metadata/pv.h

index 85796009f2917ea76e6c3f9a23d2ffbe9e8a5430..bb814a770cbbb925fb8cd2898991f026642c5981 100644 (file)
@@ -1555,6 +1555,7 @@ static struct physical_volume *_alloc_pv(struct dm_pool *mem, struct device *dev
        if (!pv)
                return_NULL;
 
+       pv->fid = NULL;
        pv->pe_size = 0;
        pv->pe_start = 0;
        pv->pe_count = 0;
@@ -1606,6 +1607,7 @@ struct physical_volume *pv_create(const struct cmd_context *cmd,
                                  unsigned metadataignore, struct dm_list *mdas)
 {
        const struct format_type *fmt = cmd->fmt;
+       struct format_instance_ctx fic;
        struct dm_pool *mem = fmt->cmd->mem;
        struct physical_volume *pv = _alloc_pv(mem, dev);
 
@@ -1646,6 +1648,13 @@ struct physical_volume *pv_create(const struct cmd_context *cmd,
                goto bad;
        }
 
+       fic.type = FMT_INSTANCE_PV;
+       fic.context.pv_id = (const char *) &pv->id;
+       if (!(pv->fid = fmt->ops->create_instance(fmt, &fic))) {
+               log_error("Couldn't create format instance for PV %s.", pv_dev_name(pv));
+               goto bad;
+       }
+
        pv->fmt = fmt;
        pv->vg_name = fmt->orphan_vg_name;
 
index a02f6f8c962707bb6681f90ce826eafed690e7b6..a9efcfe108038228149a900918f070199d28c297 100644 (file)
@@ -24,6 +24,7 @@ struct physical_volume {
        struct id id;
        struct device *dev;
        const struct format_type *fmt;
+       struct format_instance *fid;
 
        /*
         * vg_name and vgid are used before the parent VG struct exists.
This page took 0.291985 seconds and 5 git commands to generate.