1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

thin: better dbg msgs and avoid uninit. value on chunk size recalc

This commit is contained in:
Peter Rajnoha 2013-09-30 08:58:57 +02:00
parent e02ff32260
commit 24ffd5244f

View File

@ -5539,7 +5539,7 @@ static int _recalculate_thin_pool_chunk_size_with_dev_hints(struct lvcreate_para
struct lv_segment *seg; struct lv_segment *seg;
struct physical_volume *pv; struct physical_volume *pv;
struct cmd_context *cmd = pool_lv->vg->cmd; struct cmd_context *cmd = pool_lv->vg->cmd;
unsigned long previous_hint = 0, hint; unsigned long previous_hint = 0, hint = 0;
uint32_t chunk_size = lp->chunk_size; uint32_t chunk_size = lp->chunk_size;
uint32_t default_chunk_size = lp->thin_chunk_size_calc_method == THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE ? uint32_t default_chunk_size = lp->thin_chunk_size_calc_method == THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE ?
DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE*2 : DEFAULT_THIN_POOL_CHUNK_SIZE*2; DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE*2 : DEFAULT_THIN_POOL_CHUNK_SIZE*2;
@ -5564,11 +5564,18 @@ static int _recalculate_thin_pool_chunk_size_with_dev_hints(struct lvcreate_para
previous_hint = hint; previous_hint = hint;
} }
if (!hint) {
log_debug_alloc("No usable device hint found while recalculating "
"thin pool chunk size for %s.", pool_lv->name);
goto out;
}
if (hint < DM_THIN_MIN_DATA_BLOCK_SIZE || if (hint < DM_THIN_MIN_DATA_BLOCK_SIZE ||
hint > DM_THIN_MAX_DATA_BLOCK_SIZE) { hint > DM_THIN_MAX_DATA_BLOCK_SIZE) {
log_debug_alloc("Calculated value of %ld sectors for thin pool " log_debug_alloc("Calculated chunk size value of %ld sectors "
"chunk size is out of allowed range (%d-%d).", "for thin pool %s is out of allowed range (%d-%d).",
hint, DM_THIN_MIN_DATA_BLOCK_SIZE, DM_THIN_MAX_DATA_BLOCK_SIZE); hint, pool_lv->name, DM_THIN_MIN_DATA_BLOCK_SIZE,
DM_THIN_MAX_DATA_BLOCK_SIZE);
} else } else
chunk_size = hint >= default_chunk_size ? hint : default_chunk_size; chunk_size = hint >= default_chunk_size ? hint : default_chunk_size;
out: out: