mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
mirror: extend adjusted_mirror_region_size API
We use adjusted_mirror_region_size() in two different contexts. Either on command line - here we do want to inform user about reduction of size. Or in pvmove activation context - here we should only use 'verbose' info.
This commit is contained in:
parent
fa6482344c
commit
736f40134b
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.112 -
|
Version 2.02.112 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Don't print message in adjusted_mirror_region_size() in activation.
|
||||||
Improve lv_update_and_reload() to find out proper lock holding LV.
|
Improve lv_update_and_reload() to find out proper lock holding LV.
|
||||||
Improve search of LV in lv_ondisk().
|
Improve search of LV in lv_ondisk().
|
||||||
Do not scan sysfs in lv_check_not_in_use() when device is closed.
|
Do not scan sysfs in lv_check_not_in_use() when device is closed.
|
||||||
|
@ -6849,7 +6849,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
|||||||
|
|
||||||
lp->region_size = adjusted_mirror_region_size(vg->extent_size,
|
lp->region_size = adjusted_mirror_region_size(vg->extent_size,
|
||||||
lp->extents,
|
lp->extents,
|
||||||
lp->region_size);
|
lp->region_size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(lv = lv_create_empty(new_lv_name ? : "lvol%d", NULL,
|
if (!(lv = lv_create_empty(new_lv_name ? : "lvol%d", NULL,
|
||||||
|
@ -1000,7 +1000,7 @@ int is_temporary_mirror_layer(const struct logical_volume *lv);
|
|||||||
struct logical_volume * find_temporary_mirror(const struct logical_volume *lv);
|
struct logical_volume * find_temporary_mirror(const struct logical_volume *lv);
|
||||||
uint32_t lv_mirror_count(const struct logical_volume *lv);
|
uint32_t lv_mirror_count(const struct logical_volume *lv);
|
||||||
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
||||||
uint32_t region_size);
|
uint32_t region_size, int internal);
|
||||||
int remove_mirrors_from_segments(struct logical_volume *lv,
|
int remove_mirrors_from_segments(struct logical_volume *lv,
|
||||||
uint32_t new_mirrors, uint64_t status_mask);
|
uint32_t new_mirrors, uint64_t status_mask);
|
||||||
int add_mirrors_to_segments(struct cmd_context *cmd, struct logical_volume *lv,
|
int add_mirrors_to_segments(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
|
@ -156,9 +156,11 @@ struct lv_segment *find_mirror_seg(struct lv_segment *seg)
|
|||||||
/*
|
/*
|
||||||
* Reduce the region size if necessary to ensure
|
* Reduce the region size if necessary to ensure
|
||||||
* the volume size is a multiple of the region size.
|
* the volume size is a multiple of the region size.
|
||||||
|
*
|
||||||
|
* For internal use only log only in verbose mode
|
||||||
*/
|
*/
|
||||||
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
||||||
uint32_t region_size)
|
uint32_t region_size, int internal)
|
||||||
{
|
{
|
||||||
uint64_t region_max;
|
uint64_t region_max;
|
||||||
|
|
||||||
@ -166,8 +168,12 @@ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
|||||||
|
|
||||||
if (region_max < UINT32_MAX && region_size > region_max) {
|
if (region_max < UINT32_MAX && region_size > region_max) {
|
||||||
region_size = (uint32_t) region_max;
|
region_size = (uint32_t) region_max;
|
||||||
log_print_unless_silent("Using reduced mirror region size of %" PRIu32
|
if (!internal)
|
||||||
" sectors", region_size);
|
log_print_unless_silent("Using reduced mirror region size of %"
|
||||||
|
PRIu32 " sectors.", region_size);
|
||||||
|
else
|
||||||
|
log_verbose("Using reduced mirror region size of %"
|
||||||
|
PRIu32 " sectors.", region_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return region_size;
|
return region_size;
|
||||||
@ -1697,7 +1703,7 @@ static int _add_mirrors_that_preserve_segments(struct logical_volume *lv,
|
|||||||
|
|
||||||
adjusted_region_size = adjusted_mirror_region_size(lv->vg->extent_size,
|
adjusted_region_size = adjusted_mirror_region_size(lv->vg->extent_size,
|
||||||
lv->le_count,
|
lv->le_count,
|
||||||
region_size);
|
region_size, 1);
|
||||||
|
|
||||||
if (!(ah = allocate_extents(lv->vg, NULL, segtype, 1, mirrors, 0, 0,
|
if (!(ah = allocate_extents(lv->vg, NULL, segtype, 1, mirrors, 0, 0,
|
||||||
lv->le_count, allocatable_pvs, alloc, 0,
|
lv->le_count, allocatable_pvs, alloc, 0,
|
||||||
|
@ -440,7 +440,7 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
|
|||||||
} else
|
} else
|
||||||
region_size = adjusted_mirror_region_size(seg->lv->vg->extent_size,
|
region_size = adjusted_mirror_region_size(seg->lv->vg->extent_size,
|
||||||
seg->area_len,
|
seg->area_len,
|
||||||
mirr_state->default_region_size);
|
mirr_state->default_region_size, 1);
|
||||||
|
|
||||||
if (!dm_tree_node_add_mirror_target(node, len))
|
if (!dm_tree_node_add_mirror_target(node, len))
|
||||||
return_0;
|
return_0;
|
||||||
|
@ -1155,7 +1155,7 @@ static int _lv_update_log_type(struct cmd_context *cmd,
|
|||||||
if (old_log_count < log_count) {
|
if (old_log_count < log_count) {
|
||||||
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
|
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
|
||||||
lv->le_count,
|
lv->le_count,
|
||||||
region_size);
|
region_size, 0);
|
||||||
|
|
||||||
if (!add_mirror_log(cmd, original_lv, log_count,
|
if (!add_mirror_log(cmd, original_lv, log_count,
|
||||||
region_size, operable_pvs, alloc))
|
region_size, operable_pvs, alloc))
|
||||||
@ -1386,7 +1386,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
|
|||||||
|
|
||||||
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
|
region_size = adjusted_mirror_region_size(lv->vg->extent_size,
|
||||||
lv->le_count,
|
lv->le_count,
|
||||||
lp->region_size);
|
lp->region_size, 0);
|
||||||
|
|
||||||
if (!operable_pvs)
|
if (!operable_pvs)
|
||||||
operable_pvs = lp->pvh;
|
operable_pvs = lp->pvh;
|
||||||
|
Loading…
Reference in New Issue
Block a user