public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib format1/format1.c format_pool/format_ ... Date: Mon, 28 Jun 2010 20:33:00 -0000 [thread overview] Message-ID: <20100628203324.15377.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2010-06-28 20:33:23 Modified files: lib/format1 : format1.c lib/format_pool: format_pool.c lib/format_text: format-text.c lib/metadata : metadata-exported.h metadata.c metadata.h lib/report : report.c Log message: Add metadata_areas_ignored list and functions to manage ignored mdas. Add a second mda list, metadata_areas_ignored to fid, and a couple functions, fid_add_mda() and fid_add_mdas() to help manage the lists. These functions are needed to properly count the ignored mdas and manage the lists attached to the 'fid' and ultimately the 'vg'. Ensure metadata_areas_ignored is initialized in other formats, even if the list is never used. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.117&r2=1.118 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.131&r2=1.132 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.153&r2=1.154 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.350&r2=1.351 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.209&r2=1.210 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.118&r2=1.119 --- LVM2/lib/format1/format1.c 2010/06/28 20:32:44 1.117 +++ LVM2/lib/format1/format1.c 2010/06/28 20:33:22 1.118 @@ -464,6 +464,7 @@ fid->fmt = fmt; dm_list_init(&fid->metadata_areas_in_use); + dm_list_init(&fid->metadata_areas_ignored); /* Define a NULL metadata area */ if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda)))) { --- LVM2/lib/format_pool/format_pool.c 2010/06/28 20:32:46 1.28 +++ LVM2/lib/format_pool/format_pool.c 2010/06/28 20:33:23 1.29 @@ -263,6 +263,7 @@ fid->fmt = fmt; dm_list_init(&fid->metadata_areas_in_use); + dm_list_init(&fid->metadata_areas_ignored); /* Define a NULL metadata area */ if (!(mda = dm_pool_zalloc(fmt->cmd->mem, sizeof(*mda)))) { --- LVM2/lib/format_text/format-text.c 2010/06/28 20:32:46 1.131 +++ LVM2/lib/format_text/format-text.c 2010/06/28 20:33:23 1.132 @@ -1209,6 +1209,7 @@ fid.fmt = fmt; dm_list_init(&fid.metadata_areas_in_use); + dm_list_init(&fid.metadata_areas_ignored); dm_list_iterate_items(rl, raw_list) { /* FIXME We're reading mdah twice here... */ @@ -1915,6 +1916,7 @@ fid->fmt = fmt; dm_list_init(&fid->metadata_areas_in_use); + dm_list_init(&fid->metadata_areas_ignored); if (!vgname) { if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda)))) --- LVM2/lib/metadata/metadata-exported.h 2010/06/28 20:32:46 1.153 +++ LVM2/lib/metadata/metadata-exported.h 2010/06/28 20:33:23 1.154 @@ -215,7 +215,14 @@ struct format_instance { const struct format_type *fmt; - struct dm_list metadata_areas_in_use; /* e.g. metadata locations */ + /* + * Each mda in a vg is on exactly one of the below lists. + * MDAs on the 'in_use' list will be read from / written to + * disk, while MDAs on the 'ignored' list will not be read + * or written to. + */ + struct dm_list metadata_areas_in_use; + struct dm_list metadata_areas_ignored; void *private; }; --- LVM2/lib/metadata/metadata.c 2010/06/28 20:32:46 1.350 +++ LVM2/lib/metadata/metadata.c 2010/06/28 20:33:23 1.351 @@ -3855,6 +3855,29 @@ return pv_field(pv, pe_alloc_count); } +void fid_add_mda(struct format_instance *fid, struct metadata_area *mda) +{ + if (mda_is_ignored(mda)) + dm_list_add(&fid->metadata_areas_ignored, + &mda->list); + else + dm_list_add(&fid->metadata_areas_in_use, + &mda->list); +} + +int fid_add_mdas(struct format_instance *fid, struct dm_list *mdas) +{ + struct metadata_area *mda, *mda_new; + + dm_list_iterate_items(mda, mdas) { + mda_new = mda_copy(fid->fmt->cmd->mem, mda); + if (!mda_new) + return_0; + fid_add_mda(fid, mda_new); + } + return 1; +} + /* * Copy constructor for a metadata_area. */ --- LVM2/lib/metadata/metadata.h 2010/06/28 20:32:46 1.209 +++ LVM2/lib/metadata/metadata.h 2010/06/28 20:33:23 1.210 @@ -183,6 +183,8 @@ unsigned mda_is_ignored(struct metadata_area *mda); void mda_set_ignored(struct metadata_area *mda, int value); unsigned mda_locns_match(struct metadata_area *mda1, struct metadata_area *mda2); +void fid_add_mda(struct format_instance *fid, struct metadata_area *mda); +int fid_add_mdas(struct format_instance *fid, struct dm_list *mdas); #define seg_pvseg(seg, s) (seg)->areas[(s)].u.pv.pvseg #define seg_dev(seg, s) (seg)->areas[(s)].u.pv.pvseg->pv->dev --- LVM2/lib/report/report.c 2010/06/28 20:32:47 1.118 +++ LVM2/lib/report/report.c 2010/06/28 20:33:23 1.119 @@ -1127,6 +1127,7 @@ /* necessary for displaying something for PVs not belonging to VG */ static struct format_instance _dummy_fid = { .metadata_areas_in_use = { &(_dummy_fid.metadata_areas_in_use), &(_dummy_fid.metadata_areas_in_use) }, + .metadata_areas_ignored = { &(_dummy_fid.metadata_areas_ignored), &(_dummy_fid.metadata_areas_ignored) }, }; static struct volume_group _dummy_vg = {
next reply other threads:[~2010-06-28 20:33 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-06-28 20:33 wysochanski [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-02-15 1:44 mornfall 2011-02-21 12:20 prajnoha 2011-02-21 12:05 prajnoha 2010-06-29 14:52 wysochanski 2009-07-27 17:43 wysochanski
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100628203324.15377.qmail@sourceware.org \ --to=wysochanski@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).