summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-02-16 13:02:00 -0600
committerDavid Teigland <teigland@redhat.com>2016-02-17 13:25:03 -0600
commit0ca93d07f8f15ed020168829a2c3d86091413fba (patch)
treeaa3704382cbb32b52a1b31ecfbe95bb28832311c
parent158314c55d9f89a043c43c8fa85708d969aa0763 (diff)
downloadlvm2-0ca93d07f8f15ed020168829a2c3d86091413fba.tar.gz
metadata: use pv_write_list for _check_old_pv_ext_for_vg
The _check_old_pv_ext_for_vg() function only needs to do pv_write(), so it can use the simpler pv_list structs on the pv_write_list.
-rw-r--r--lib/metadata/metadata.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 04da9a9f3..7034f779c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3071,12 +3071,12 @@ out:
return r;
}
-static int _pv_in_pvs_to_write_list(struct physical_volume *pv, struct volume_group *vg)
+static int _pv_in_pv_list(struct physical_volume *pv, struct dm_list *head)
{
- struct pv_to_write *pvw;
+ struct pv_list *pvl;
- dm_list_iterate_items(pvw, &vg->pvs_to_write) {
- if (pvw->pv == pv)
+ dm_list_iterate_items(pvl, head) {
+ if (pvl->pv == pv)
return 1;
}
@@ -3089,8 +3089,7 @@ static int _pv_in_pvs_to_write_list(struct physical_volume *pv, struct volume_gr
*/
static int _check_old_pv_ext_for_vg(struct volume_group *vg)
{
- struct pv_list *pvl;
- struct pv_to_write *pvw;
+ struct pv_list *pvl, *new_pvl;
int pv_needs_rewrite;
if (!(vg->fid->fmt->features & FMT_PV_FLAGS))
@@ -3109,15 +3108,15 @@ static int _check_old_pv_ext_for_vg(struct volume_group *vg)
/*
* Schedule PV for writing only once!
*/
- if (_pv_in_pvs_to_write_list(pvl->pv, vg))
+ if (_pv_in_pv_list(pvl->pv, &vg->pv_write_list))
continue;
- if (!(pvw = dm_pool_zalloc(vg->vgmem, sizeof(*pvw)))) {
+ if (!(new_pvl = dm_pool_zalloc(vg->vgmem, sizeof(*new_pvl)))) {
log_error("pv_to_write allocation for '%s' failed", pv_dev_name(pvl->pv));
return 0;
}
- pvw->pv = pvl->pv;
- dm_list_add(&vg->pvs_to_write, &pvw->list);
+ new_pvl->pv = pvl->pv;
+ dm_list_add(&vg->pv_write_list, &new_pvl->list);
}
}