From 56280d0d3ad6d3e071bf59c10e4d7c1533161952 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Mon, 21 Feb 2011 12:12:32 +0000 Subject: [PATCH] Initialise a new PV-based format instance for a PV that is being created. --- lib/metadata/metadata.c | 9 +++++++++ lib/metadata/pv.h | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 85796009f..bb814a770 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -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; diff --git a/lib/metadata/pv.h b/lib/metadata/pv.h index a02f6f8c9..a9efcfe10 100644 --- a/lib/metadata/pv.h +++ b/lib/metadata/pv.h @@ -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. -- 2.43.5