mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cleanup: use is_used_pv fn to detect whether PV is in use while reporting pv_free field
This commit is contained in:
parent
698e0eb851
commit
abbaeef096
@ -2375,20 +2375,12 @@ static int _pvfree_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
{
|
{
|
||||||
const struct physical_volume *pv =
|
const struct physical_volume *pv =
|
||||||
(const struct physical_volume *) data;
|
(const struct physical_volume *) data;
|
||||||
struct lvmcache_info *info;
|
uint64_t freespace;
|
||||||
uint32_t ext_flags;
|
|
||||||
uint64_t freespace = pv_free(pv);
|
|
||||||
|
|
||||||
if (is_orphan(pv)) {
|
if (is_orphan(pv) && is_used_pv(pv))
|
||||||
if (!(info = lvmcache_info_from_pvid((const char *) &pv->id, 0))) {
|
|
||||||
log_error("Failed to find cached info for PV %s.", pv_dev_name(pv));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ext_flags = lvmcache_ext_flags(info);
|
|
||||||
if (ext_flags & PV_EXT_USED)
|
|
||||||
freespace = 0;
|
freespace = 0;
|
||||||
}
|
else
|
||||||
|
freespace = pv_free(pv);
|
||||||
|
|
||||||
return _size64_disp(rh, mem, field, &freespace, private);
|
return _size64_disp(rh, mem, field, &freespace, private);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user