From patchwork Tue Jan 8 13:53:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1946211 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork2.kernel.org (Postfix) with ESMTP id 08986DF23A for ; Tue, 8 Jan 2013 13:58:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DttCM019906; Tue, 8 Jan 2013 08:55:55 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsXiv004640 for ; Tue, 8 Jan 2013 08:54:33 -0500 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsXF5010397 for ; Tue, 8 Jan 2013 08:54:33 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r08DsVY5010030 for ; Tue, 8 Jan 2013 08:54:31 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 3ED9AA51F7; Tue, 8 Jan 2013 14:54:28 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 8 Jan 2013 14:53:47 +0100 Message-Id: <1357653259-62650-10-git-send-email-hare@suse.de> In-Reply-To: <1357653259-62650-1-git-send-email-hare@suse.de> References: <1357653259-62650-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.299 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 09/42] Do not trigger a map reload on priority updates X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development 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 update_path_groups() is just there to update the priority groups, so it should trigger a table reload only if the priority has indeed changed. Signed-off-by: Hannes Reinecke --- libmultipath/configure.c | 13 ++++++++----- libmultipath/configure.h | 2 +- multipathd/cli_handlers.c | 2 +- multipathd/main.c | 27 ++++++--------------------- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 1bb45a3..0f1fe43 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -765,14 +765,17 @@ out: return NULL; } -extern int reload_map(struct vectors *vecs, struct multipath *mpp) +extern int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh) { - char params[PARAMS_SIZE]; - int r; + char params[PARAMS_SIZE] = {0}; + struct path *pp; + int i, r; update_mpp_paths(mpp, vecs->pathvec); - - params[0] = '\0'; + if (refresh) { + vector_foreach_slot (mpp->paths, pp, i) + pathinfo(pp, conf->hwtable, DI_PRIO); + } if (setup_map(mpp, params, PARAMS_SIZE)) { condlog(0, "%s: failed to setup map", mpp->alias); return 1; diff --git a/libmultipath/configure.h b/libmultipath/configure.h index 6c1c493..d13c0ac 100644 --- a/libmultipath/configure.h +++ b/libmultipath/configure.h @@ -28,5 +28,5 @@ int domap (struct multipath * mpp, char * params); int reinstate_paths (struct multipath *mpp); int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid, int force_reload); char * get_refwwid (char * dev, enum devtypes dev_type, vector pathvec); -int reload_map(struct vectors *vecs, struct multipath *mpp); +int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh); diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 544cbfb..6053b5a 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -561,7 +561,7 @@ cli_reload(void *v, char **reply, int *len, void *data) return 1; } - return reload_map(vecs, mpp); + return reload_map(vecs, mpp, 0); } int resize_map(struct multipath *mpp, unsigned long long size, diff --git a/multipathd/main.c b/multipathd/main.c index 84574b2..7fe9c5b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -674,11 +674,12 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) uev->kernel); return 1; } - if (pp->mpp) - retval = reload_map(vecs, pp->mpp); + if (pp->mpp) { + retval = reload_map(vecs, pp->mpp, 0); - condlog(2, "%s: map %s reloaded (retval %d)", - uev->kernel, pp->mpp->alias, retval); + condlog(2, "%s: map %s reloaded (retval %d)", + uev->kernel, pp->mpp->alias, retval); + } } @@ -1086,25 +1087,9 @@ int update_prio(struct path *pp, int refresh_all) int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh) { - int i; - struct path * pp; - char params[PARAMS_SIZE]; - - update_mpp_paths(mpp, vecs->pathvec); - if (refresh) { - vector_foreach_slot (mpp->paths, pp, i) - pathinfo(pp, conf->hwtable, DI_PRIO); - } - params[0] = '\0'; - if (setup_map(mpp, params, PARAMS_SIZE)) + if (reload_map(vecs, mpp, refresh)) return 1; - mpp->action = ACT_RELOAD; - if (domap(mpp, params) <= 0) { - condlog(0, "%s: failed to update map : %s", mpp->alias, - strerror(errno)); - return 1; - } dm_lib_release(); if (setup_multipath(vecs, mpp) != 0) return 1;