]> sourceware.org Git - lvm2.git/commitdiff
vdo: data percentage
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 4 Jul 2018 21:17:38 +0000 (23:17 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 9 Jul 2018 13:28:35 +0000 (15:28 +0200)
Display percentage of used virtual size of vdo-pool volume.

lib/activate/activate.c
lib/metadata/lv.c
lib/metadata/metadata-exported.h
lib/metadata/vdo_manip.c

index 0435139f2211645ec47e525b6c0ebf7fd08687d8..28d67b4290fa5fc8587a140e33e17103f1e16384 100644 (file)
@@ -798,6 +798,21 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
                lv_seg = find_snapshot(lv);
        }
 
+       if (lv_is_vdo(lv)) {
+               if (!_lv_info(cmd, lv, 0, &status->info, NULL, NULL,
+                             with_open_count, with_read_ahead))
+                       return_0;
+               if (status->info.exists) {
+                       /* Status for VDO pool */
+                       (void) _lv_info(cmd, seg_lv(lv_seg, 0), 1, NULL,
+                                       first_seg(seg_lv(lv_seg, 0)),
+                                       &status->seg_status, 0, 0);
+                       /* Use VDO pool segtype result for VDO segtype */
+                       status->seg_status.seg = lv_seg;
+               }
+               return 1;
+       }
+
        return _lv_info(cmd, lv, 0, &status->info, lv_seg, &status->seg_status,
                        with_open_count, with_read_ahead);
 }
index d8417bc16d620fc9949859590643f239f75f8a45..9c8b0280afbcdc4ac35ed1497f4ef3b69fb72586 100644 (file)
@@ -451,7 +451,10 @@ dm_percent_t lvseg_percent_with_info_and_seg_status(const struct lv_with_info_an
                }
                break;
        case SEG_STATUS_VDO_POOL:
-               p = s->vdo_pool.usage;
+               if (seg_is_vdo_pool(lvdm->seg_status.seg))
+                       p = s->vdo_pool.usage;
+               else
+                       p = s->vdo_pool.data_usage;
                break;
        default:
                p = DM_PERCENT_INVALID;
index b6ac4cb974ebab3a62f7a4b1d19d50dbbcb730c0..92def2b2fc1a55aacd91d6ff2a72f3807f6da9bd 100644 (file)
@@ -1257,6 +1257,7 @@ struct lv_status_vdo {
        uint64_t logical_blocks_used;   /* grabbed from /sys/kvdo */
        dm_percent_t usage;
        dm_percent_t saving;
+       dm_percent_t data_usage;
 };
 
 const char *get_vdo_compression_state_name(enum dm_vdo_compression_state state);
index 5801a1b59134d9bed744838e9ba1832a85a208bd..1286e84d06cd5ef07b1176dc5aa6a4f2df6cb3bf 100644 (file)
@@ -141,6 +141,7 @@ int parse_vdo_pool_status(struct dm_pool *mem, const struct logical_volume *vdo_
 
        status->usage = DM_PERCENT_INVALID;
        status->saving = DM_PERCENT_INVALID;
+       status->data_usage = DM_PERCENT_INVALID;
 
        if (!(dm_name = dm_build_dm_name(mem, vdo_pool_lv->vg->name,
                                         vdo_pool_lv->name, NULL))) {
@@ -170,6 +171,9 @@ int parse_vdo_pool_status(struct dm_pool *mem, const struct logical_volume *vdo_
                                                result.status->total_blocks);
                status->saving = dm_make_percent(status->logical_blocks_used - status->data_blocks_used,
                                                 status->logical_blocks_used);
+               status->data_usage = dm_make_percent(status->data_blocks_used * DM_VDO_BLOCK_SIZE,
+                                                    first_seg(vdo_pool_lv)->vdo_pool_virtual_extents *
+                                                    (uint64_t) vdo_pool_lv->vg->extent_size);
        }
 
        return 1;
This page took 0.047587 seconds and 5 git commands to generate.