]> sourceware.org Git - lvm2.git/commitdiff
report: always display 0 for pv_free field if we don't have any mda and PV is marked...
authorPeter Rajnoha <prajnoha@redhat.com>
Thu, 11 Feb 2016 14:00:43 +0000 (15:00 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 15 Feb 2016 11:44:46 +0000 (12:44 +0100)
lib/report/report.c

index 3f2bd0cd20419a28a10e86fd8c8e31ab08caa19e..c964bd82eb5a00bd291409055b0f00ba977024bb 100644 (file)
@@ -2363,6 +2363,7 @@ static int _pvused_disp(struct dm_report *rh, struct dm_pool *mem,
 {
        const struct physical_volume *pv =
            (const struct physical_volume *) data;
+
        uint64_t used = pv_used(pv);
 
        return _size64_disp(rh, mem, field, &used, private);
@@ -2374,8 +2375,21 @@ 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);
 
+       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;
+       }
+
        return _size64_disp(rh, mem, field, &freespace, private);
 }
 
This page took 1.997291 seconds and 5 git commands to generate.