From patchwork Thu Jun 22 14:59:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 9804605 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C69660329 for ; Thu, 22 Jun 2017 15:07:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDB7228397 for ; Thu, 22 Jun 2017 15:07:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E26F1286BB; Thu, 22 Jun 2017 15:07:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36AD928397 for ; Thu, 22 Jun 2017 15:07:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62F7D18E3C7; Thu, 22 Jun 2017 15:07:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 62F7D18E3C7 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 62F7D18E3C7 Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B4A2784A7; Thu, 22 Jun 2017 15:07:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 851004E981; Thu, 22 Jun 2017 15:07:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5MExs55012161 for ; Thu, 22 Jun 2017 10:59:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6865360607; Thu, 22 Jun 2017 14:59:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE3F46062D; Thu, 22 Jun 2017 14:59:52 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D32DC65403; Thu, 22 Jun 2017 14:59:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D32DC65403 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mwilck@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D32DC65403 Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Thu, 22 Jun 2017 08:59:41 -0600 From: Martin Wilck To: Christophe Varoqui , Hannes Reinecke Date: Thu, 22 Jun 2017 16:59:03 +0200 Message-Id: <20170622145913.23714-2-mwilck@suse.com> In-Reply-To: <20170622145913.23714-1-mwilck@suse.com> References: <20170622145913.23714-1-mwilck@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 22 Jun 2017 14:59:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 22 Jun 2017 14:59:51 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -1.501 (BAYES_50, RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Xose Vazquez Perez Subject: [dm-devel] [PATCH v4 01/11] libmultipath: load_config: skip setting unnecessary defaults X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 22 Jun 2017 15:07:07 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP We have the logic for setting defaults for paths and maps in propsel.c. By pre-setting conf values with defaults in load_config(), we generate irritating log messages like 'features = "0" (setting: multipath.conf defaults/devices section)' if multipath.conf doesn't contain a features setting at all. For some config settings, we need to use declare_def_snprint_defint() now to make sure "multipathd show config" prints all defaults correctly. To avoid confusion, we don't do this for "max_sectors", because multipathd leaves this untouched by default. Signed-off-by: Martin Wilck Acked-by: Benjamin Marzinski Reviewed-by: Hannes Reinecke --- libmultipath/config.c | 16 ---------------- libmultipath/dict.c | 11 +++++++---- libmultipath/propsel.c | 6 ++++++ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/libmultipath/config.c b/libmultipath/config.c index 6b236019..60e345b3 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -606,40 +606,24 @@ load_config (char * file) if (!conf->verbosity) conf->verbosity = DEFAULT_VERBOSITY; - conf->minio = DEFAULT_MINIO; - conf->minio_rq = DEFAULT_MINIO_RQ; get_sys_max_fds(&conf->max_fds); conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE); conf->wwids_file = set_default(DEFAULT_WWIDS_FILE); conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR); - conf->features = set_default(DEFAULT_FEATURES); - conf->flush_on_last_del = DEFAULT_FLUSH; conf->attribute_flags = 0; conf->reassign_maps = DEFAULT_REASSIGN_MAPS; conf->checkint = DEFAULT_CHECKINT; conf->max_checkint = 0; - conf->pgfailback = DEFAULT_FAILBACK; - conf->fast_io_fail = DEFAULT_FAST_IO_FAIL; - conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER; - conf->detect_prio = DEFAULT_DETECT_PRIO; - conf->detect_checker = DEFAULT_DETECT_CHECKER; conf->force_sync = DEFAULT_FORCE_SYNC; conf->partition_delim = DEFAULT_PARTITION_DELIM; conf->processed_main_config = 0; conf->find_multipaths = DEFAULT_FIND_MULTIPATHS; conf->uxsock_timeout = DEFAULT_REPLY_TIMEOUT; - conf->uid_attribute = set_default(DEFAULT_UID_ATTRIBUTE); conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES; conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY; conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT; - conf->deferred_remove = DEFAULT_DEFERRED_REMOVE; - conf->skip_kpartx = DEFAULT_SKIP_KPARTX; conf->disable_changed_wwids = DEFAULT_DISABLE_CHANGED_WWIDS; conf->remove_retries = 0; - conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; - conf->san_path_err_threshold = DEFAULT_ERR_CHECKS; - conf->san_path_err_forget_rate = DEFAULT_ERR_CHECKS; - conf->san_path_err_recovery_time = DEFAULT_ERR_CHECKS; /* * preload default hwtable diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 82066f67..9dc10904 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -630,7 +630,7 @@ print_fast_io_fail(char * buff, int len, void *ptr) } declare_def_handler(fast_io_fail, set_fast_io_fail) -declare_def_snprint(fast_io_fail, print_fast_io_fail) +declare_def_snprint_defint(fast_io_fail, print_fast_io_fail, DEFAULT_FAST_IO_FAIL) declare_ovr_handler(fast_io_fail, set_fast_io_fail) declare_ovr_snprint(fast_io_fail, print_fast_io_fail) declare_hw_handler(fast_io_fail, set_fast_io_fail) @@ -1082,7 +1082,8 @@ declare_hw_snprint(delay_wait_checks, print_off_int_undef) declare_mp_handler(delay_wait_checks, set_off_int_undef) declare_mp_snprint(delay_wait_checks, print_off_int_undef) declare_def_handler(san_path_err_threshold, set_off_int_undef) -declare_def_snprint(san_path_err_threshold, print_off_int_undef) +declare_def_snprint_defint(san_path_err_threshold, print_off_int_undef, + DEFAULT_ERR_CHECKS) declare_ovr_handler(san_path_err_threshold, set_off_int_undef) declare_ovr_snprint(san_path_err_threshold, print_off_int_undef) declare_hw_handler(san_path_err_threshold, set_off_int_undef) @@ -1090,7 +1091,8 @@ declare_hw_snprint(san_path_err_threshold, print_off_int_undef) declare_mp_handler(san_path_err_threshold, set_off_int_undef) declare_mp_snprint(san_path_err_threshold, print_off_int_undef) declare_def_handler(san_path_err_forget_rate, set_off_int_undef) -declare_def_snprint(san_path_err_forget_rate, print_off_int_undef) +declare_def_snprint_defint(san_path_err_forget_rate, print_off_int_undef, + DEFAULT_ERR_CHECKS) declare_ovr_handler(san_path_err_forget_rate, set_off_int_undef) declare_ovr_snprint(san_path_err_forget_rate, print_off_int_undef) declare_hw_handler(san_path_err_forget_rate, set_off_int_undef) @@ -1098,7 +1100,8 @@ declare_hw_snprint(san_path_err_forget_rate, print_off_int_undef) declare_mp_handler(san_path_err_forget_rate, set_off_int_undef) declare_mp_snprint(san_path_err_forget_rate, print_off_int_undef) declare_def_handler(san_path_err_recovery_time, set_off_int_undef) -declare_def_snprint(san_path_err_recovery_time, print_off_int_undef) +declare_def_snprint_defint(san_path_err_recovery_time, print_off_int_undef, + DEFAULT_ERR_CHECKS) declare_ovr_handler(san_path_err_recovery_time, set_off_int_undef) declare_ovr_snprint(san_path_err_recovery_time, print_off_int_undef) declare_hw_handler(san_path_err_recovery_time, set_off_int_undef) diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 27f39517..c8ccede5 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -752,6 +752,12 @@ int select_max_sectors_kb(struct config *conf, struct multipath * mp) mp_set_ovr(max_sectors_kb); mp_set_hwe(max_sectors_kb); mp_set_conf(max_sectors_kb); + mp_set_default(max_sectors_kb, DEFAULT_MAX_SECTORS_KB); + /* + * In the default case, we will not modify max_sectors_kb in sysfs + * (see sysfs_set_max_sectors_kb()). + * Don't print a log message here to avoid user confusion. + */ return 0; out: condlog(3, "%s: max_sectors_kb = %i %s", mp->alias, mp->max_sectors_kb,