From 54617805b8a5d20dee6efa4ab26358345de49800 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 16 Aug 2023 13:29:55 +0200 Subject: [PATCH] lvconvert: use vg mempool Keep allocation for a VG within vg memory pool. --- tools/lvconvert.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 7d2104c88..3db4d839d 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -3115,9 +3115,9 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, /* An existing LV needs to have its lock freed once it becomes a data LV. */ if (vg_is_shared(vg) && lv->lock_args) { - lockd_data_args = dm_pool_strdup(cmd->mem, lv->lock_args); - lockd_data_name = dm_pool_strdup(cmd->mem, lv->name); - memcpy(&lockd_data_id, &lv->lvid.id[1], sizeof(struct id)); + lockd_data_args = dm_pool_strdup(lv->vg->vgmem, lv->lock_args); + lockd_data_name = dm_pool_strdup(lv->vg->vgmem, lv->name); + lockd_data_id = lv->lvid.id[1]; } /* If LV is inactive here, ensure it's not active elsewhere. */ @@ -3144,9 +3144,9 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, /* An existing LV needs to have its lock freed once it becomes a meta LV. */ if (vg_is_shared(vg) && metadata_lv->lock_args) { - lockd_meta_args = dm_pool_strdup(cmd->mem, metadata_lv->lock_args); - lockd_meta_name = dm_pool_strdup(cmd->mem, metadata_lv->name); - memcpy(&lockd_meta_id, &metadata_lv->lvid.id[1], sizeof(struct id)); + lockd_meta_args = dm_pool_strdup(metadata_lv->vg->vgmem, metadata_lv->lock_args); + lockd_meta_name = dm_pool_strdup(metadata_lv->vg->vgmem, metadata_lv->name); + lockd_meta_id = metadata_lv->lvid.id[1]; } if (metadata_lv == lv) { @@ -3550,9 +3550,9 @@ static int _cache_vol_attach(struct cmd_context *cmd, * lock does not need to be created for it again.) */ if (vg_is_shared(vg) && lv_fast->lock_args) { - lockd_fast_args = dm_pool_strdup(cmd->mem, lv_fast->lock_args); - lockd_fast_name = dm_pool_strdup(cmd->mem, lv_fast->name); - memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id)); + lockd_fast_args = dm_pool_strdup(lv_fast->vg->vgmem, lv_fast->lock_args); + lockd_fast_name = dm_pool_strdup(lv_fast->vg->vgmem, lv_fast->name); + lockd_fast_id = lv_fast->lvid.id[1]; } /* @@ -6273,9 +6273,9 @@ int lvconvert_writecache_attach_single(struct cmd_context *cmd, * lv_wcorig gets no lock. */ if (vg_is_shared(vg) && lv_fast->lock_args) { - lockd_fast_args = dm_pool_strdup(cmd->mem, lv_fast->lock_args); - lockd_fast_name = dm_pool_strdup(cmd->mem, lv_fast->name); - memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id)); + lockd_fast_args = dm_pool_strdup(lv_fast->vg->vgmem, lv_fast->lock_args); + lockd_fast_name = dm_pool_strdup(lv_fast->vg->vgmem, lv_fast->name); + lockd_fast_id = lv_fast->lvid.id[1]; } if (!_writecache_zero(cmd, lv_fast)) { -- 2.43.5