From patchwork Sat Feb 10 05:07:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 10210307 X-Patchwork-Delegate: snitzer@redhat.com 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 1D56F6032D for ; Sat, 10 Feb 2018 05:07:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 015E52895F for ; Sat, 10 Feb 2018 05:07:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5CB828B59; Sat, 10 Feb 2018 05:07:48 +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 595662895F for ; Sat, 10 Feb 2018 05:07:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FA1C4DD49; Sat, 10 Feb 2018 05:07:46 +0000 (UTC) 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 B33075C265; Sat, 10 Feb 2018 05:07:42 +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 091264A46D; Sat, 10 Feb 2018 05:07:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1A57aUx031546 for ; Sat, 10 Feb 2018 00:07:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F2862026E04; Sat, 10 Feb 2018 05:07:36 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with SMTP id 4F2342026DFD; Sat, 10 Feb 2018 05:07:35 +0000 (UTC) Received: by redhat.com (sSMTP sendmail emulation); Fri, 09 Feb 2018 23:07:35 -0600 From: "Benjamin Marzinski" To: device-mapper development Date: Fri, 9 Feb 2018 23:07:27 -0600 Message-Id: <1518239251-29392-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1518239251-29392-1-git-send-email-bmarzins@redhat.com> References: <1518239251-29392-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: dm-devel@redhat.com Cc: Martin Wilck Subject: [dm-devel] [RFC PATCH 1/5] libmultipath: move remove_map waiter code to multipathd 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 10 Feb 2018 05:07:47 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Only multipathd needs to worry about the multipath waiter code. There is no point in having remove_map_and_stop_waiter() or remove_maps_and_stop_waiters() in libmultipath, since they should never be use outside of multipathd. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c | 40 +++++----------------------------------- libmultipath/structs_vec.h | 2 -- multipathd/main.c | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 37 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 0de2221..abf5327 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -116,25 +116,16 @@ set_multipath_wwid (struct multipath * mpp) dm_get_uuid(mpp->alias, mpp->wwid); } -#define KEEP_WAITER 0 -#define STOP_WAITER 1 #define PURGE_VEC 1 -static void -_remove_map (struct multipath * mpp, struct vectors * vecs, - int stop_waiter, int purge_vec) +void +remove_map(struct multipath * mpp, struct vectors * vecs, int purge_vec) { int i; condlog(4, "%s: remove multipath map", mpp->alias); /* - * stop the DM event waiter thread - */ - if (stop_waiter) - stop_waiter_thread(mpp, vecs); - - /* * clear references to this map */ orphan_paths(vecs->pathvec, mpp); @@ -149,19 +140,8 @@ _remove_map (struct multipath * mpp, struct vectors * vecs, free_multipath(mpp, KEEP_PATHS); } -void remove_map(struct multipath *mpp, struct vectors *vecs, int purge_vec) -{ - _remove_map(mpp, vecs, KEEP_WAITER, purge_vec); -} - -void remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs, - int purge_vec) -{ - _remove_map(mpp, vecs, STOP_WAITER, purge_vec); -} - -static void -_remove_maps (struct vectors * vecs, int stop_waiter) +void +remove_maps(struct vectors * vecs) { int i; struct multipath * mpp; @@ -170,7 +150,7 @@ _remove_maps (struct vectors * vecs, int stop_waiter) return; vector_foreach_slot (vecs->mpvec, mpp, i) { - _remove_map(mpp, vecs, stop_waiter, 1); + remove_map(mpp, vecs, 1); i--; } @@ -178,16 +158,6 @@ _remove_maps (struct vectors * vecs, int stop_waiter) vecs->mpvec = NULL; } -void remove_maps(struct vectors *vecs) -{ - _remove_maps(vecs, KEEP_WAITER); -} - -void remove_maps_and_stop_waiters(struct vectors *vecs) -{ - _remove_maps(vecs, STOP_WAITER); -} - void extract_hwe_from_path(struct multipath * mpp) { diff --git a/libmultipath/structs_vec.h b/libmultipath/structs_vec.h index b81413b..d6e17bb 100644 --- a/libmultipath/structs_vec.h +++ b/libmultipath/structs_vec.h @@ -27,9 +27,7 @@ int update_multipath_strings (struct multipath *mpp, vector pathvec, void extract_hwe_from_path(struct multipath * mpp); void remove_map (struct multipath * mpp, struct vectors * vecs, int purge_vec); -void remove_map_and_stop_waiter (struct multipath * mpp, struct vectors * vecs, int purge_vec); void remove_maps (struct vectors * vecs); -void remove_maps_and_stop_waiters (struct vectors * vecs); void sync_map_state (struct multipath *); int update_map (struct multipath *mpp, struct vectors *vecs); diff --git a/multipathd/main.c b/multipathd/main.c index 7ac59d9..72c3c2f 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -288,6 +288,29 @@ switch_pathgroup (struct multipath * mpp) mpp->alias, mpp->bestpg); } +static void +remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs, + int purge_vec) +{ + stop_waiter_thread(mpp, vecs); + remove_map(mpp, vecs, purge_vec); +} + +static void +remove_maps_and_stop_waiters(struct vectors *vecs) +{ + int i; + struct multipath * mpp; + + if (!vecs) + return; + + vector_foreach_slot(vecs->mpvec, mpp, i) + stop_waiter_thread(mpp, vecs); + + remove_maps(vecs); +} + static int coalesce_maps(struct vectors *vecs, vector nmpv) {