mirror of
git://sourceware.org/git/lvm2.git
synced 2025-07-07 16:58:58 +03:00
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).
This commit is contained in:
@ -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;
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user