diff --git a/WHATS_NEW b/WHATS_NEW index 1075cd871..bdfb16d1f 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.34 - =================================== + Add pvseg_is_allocated() for identifying a PV segment allocated to a LV. Add list_move() for moving elements from one list to another. Add 'is_reserved_lvname()' for identifying hidden LVs. Correct command name in lvmdiskscan man page. diff --git a/lib/display/display.c b/lib/display/display.c index 90e9b6854..87e34fa47 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -270,7 +270,7 @@ void pvdisplay_segments(const struct physical_volume *pv) log_print("Physical extent %u to %u:", pvseg->pe, pvseg->pe + pvseg->len - 1); - if (pvseg->lvseg) { + if (pvseg_is_allocated(pvseg)) { log_print(" Logical volume\t%s%s/%s", pvseg->lvseg->lv->vg->cmd->dev_dir, pvseg->lvseg->lv->vg->name, diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 12273512e..e0d55927b 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -151,6 +151,8 @@ struct pv_segment { uint32_t lv_area; /* Index to area in LV segment */ }; +#define pvseg_is_allocated(pvseg) ((pvseg)->lvseg) + struct physical_volume { struct id id; struct device *dev; diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index dc6e624ac..2554ee8fe 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -612,7 +612,7 @@ int vg_change_pesize(struct cmd_context *cmd __attribute((unused)), /* foreach free PV Segment */ list_iterate_items(pvseg, &pv->segments) { - if (pvseg->lvseg) + if (pvseg_is_allocated(pvseg)) continue; if (!_recalc_extents(&pvseg->pe, pv_dev_name(pv), diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c index ef60539ce..4403d119c 100644 --- a/lib/metadata/pv_manip.c +++ b/lib/metadata/pv_manip.c @@ -233,7 +233,7 @@ uint32_t pv_list_extents_free(const struct list *pvh) list_iterate_items(pvl, pvh) { list_iterate_items(per, pvl->pe_ranges) { list_iterate_items(pvseg, &pvl->pv->segments) { - if (!pvseg->lvseg) /* free space */ + if (!pvseg_is_allocated(pvseg)) extents += _overlap_pe(pvseg, per); } }