mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +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 *) data;
|
||||
struct lvmcache_info *info;
|
||||
uint32_t ext_flags;
|
||||
uint64_t freespace = pv_free(pv);
|
||||
uint64_t freespace;
|
||||
|
||||
if (is_orphan(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;
|
||||
}
|
||||
if (is_orphan(pv) && is_used_pv(pv))
|
||||
freespace = 0;
|
||||
else
|
||||
freespace = pv_free(pv);
|
||||
|
||||
return _size64_disp(rh, mem, field, &freespace, private);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user