main - vdo: read live vdo size configuration
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1bed2cafe83096cf01cfff5cd2cd64ecb32b7d78 Commit: 1bed2cafe83096cf01cfff5cd2cd64ecb32b7d78 Parent: 773b88e028ab2965a8c185f5f2147334f8f2bbfd Author: Zdenek Kabelac <[email protected]> AuthorDate: Sun Jan 15 21:24:28 2023 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Jan 16 12:37:40 2023 +0100
vdo: read live vdo size configuration
Introduce struct vdo_pool_size_config usable to calculate necessary memory size for active VDO volume.
Function lv_vdo_pool_size_config() is able to read out this configuration out of runtime DM table line.
--- lib/activate/activate.c | 31 +++++++++++++++++++ lib/activate/activate.h | 2 ++ lib/activate/dev_manager.c | 65 ++++++++++++++++++++++++++++++++++++++++ lib/activate/dev_manager.h | 3 ++ lib/metadata/metadata-exported.h | 6 ++++ 5 files changed, 107 insertions(+)
lib/activate/activate.c +31 -0
@@ -322,6 +322,11 @@ int lv_vdo_pool_percent(const struct logical_volume *lv, dm_percent_t *percent) {return 0 ; } +int lv_vdo_pool_size_config (const struct logical_volume *lv, +struct vdo_pool_size_config *cfg) +{ +return 0 ; +}int lvs_in_vg_activated (const struct volume_group *vg) {return 0 ;
@@ -1363,6 +1368,32 @@ int lv_vdo_pool_percent(const struct logical_volume *lv, dm_percent_t *percent)return 1 ; } +/* +* lv_vdo_pool_size_config obtains size configuration from active VDO table line +* +* If the 'params' string has been already retrieved, use it. +* If the mempool already exists, use it. +* +*/ +int lv_vdo_pool_size_config (const struct logical_volume *lv, +struct vdo_pool_size_config *cfg) +{ +struct dev_manager *dm; +int r; + +if (!lv_info (lv->vg->cmd, lv,1 ,NULL ,0 ,0 )) +return 1 ;/* Inactive VDO pool -> no runtime config */ + +if (!(dm =dev_manager_create (lv->vg->cmd, lv->vg->name, !lv_is_pvmove (lv)))) + return_0; + + r =dev_manager_vdo_pool_size_config (dm, lv, cfg); + +dev_manager_destroy (dm); + +return r; +} +static int _lv_active (struct cmd_context *cmd,const struct logical_volume *lv) {struct lvinfo info;
lib/activate/activate.h +2 -0
@@ -204,6 +204,8 @@ int lv_thin_pool_status(const struct logical_volume *lv, int flush,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); +int lv_vdo_pool_size_config (const struct logical_volume *lv, +struct vdo_pool_size_config *cfg);/* * Return number of LVs in the VG that are active.
lib/activate/dev_manager.c +65 -0
71 lines not on this page · raw message
lib/activate/dev_manager.h +3 -0
@@ -83,6 +83,9 @@ int dev_manager_thin_pool_status(struct dev_manager *dm,int dev_manager_vdo_pool_status (struct dev_manager *dm,const struct logical_volume *lv,int flush,struct lv_status_vdo **status,int *exists); +int dev_manager_vdo_pool_size_config (struct dev_manager *dm, +const struct logical_volume *lv, +struct vdo_pool_size_config *cfg);int dev_manager_suspend (struct dev_manager *dm,const struct logical_volume *lv,struct lv_activate_opts *laopts,int lockfs,int flush_required); int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv,
lib/metadata/metadata-exported.h +6 -0
@@ -1376,6 +1376,12 @@ int fill_vdo_target_params(struct cmd_context *cmd,struct dm_vdo_target_params *vtp, uint64_t *vdo_pool_header_size, struct profile *profile); +struct vdo_pool_size_config { +uint64_t physical_size; +uint64_t virtual_size; +uint32_t block_map_cache_size_mb; +uint32_t index_memory_size_mb; +};int check_vdo_constrains (struct cmd_context *cmd,uint64_t physical_size,uint64_t virtual_size,struct dm_vdo_target_params *vtp);/* -- metadata/vdo_manip.c */