mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
pool: support passing data_lv for recalculation
Support data_lv to be passed as parameter when it's not yet attached to the pool.
This commit is contained in:
parent
5175e87fda
commit
558890ad0e
@ -1229,6 +1229,7 @@ int cache_set_params(struct lv_segment *seg,
|
||||
if (!pool_seg->chunk_size &&
|
||||
/* TODO: some calc_policy solution for cache ? */
|
||||
!recalculate_pool_chunk_size_with_dev_hints(pool_seg->lv,
|
||||
seg_lv(pool_seg, 0),
|
||||
THIN_CHUNK_SIZE_CALC_METHOD_GENERIC))
|
||||
return_0;
|
||||
}
|
||||
|
@ -9457,7 +9457,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
first_seg(lv)->discards = lp->discards;
|
||||
if ((first_seg(lv)->crop_metadata = lp->crop_metadata) == THIN_CROP_METADATA_NO)
|
||||
lv->status |= LV_CROP_METADATA;
|
||||
if (!recalculate_pool_chunk_size_with_dev_hints(lv, lp->thin_chunk_size_calc_policy)) {
|
||||
if (!recalculate_pool_chunk_size_with_dev_hints(lv, seg_lv(first_seg(lv), 0),
|
||||
lp->thin_chunk_size_calc_policy)) {
|
||||
stack;
|
||||
goto revert_new_lv;
|
||||
}
|
||||
|
@ -885,6 +885,7 @@ int thin_pool_feature_supported(const struct logical_volume *lv, int feature);
|
||||
int update_thin_pool_lv(struct logical_volume *lv, int activate);
|
||||
|
||||
int recalculate_pool_chunk_size_with_dev_hints(struct logical_volume *pool_lv,
|
||||
struct logical_volume *pool_data_lv,
|
||||
int chunk_size_calc_policy);
|
||||
int validate_cache_chunk_size(struct cmd_context *cmd, uint32_t chunk_size);
|
||||
int validate_thin_pool_chunk_size(struct cmd_context *cmd, uint32_t chunk_size);
|
||||
|
@ -416,9 +416,9 @@ int validate_pool_chunk_size(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
int recalculate_pool_chunk_size_with_dev_hints(struct logical_volume *pool_lv,
|
||||
struct logical_volume *pool_data_lv,
|
||||
int chunk_size_calc_policy)
|
||||
{
|
||||
struct logical_volume *pool_data_lv;
|
||||
struct lv_segment *seg;
|
||||
struct physical_volume *pv;
|
||||
struct cmd_context *cmd = pool_lv->vg->cmd;
|
||||
@ -439,7 +439,6 @@ int recalculate_pool_chunk_size_with_dev_hints(struct logical_volume *pool_lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
pool_data_lv = seg_lv(first_seg(pool_lv), 0);
|
||||
dm_list_iterate_items(seg, &pool_data_lv->segments) {
|
||||
switch (seg_type(seg, 0)) {
|
||||
case AREA_PV:
|
||||
|
@ -3409,7 +3409,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
seg->zero_new_blocks = zero_new_blocks;
|
||||
if (crop_metadata == THIN_CROP_METADATA_NO)
|
||||
pool_lv->status |= LV_CROP_METADATA;
|
||||
if (!recalculate_pool_chunk_size_with_dev_hints(pool_lv, chunk_calc))
|
||||
if (!recalculate_pool_chunk_size_with_dev_hints(pool_lv, data_lv, chunk_calc))
|
||||
goto_bad;
|
||||
|
||||
/* Error when full */
|
||||
|
Loading…
Reference in New Issue
Block a user