1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Introduce is_missing_pv().

This commit is contained in:
Alasdair Kergon 2010-03-16 14:37:38 +00:00
parent 83a2bc8ec4
commit b19719801b
7 changed files with 19 additions and 12 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.63 -
================================
Introduce is_missing_pv().
Fix clvmd Makefile to not overwrite LIBS from template definition.
Version 2.02.62 - 9th March 2010

View File

@ -415,6 +415,7 @@ int move_pvs_used_by_lv(struct volume_group *vg_from,
const char *lv_name);
int is_orphan_vg(const char *vg_name);
int is_orphan(const struct physical_volume *pv);
int is_missing_pv(const struct physical_volume *pv);
int vgs_are_compatible(struct cmd_context *cmd,
struct volume_group *vg_from,
struct volume_group *vg_to);

View File

@ -2068,7 +2068,7 @@ static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data)
dm_list_iterate_items(lvseg, &lv->segments) {
for (s = 0; s < lvseg->area_count; ++s) {
if (seg_type(lvseg, s) == AREA_PV) {
if (seg_pv(lvseg, s)->status & MISSING_PV)
if (is_missing_pv(seg_pv(lvseg, s)))
lv->status |= PARTIAL_LV;
}
}
@ -2513,7 +2513,7 @@ int vg_missing_pv_count(const struct volume_group *vg)
int ret = 0;
struct pv_list *pvl;
dm_list_iterate_items(pvl, &vg->pvs) {
if (pvl->pv->status & MISSING_PV)
if (is_missing_pv(pvl->pv))
++ ret;
}
return ret;
@ -2525,7 +2525,7 @@ static void check_reappeared_pv(struct volume_group *correct_vg,
struct pv_list *pvl;
dm_list_iterate_items(pvl, &correct_vg->pvs)
if (pv->dev == pvl->pv->dev && pvl->pv->status & MISSING_PV) {
if (pv->dev == pvl->pv->dev && is_missing_pv(pvl->pv)) {
log_warn("Missing device %s reappeared, updating "
"metadata for VG %s to version %u.",
pv_dev_name(pvl->pv), pv_vg_name(pvl->pv),
@ -2705,7 +2705,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
correct_vg = NULL;
}
} else dm_list_iterate_items(pvl, &correct_vg->pvs) {
if (pvl->pv->status & MISSING_PV)
if (is_missing_pv(pvl->pv))
continue;
if (!str_list_match_item(pvids, pvl->pv->dev->pvid)) {
log_debug("Cached VG %s had incorrect PV list",
@ -3275,6 +3275,11 @@ int is_pv(struct physical_volume *pv)
{
return (pv_field(pv, vg_name) ? 1 : 0);
}
int is_missing_pv(const struct physical_volume *pv)
{
return pv_field(pv, status) & MISSING_PV ? 1 : 0;
}
/*
* Returns:

View File

@ -129,7 +129,7 @@ static int _create_maps(struct dm_pool *mem, struct dm_list *pvs, struct dm_list
dm_list_iterate_items(pvl, pvs) {
if (!(pvl->pv->status & ALLOCATABLE_PV))
continue;
if (pvl->pv->status & MISSING_PV)
if (is_missing_pv(pvl->pv))
continue;
assert(pvl->pv->dev);

View File

@ -527,7 +527,7 @@ static int _area_missing(struct lv_segment *lvseg, int s)
if (seg_lv(lvseg, s)->status & PARTIAL_LV)
return 1;
} else if ((seg_type(lvseg, s) == AREA_PV) &&
(seg_pv(lvseg, s)->status & MISSING_PV))
(is_missing_pv(seg_pv(lvseg, s))))
return 1;
return 0;
@ -564,7 +564,7 @@ static struct dm_list *_failed_pv_list(struct volume_group *vg)
dm_list_init(failed_pvs);
dm_list_iterate_items(pvl, &vg->pvs) {
if (!(pvl->pv->status & MISSING_PV))
if (!is_missing_pv(pvl->pv))
continue;
/*
@ -688,7 +688,7 @@ static void _remove_missing_empty_pv(struct volume_group *vg, struct dm_list *re
dm_list_iterate_items(pvl, remove_pvs) {
dm_list_iterate_items_safe(pvl_vg, pvlt, &vg->pvs) {
if (!id_equal(&pvl->pv->id, &pvl_vg->pv->id) ||
!(pvl_vg->pv->status & MISSING_PV) ||
!is_missing_pv(pvl_vg->pv) ||
pvl_vg->pv->pe_alloc_count != 0)
continue;

View File

@ -1001,7 +1001,7 @@ static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
return 1;
}
if (allocatable_only && (pvl->pv->status & MISSING_PV)) {
if (allocatable_only && is_missing_pv(pvl->pv)) {
log_error("Physical volume %s is missing", pvname);
return 1;
}

View File

@ -152,7 +152,7 @@ static int _consolidate_vg(struct cmd_context *cmd, struct volume_group *vg)
}
dm_list_iterate_items(pvl, &vg->pvs) {
if (pvl->pv->dev && !(pvl->pv->status & MISSING_PV))
if (pvl->pv->dev && !is_missing_pv(pvl->pv))
continue;
if (r && !_remove_pv(vg, pvl, 0))
return_0;
@ -193,7 +193,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
pv = seg_pv(seg, s);
if (!pv || !pv_dev(pv) ||
(pv->status & MISSING_PV)) {
is_missing_pv(pv)) {
if (arg_count(cmd, mirrorsonly_ARG) &&
!(lv->status & MIRROR_IMAGE)) {
log_error("Non-mirror-image LV %s found: can't remove.", lv->name);
@ -224,7 +224,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
*/
dm_list_iterate_safe(pvh, pvht, &vg->pvs) {
pvl = dm_list_item(pvh, struct pv_list);
if (pvl->pv->dev && !(pvl->pv->status & MISSING_PV))
if (pvl->pv->dev && !is_missing_pv(pvl->pv))
continue;
if (!_remove_pv(vg, pvl, 0))
return_0;