]> sourceware.org Git - lvm2.git/commitdiff
vdo: refactor vdo_params passing
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 14 Dec 2023 13:09:55 +0000 (14:09 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 10 Jan 2024 13:02:22 +0000 (14:02 +0100)
Introduce vdo_convert_params and use vdo_params from this structure
also with lvcreate_params.

Later we will use this for convertion of thin-pool data volume to VDO.

lib/metadata/lv_manip.c
lib/metadata/metadata-exported.h
tools/lvcreate.c

index 3ecb58b2c8956113ceb024d8cfda1a8f3370e77c..5d0eebfa3e7fab8e6c4d18f77bbb5cb6b9e707dc 100644 (file)
@@ -9718,7 +9718,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
        }
 
        if (seg_is_vdo_pool(lp)) {
-               if (!convert_vdo_pool_lv(lv, &lp->vdo_params, &lp->virtual_extents,
+               if (!convert_vdo_pool_lv(lv, &lp->vcp.vdo_params, &lp->virtual_extents,
                                         1, lp->vdo_pool_header_size)) {
                        stack;
                        goto deactivate_and_revert_new_lv;
index de447fffa046c2e760e9f3cdf540302f60a1d16c..22bb1f30554f72837f595ec808eccb99cfe590e3 100644 (file)
@@ -976,6 +976,17 @@ static inline int is_change_activating(activation_change_t change)
         return ((change != CHANGE_AN) && (change != CHANGE_ALN));
 }
 
+struct vdo_convert_params {
+       struct dm_vdo_target_params vdo_params; /* VDO parameters for vdoformat */
+       const char *lv_name;
+       uint32_t virtual_extents;
+       activation_change_t activate;
+       int do_zero;
+       int do_wipe_signatures; /* Used for wiping VDO backend volume */
+       force_t force;
+       int yes;
+};
+
 /* FIXME: refactor and reduce the size of this struct! */
 struct lvcreate_params {
        /* flags */
@@ -1050,7 +1061,7 @@ struct lvcreate_params {
        uint32_t read_ahead; /* all */
        int approx_alloc;     /* all */
        alloc_policy_t alloc; /* all */
-       struct dm_vdo_target_params vdo_params; /* vdo */
+       struct vdo_convert_params vcp;
        uint64_t vdo_pool_header_size; /* VDO */
 
        int raidintegrity;
index add2d6971d26f258c1ea7a3f309ea6e961d0b505..bbe8bde03198d72de0d2901b670d75091f6e946f 100644 (file)
@@ -324,19 +324,19 @@ static int _update_extents_params(struct volume_group *vg,
        }
 
        if (seg_is_vdo(lp)) {
-               vdo_pool_max_extents = get_vdo_pool_max_extents(&lp->vdo_params, vg->extent_size);
+               vdo_pool_max_extents = get_vdo_pool_max_extents(&lp->vcp.vdo_params, vg->extent_size);
                if (extents > vdo_pool_max_extents) {
                        if (lcp->percent == PERCENT_NONE) {
                                log_error("Can't use %s size. Maximal supported VDO POOL volume size with slab size %s is %s.",
                                          display_size(vg->cmd, (uint64_t)vg->extent_size * extents),
-                                         display_size(vg->cmd, (uint64_t)lp->vdo_params.slab_size_mb << (20 - SECTOR_SHIFT)),
+                                         display_size(vg->cmd, (uint64_t)lp->vcp.vdo_params.slab_size_mb << (20 - SECTOR_SHIFT)),
                                          display_size(vg->cmd, (uint64_t)vg->extent_size * vdo_pool_max_extents));
                                return 0;
                        }
                        extents = vdo_pool_max_extents;
                        log_verbose("Using maximal supported VDO POOL volume size %s (with slab size %s).",
                                    display_size(vg->cmd, (uint64_t)vg->extent_size * extents),
-                                   display_size(vg->cmd, (uint64_t)lp->vdo_params.slab_size_mb << (20 - SECTOR_SHIFT)));
+                                   display_size(vg->cmd, (uint64_t)lp->vcp.vdo_params.slab_size_mb << (20 - SECTOR_SHIFT)));
                }
        }
 
@@ -724,7 +724,7 @@ static int _read_vdo_params(struct cmd_context *cmd,
                return 1;
 
        // prefiling settings here
-       if (!fill_vdo_target_params(cmd, &lp->vdo_params, &lp->vdo_pool_header_size, NULL))
+       if (!fill_vdo_target_params(cmd, &lp->vcp.vdo_params, &lp->vdo_pool_header_size, NULL))
                return_0;
 
        if ((lcp->virtual_size <= DM_VDO_LOGICAL_SIZE_MAXIMUM) &&
@@ -735,7 +735,7 @@ static int _read_vdo_params(struct cmd_context *cmd,
        }
 
        // override with optional vdo settings
-       if (!get_vdo_settings(cmd, &lp->vdo_params, NULL))
+       if (!get_vdo_settings(cmd, &lp->vcp.vdo_params, NULL))
                return_0;
 
        return 1;
@@ -1767,8 +1767,8 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
            !check_vdo_constrains(cmd, &(struct vdo_pool_size_config) {
                                  .physical_size = (uint64_t)lp->extents * vg->extent_size,
                                  .virtual_size = lcp->virtual_size,
-                                 .block_map_cache_size_mb = lp->vdo_params.block_map_cache_size_mb,
-                                 .index_memory_size_mb = lp->vdo_params.index_memory_size_mb }))
+                                 .block_map_cache_size_mb = lp->vcp.vdo_params.block_map_cache_size_mb,
+                                 .index_memory_size_mb = lp->vcp.vdo_params.index_memory_size_mb }))
                goto_out;
 
        if (seg_is_thin(lp) && !_validate_internal_thin_processing(lp))
This page took 0.047607 seconds and 5 git commands to generate.