From 8256170e6a2dbed15b790e75f5d1026e3de69a16 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 21 Jul 2017 20:58:33 +0200 Subject: [PATCH] thin: warn about too big chunks size lvm2 warned about zeroing and too big chunksize (>=512KiB), but only during lvconvert, so lvcreate was creating thin-pools without any warning about possible slowness of thin provisioning because of zeroing. --- WHATS_NEW | 1 + lib/metadata/thin_manip.c | 13 ++++++++++++- tools/lvconvert.c | 5 ----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 20da268a2..41ddda79c 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.174 - ================================= + Add warning when creating thin-pool with zeroing and chunk size >= 512KiB. Introduce exit code 4 EINIT_FAILED to replace -1 when initialisation fails. Add synchronization points with udev during reshape of raid LVs. diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c index 88dc51a60..bd2d2c3b7 100644 --- a/lib/metadata/thin_manip.c +++ b/lib/metadata/thin_manip.c @@ -752,8 +752,19 @@ int update_thin_pool_params(struct cmd_context *cmd, !set_pool_discards(discards, DEFAULT_THIN_POOL_DISCARDS)) return_0; - if (*zero_new_blocks == THIN_ZERO_UNSELECTED) + if (*zero_new_blocks == THIN_ZERO_UNSELECTED) { *zero_new_blocks = (DEFAULT_THIN_POOL_ZERO) ? THIN_ZERO_YES : THIN_ZERO_NO; + log_verbose("%s pool zeroing on default.", (*zero_new_blocks == THIN_ZERO_YES) ? + "Enabling" : "Disabling"); + } + + if ((*zero_new_blocks == THIN_ZERO_YES) && + (*chunk_size >= DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE * 2)) { + log_warn("WARNING: Pool zeroing and %s large chunk size slows down thin provisioning.", + display_size(cmd, *chunk_size)); + log_warn("WARNING: Consider disabling zeroing (-Zn) or using smaller chunk size (<%s).", + display_size(cmd, DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE * 2)); + } log_verbose("Preferred pool metadata size %s.", display_size(cmd, (uint64_t)*pool_metadata_extents * extent_size)); diff --git a/tools/lvconvert.c b/tools/lvconvert.c index d90e67524..94dee9d32 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -3088,11 +3088,6 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, if (!vg_write(vg) || !vg_commit(vg)) goto_bad; - if ((seg->zero_new_blocks == THIN_ZERO_YES) && - seg->chunk_size >= DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE * 2) - log_warn("WARNING: Pool zeroing and large %s chunk size slows down provisioning.", - display_size(cmd, seg->chunk_size)); - if (activate_pool && !lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) { log_error("Failed to lock pool LV %s.", display_lvname(pool_lv)); goto out;