Skip to contentSkip to conversation

LVM2/lib/metadata metadata.c pv.h

PATCH [email protected] 1 participant 1 message Feb 21, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at sourceware.org 2011-02-21 12:12:32

Modified files:
lib/metadata : metadata.c pv.h

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

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.427&r2=1.428
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9

lib/metadata/metadata.c +9 -0
@@ -1555,6 +1555,7 @@
 	if (!pv)
 		return_NULL;
 
+	pv->fid = NULL;
 	pv->pe_size = 0;
 	pv->pe_start = 0;
 	pv->pe_count = 0;
@@ -1606,6 +1607,7 @@
 				  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 @@
 		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;
 
lib/metadata/pv.h +1 -0
@@ -24,6 +24,7 @@
 	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.