mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
lvcreate: improve --chunksize support for cached volume.
Support parsing --chunksize option also when converting. Now user can use cache pool created with i.e. 32K chunksize, while in caching user can select 512K blocks. Tool is supposed to validate cache metadata size is big enough to support such chunk size. Otherwise error is shown.
This commit is contained in:
parent
d3b15674df
commit
d1ecbfa52d
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.153 -
|
Version 2.02.153 -
|
||||||
==================================
|
==================================
|
||||||
|
Support --chunksize option also when caching LV when possible.
|
||||||
Add function to check for target presence and version via 1 ioctl.
|
Add function to check for target presence and version via 1 ioctl.
|
||||||
|
|
||||||
Version 2.02.152 - 30th April 2016
|
Version 2.02.152 - 30th April 2016
|
||||||
|
@ -7166,9 +7166,17 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (seg_is_cache(lp)) {
|
||||||
|
/* validate metadata size */
|
||||||
|
if (!validate_lv_cache_chunk_size(pool_lv, lp->chunk_size))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
first_seg(pool_lv)->chunk_size = lp->chunk_size;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate volume size to to aling on chunk for small extents */
|
/* Validate volume size to to aling on chunk for small extents */
|
||||||
/* Cache chunk size is always set */
|
/* Cache chunk size is always set */
|
||||||
size = seg_is_cache(lp) ? lp->chunk_size : first_seg(pool_lv)->chunk_size;
|
size = first_seg(pool_lv)->chunk_size;
|
||||||
if (size > vg->extent_size) {
|
if (size > vg->extent_size) {
|
||||||
/* Align extents on chunk boundary size */
|
/* Align extents on chunk boundary size */
|
||||||
size = ((uint64_t)vg->extent_size * lp->extents + size - 1) /
|
size = ((uint64_t)vg->extent_size * lp->extents + size - 1) /
|
||||||
@ -7427,27 +7435,15 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
/* Unlock memory if possible */
|
/* Unlock memory if possible */
|
||||||
memlock_unlock(vg->cmd);
|
memlock_unlock(vg->cmd);
|
||||||
|
|
||||||
if (lv_is_cache_pool(lv) || lv_is_cache(lv)) {
|
if (lv_is_cache_pool(lv)) {
|
||||||
if (!cache_set_mode(first_seg(lv), lp->cache_mode)) {
|
if (!cache_set_params(first_seg(lv),
|
||||||
|
lp->cache_mode,
|
||||||
|
lp->policy_name,
|
||||||
|
lp->policy_settings,
|
||||||
|
lp->chunk_size)) {
|
||||||
stack;
|
stack;
|
||||||
goto revert_new_lv;
|
goto revert_new_lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cache_set_policy(first_seg(lv), lp->policy_name, lp->policy_settings)) {
|
|
||||||
stack;
|
|
||||||
goto revert_new_lv;
|
|
||||||
}
|
|
||||||
|
|
||||||
pool_lv = pool_lv ? : lv;
|
|
||||||
if (lp->chunk_size) {
|
|
||||||
first_seg(pool_lv)->chunk_size = lp->chunk_size;
|
|
||||||
/* TODO: some calc_policy solution for cache ? */
|
|
||||||
if (!recalculate_pool_chunk_size_with_dev_hints(pool_lv, lp->passed_args,
|
|
||||||
THIN_CHUNK_SIZE_CALC_METHOD_GENERIC)) {
|
|
||||||
stack;
|
|
||||||
goto revert_new_lv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (lv_is_raid(lv)) {
|
} else if (lv_is_raid(lv)) {
|
||||||
first_seg(lv)->min_recovery_rate = lp->min_recovery_rate;
|
first_seg(lv)->min_recovery_rate = lp->min_recovery_rate;
|
||||||
first_seg(lv)->max_recovery_rate = lp->max_recovery_rate;
|
first_seg(lv)->max_recovery_rate = lp->max_recovery_rate;
|
||||||
@ -7649,10 +7645,11 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
}
|
}
|
||||||
lv = tmp_lv;
|
lv = tmp_lv;
|
||||||
|
|
||||||
if (!cache_set_mode(first_seg(lv), lp->cache_mode))
|
if (!cache_set_params(first_seg(lv),
|
||||||
return_NULL; /* revert? */
|
lp->cache_mode,
|
||||||
|
lp->policy_name,
|
||||||
if (!cache_set_policy(first_seg(lv), lp->policy_name, lp->policy_settings))
|
lp->policy_settings,
|
||||||
|
(lp->passed_args & PASS_ARG_CHUNK_SIZE) ? lp->chunk_size : 0))
|
||||||
return_NULL; /* revert? */
|
return_NULL; /* revert? */
|
||||||
|
|
||||||
cache_check_for_warns(first_seg(lv));
|
cache_check_for_warns(first_seg(lv));
|
||||||
|
@ -260,6 +260,8 @@ and the default value is 4KiB.
|
|||||||
.br
|
.br
|
||||||
For cache pools the value must a multiple of 32KiB
|
For cache pools the value must a multiple of 32KiB
|
||||||
between 32KiB and 1GiB. The default is 64KiB.
|
between 32KiB and 1GiB. The default is 64KiB.
|
||||||
|
When the size is specified with volume caching, it may not be smaller
|
||||||
|
then cache pool creation chunk size was.
|
||||||
.br
|
.br
|
||||||
For thin pools the value must be a multiple of 64KiB
|
For thin pools the value must be a multiple of 64KiB
|
||||||
between 64KiB and 1GiB.
|
between 64KiB and 1GiB.
|
||||||
|
Loading…
Reference in New Issue
Block a user