mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Add find_lv_in_lv_list() and find_pv_in_pv_list().
Update _add_pvs() to call find_pv_in_pv_list().
This commit is contained in:
parent
a16d7d46dd
commit
9332d2cb9d
@ -1,5 +1,6 @@
|
||||
Version 2.02.34 -
|
||||
===================================
|
||||
Add find_lv_in_lv_list() and find_pv_in_pv_list().
|
||||
Fix uninitialised variable in clvmd that could cause odd hangs.
|
||||
Add vgmerge tests.
|
||||
Add pvseg_is_allocated() for identifying a PV segment allocated to a LV.
|
||||
|
@ -1875,8 +1875,7 @@ static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg,
|
||||
struct pv_list *pvl;
|
||||
|
||||
/* Don't add again if it's already on list. */
|
||||
list_iterate_items(pvl, &spvs->pvs)
|
||||
if (pvl->pv == peg->pv)
|
||||
if (find_pv_in_pv_list(&spvs->pvs, peg->pv))
|
||||
return 1;
|
||||
|
||||
if (!(pvl = dm_pool_alloc(cmd->mem, sizeof(*pvl)))) {
|
||||
|
@ -868,6 +868,17 @@ static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct pv_list *find_pv_in_pv_list(const struct list *pl,
|
||||
const struct physical_volume *pv)
|
||||
{
|
||||
struct pv_list *pvl;
|
||||
|
||||
list_iterate_items(pvl, pl)
|
||||
if (pvl->pv == pv)
|
||||
return pvl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv)
|
||||
{
|
||||
struct pv_list *pvl;
|
||||
@ -929,6 +940,17 @@ struct lv_list *find_lv_in_vg(const struct volume_group *vg,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct lv_list *find_lv_in_lv_list(const struct list *ll,
|
||||
const struct logical_volume *lv)
|
||||
{
|
||||
struct lv_list *lvl;
|
||||
|
||||
list_iterate_items(lvl, ll)
|
||||
if (lvl->lv == lv)
|
||||
return lvl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct lv_list *find_lv_in_vg_by_lvid(struct volume_group *vg,
|
||||
const union lvid *lvid)
|
||||
{
|
||||
|
@ -257,6 +257,9 @@ int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
|
||||
struct lv_list *find_lv_in_vg_by_lvid(struct volume_group *vg,
|
||||
const union lvid *lvid);
|
||||
|
||||
struct lv_list *find_lv_in_lv_list(const struct list *ll,
|
||||
const struct logical_volume *lv);
|
||||
|
||||
/* Return the VG that contains a given LV (based on path given in lv_name) */
|
||||
/* or environment var */
|
||||
struct volume_group *find_vg_with_lv(const char *lv_name);
|
||||
@ -269,6 +272,9 @@ struct logical_volume *lv_from_lvid(struct cmd_context *cmd,
|
||||
/* FIXME Merge these functions with ones above */
|
||||
struct physical_volume *find_pv(struct volume_group *vg, struct device *dev);
|
||||
|
||||
struct pv_list *find_pv_in_pv_list(const struct list *pl,
|
||||
const struct physical_volume *pv);
|
||||
|
||||
/* Find LV segment containing given LE */
|
||||
struct lv_segment *find_seg_by_le(const struct logical_volume *lv, uint32_t le);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user