summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-02-15 13:30:37 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2016-02-15 13:30:37 +0100
commitabbaeef096251c4191e6da2518e646dd78b82da8 (patch)
treeb0c0812a9dc33013968106cda1b5e92adc444391
parent698e0eb851b280796e3fbe17fbe9a9158b6344c7 (diff)
downloadlvm2-abbaeef096251c4191e6da2518e646dd78b82da8.tar.gz
cleanup: use is_used_pv fn to detect whether PV is in use while reporting pv_free field
-rw-r--r--lib/report/report.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/report/report.c b/lib/report/report.c
index c964bd82e..123b9f05d 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -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);
}