mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-28 02:50:41 +03:00
Factor out adjusted_mirror_region_size()
This commit is contained in:
parent
197632009b
commit
bfd31e94d5
@ -1,5 +1,6 @@
|
||||
Version 2.01.15 -
|
||||
=================================
|
||||
Factor out adjusted_mirror_region_size().
|
||||
Move compose_log_line() into mirror directory.
|
||||
Factor out _get_library_path().
|
||||
Don't kill idling clvmd threads.
|
||||
|
@ -543,6 +543,8 @@ int vg_remove_snapshot(struct logical_volume *cow);
|
||||
* Mirroring functions
|
||||
*/
|
||||
struct alloc_handle;
|
||||
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
||||
uint32_t region_size);
|
||||
int create_mirror_layers(struct alloc_handle *ah,
|
||||
uint32_t first_area,
|
||||
uint32_t num_mirrors,
|
||||
|
@ -22,6 +22,26 @@
|
||||
#include "lv_alloc.h"
|
||||
#include "lvm-string.h"
|
||||
|
||||
/*
|
||||
* Ensure region size is compatible with volume size.
|
||||
*/
|
||||
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
|
||||
uint32_t region_size)
|
||||
{
|
||||
uint32_t region_max;
|
||||
|
||||
region_max = (1 << (ffs(extents) - 1)) * extent_size;
|
||||
|
||||
if (region_max < region_size) {
|
||||
region_size = region_max;
|
||||
log_print("Using reduced mirror region size of %" PRIu32
|
||||
" sectors", region_max);
|
||||
return region_max;
|
||||
}
|
||||
|
||||
return region_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reduce mirrored_seg to num_mirrors images.
|
||||
*/
|
||||
|
@ -416,7 +416,7 @@ static int _read_params(struct lvcreate_params *lp, struct cmd_context *cmd,
|
||||
|
||||
static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
{
|
||||
uint32_t size_rest, region_max;
|
||||
uint32_t size_rest;
|
||||
uint32_t status = 0;
|
||||
uint64_t tmp_size;
|
||||
struct volume_group *vg;
|
||||
@ -572,14 +572,9 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
}
|
||||
|
||||
if (lp->mirrors > 1) {
|
||||
/* FIXME Adjust lp->region_size if necessary */
|
||||
region_max = (1 << (ffs(lp->extents) - 1)) * vg->extent_size;
|
||||
|
||||
if (region_max < lp->region_size) {
|
||||
lp->region_size = region_max;
|
||||
log_print("Using reduced mirror region size of %" PRIu32
|
||||
" sectors", lp->region_size);
|
||||
}
|
||||
lp->region_size = adjusted_mirror_region_size(vg->extent_size,
|
||||
lp->extents,
|
||||
lp->region_size);
|
||||
|
||||
/* FIXME Calculate how many extents needed for the log */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user