1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

Add location independent flag and functions to ignore mdas.

First we add a 'flags' field to the location independent
metadata_area structure, and a MDA_IGNORE flag.  The
mda_is_ignored and mda_set_ignored functions are added to
manage the flag.  Adding the flag and functions gives a
library interface to ignore metadata areas independent of
the underlying location (disk, file, etc).  The location
specific read/write functions must then handle the specifics
of what this flag means to the location.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
Dave Wysochanski 2010-06-28 20:30:14 +00:00
parent 3c3b5e0dbf
commit ce7cf5f46b
3 changed files with 20 additions and 0 deletions

View File

@ -215,6 +215,7 @@ int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *
mdal->ops = mda_lists->raw_ops;
mdal->metadata_locn = mdac;
mdal->flags = 0;
mdac->area.dev = dev;
mdac->area.start = start;

View File

@ -3855,6 +3855,19 @@ uint32_t pv_pe_alloc_count(const struct physical_volume *pv)
return pv_field(pv, pe_alloc_count);
}
unsigned mda_is_ignored(struct metadata_area *mda)
{
return (mda->flags & MDA_IGNORED);
}
void mda_set_ignored(struct metadata_area *mda, int value)
{
if (value)
mda->flags |= MDA_IGNORED;
else
mda->flags &= ~MDA_IGNORED;
}
uint32_t pv_mda_count(const struct physical_volume *pv)
{
struct lvmcache_info *info;

View File

@ -158,12 +158,18 @@ struct metadata_area_ops {
};
#define MDA_IGNORED 0x00000001
struct metadata_area {
struct dm_list list;
struct metadata_area_ops *ops;
void *metadata_locn;
uint32_t flags;
};
unsigned mda_is_ignored(struct metadata_area *mda);
void mda_set_ignored(struct metadata_area *mda, int value);
#define seg_pvseg(seg, s) (seg)->areas[(s)].u.pv.pvseg
#define seg_dev(seg, s) (seg)->areas[(s)].u.pv.pvseg->pv->dev
#define seg_pe(seg, s) (seg)->areas[(s)].u.pv.pvseg->pe