1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-04-01 18:50:41 +03:00

Initialise a new PV-based format instance for a PV that is being created.

This commit is contained in:
Peter Rajnoha 2011-02-21 12:12:32 +00:00
parent afc29a3d69
commit f78aec2b52
2 changed files with 10 additions and 0 deletions

View 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;

View 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.