master - vdo: add simple wrapper for getting pool percentage
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3d367f3348da072360c9dd251d981e627c8444ff Commit: 3d367f3348da072360c9dd251d981e627c8444ff Parent: cbadf3d3704f1153b2919392ab8259b9a798a221 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Jan 21 00:24:30 2019 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Jan 21 12:53:16 2019 +0100
vdo: add simple wrapper for getting pool percentage
Just like with i.e. thins provide simple function for getting percentage of VDO Pool usage (uses existing status function).
--- lib/activate/activate.c | 13 +++++++++++++ lib/activate/activate.h | 1 + 2 files changed, 14 insertions(+), 0 deletions(-)
lib/activate/activate.c +13 -0
@@ -1387,6 +1387,19 @@ out:return r; } +int lv_vdo_pool_percent (const struct logical_volume *lv,dm_percent_t *percent) +{ +struct lv_status_vdo *vdo_status; + +if (!lv_vdo_pool_status (lv,0 , &vdo_status)) + return_0; + + *percent = vdo_status->usage; +dm_pool_destroy (vdo_status->mem); + +return 1 ; +} +static int _lv_active (struct cmd_context *cmd,const struct logical_volume *lv) {struct lvinfo info;
lib/activate/activate.h +1 -0
@@ -198,6 +198,7 @@ int lv_thin_pool_transaction_id(const struct logical_volume *lv,int lv_thin_device_id (const struct logical_volume *lv,uint32_t *device_id);int lv_vdo_pool_status (const struct logical_volume *lv,int flush,struct lv_status_vdo **status); +int lv_vdo_pool_percent (const struct logical_volume *lv,dm_percent_t *percent);/* * Return number of LVs in the VG that are active.