mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-23 21:35:29 +03:00
Add mdas_empty_or_ignored() helper function.
Add a helper function to consolidate checking for an empty mdas list or ignored mdas. Ignored mdas should behave almost identically to an empty mda list - the metadata areas should not be read or written to. This function will make it easier to implement metadata balancing and easier to track pvs with an empty mda list or ignored mdas. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
parent
2bdbceca91
commit
06468b9049
@ -4032,6 +4032,19 @@ unsigned pv_mda_set_ignored(const struct physical_volume *pv, unsigned ignored)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int mdas_empty_or_ignored(struct dm_list *mdas)
|
||||
{
|
||||
struct metadata_area *mda;
|
||||
|
||||
if (!dm_list_size(mdas))
|
||||
return 1;
|
||||
dm_list_iterate_items(mda, mdas) {
|
||||
if (mda_is_ignored(mda))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t vg_seqno(const struct volume_group *vg)
|
||||
{
|
||||
return vg->seqno;
|
||||
|
@ -185,6 +185,7 @@ 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);
|
||||
int mdas_empty_or_ignored(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
|
||||
|
Loading…
Reference in New Issue
Block a user