log_verbose("Changing uuid of %s to %s.", pv_name, uuid);
if (*pv->vg_name) {
orig_vg_name = pv->vg_name;
- orig_pe_alloc_count = pv->pe_alloc_count;
+ orig_pe_alloc_count = get_pv_pe_alloc_count(pv);
pv->vg_name = ORPHAN;
pv->pe_alloc_count = 0;
if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) {
if (!*pv->vg_name)
size = pv->size;
else
- size = (pv->pe_count - pv->pe_alloc_count) * pv->pe_size;
+ size = (pv->pe_count - get_pv_pe_alloc_count(pv)) * pv->pe_size;
if (arg_count(cmd, short_ARG)) {
log_print("Device \"%s\" has a capacity of %s", pv_name,
pv->fmt ? pv->fmt->name : " ",
display_size(cmd, (uint64_t) pv->pe_count * pv->pe_size),
display_size(cmd,
- (uint64_t) (pv->pe_count - pv->pe_alloc_count) *
+ (uint64_t) (pv->pe_count - get_pv_pe_alloc_count(pv)) *
pv->pe_size));
return;
}
}
vg->pv_count--;
- vg->free_count -= pv->pe_count - pv->pe_alloc_count;
+ vg->free_count -= pv->pe_count - get_pv_pe_alloc_count(pv);
vg->extent_count -= pv->pe_count;
if (!vg_write(vg) || !vg_commit(vg)) {
vg_from->extent_count -= pv->pe_count;
vg_to->extent_count += pv->pe_count;
- vg_from->free_count -= pv->pe_count - pv->pe_alloc_count;
- vg_to->free_count += pv->pe_count - pv->pe_alloc_count;
+ vg_from->free_count -= pv->pe_count - get_pv_pe_alloc_count(pv);
+ vg_to->free_count += pv->pe_count - get_pv_pe_alloc_count(pv);
return 1;
}