LVM2 ./WHATS_NEW lib/format1/format1.c lib/for ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at sourceware.org 2011-03-11 14:50:15
Modified files:
. : WHATS_NEW
lib/format1 : format1.c
lib/format_pool: format_pool.c lib/format_text: format-text.c import_vsn1.c
lib/metadata : metadata.c metadata.h
Log message:
Use only vg_set_fid and new pv_set_fid fn to assign the format instance.
This is essential for proper format instance ref_count support. We must use these functions to set the fid everywhere from now on, even the NULL value!
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1947&r2=1.1948
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.136&r2=1.137
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.176&r2=1.177
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.443&r2=1.444
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.241&r2=1.242
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Use only vg_set_fid and new pv_set_fid fn to assign the format instance. Make create_text_context fn static and move it inside create_instance fn. Add mem and ref_count fields to struct format_instance for own mempool use. Use new alloc_fid fn for common format instance initialisation.
lib/format1/format1.c +1 -1
@@ -198,7 +198,7 @@if (dm_list_empty (&pvs)) goto_bad; - vg->fid = fid; +vg_set_fid (vg, fid);if (!_check_vgs (&pvs, vg)) goto_bad;
lib/format_pool/format_pool.c +2 -1
@@ -120,7 +120,8 @@if (!read_pool_pds (fid->fmt, vg_name, vg->vgmem, &pds)) goto_bad; - vg->fid = fid; +vg_set_fid (vg, fid); +/* Setting pool seqno to 1 because the code always did this, * although we don't think it's needed. */ vg->seqno =1 ;
lib/format_text/format-text.c +1 -5
@@ -1690,12 +1690,8 @@ (pv_mdac = pv_mda->metadata_locn)) size_reduction = pv_mdac->area.size >>SECTOR_SHIFT ; -/* Destroy old PV-based format instance if it exists. */ -if (!(pv->fid->type &FMT_INSTANCE_VG )) - pv->fmt->ops->destroy_instance (pv->fid); -/* From now on, VG format instance will be used. */ - pv->fid = vg->fid; +pv_set_fid (pv, vg->fid);/* FIXME Cope with genuine pe_count 0 */
lib/format_text/import_vsn1.c +4 -4
@@ -666,10 +666,6 @@if (!(vg =alloc_vg ("read_vg" , fid->fmt->cmd, vgn->key))) return_NULL; -/* FIXME Determine format type from file contents */ -/* eg Set to instance of fmt1 here if reading a format1 backup? */ - vg->fid = fid; -if (!(vg->system_id =dm_pool_zalloc (vg->vgmem,NAME_LEN ))) goto_bad;
@@ -796,6 +792,10 @@dm_hash_destroy (pv_hash);dm_hash_destroy (lv_hash); +/* FIXME Determine format type from file contents */ +/* eg Set to instance of fmt1 here if reading a format1 backup? */ +vg_set_fid (vg, fid); +/* * Finished. */
lib/metadata/metadata.c +45 -7
145 lines not on this page · raw message
lib/metadata/metadata.h +8 -0
@@ -206,7 +206,15 @@struct format_instance *alloc_fid (const struct format_type *fmt,const struct format_instance_ctx *fic); + +/* +* Format instance must always be set using pv_set_fid or vg_set_fid +* (NULL value as well), never asign it directly! This is essential +* for proper reference counting for the format instance. +*/ +void pv_set_fid (struct physical_volume *pv,struct format_instance *fid);void vg_set_fid (struct volume_group *vg,struct format_instance *fid); +/* FIXME: Add generic interface for mda counts based on given key. */ int fid_add_mda (struct format_instance *fid,struct metadata_area *mda,const char *key,size_t key_len,const unsigned sub_key);