From patchwork Mon Jun 20 08:09:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 9186835 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 26BF160756 for ; Mon, 20 Jun 2016 08:13:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F48324B5B for ; Mon, 20 Jun 2016 08:13:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00D4A25221; Mon, 20 Jun 2016 08:13:32 +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 mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6495B24B5B for ; Mon, 20 Jun 2016 08:13:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u5K89swT001089; Mon, 20 Jun 2016 04:09:54 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u5K89Zdh031198 for ; Mon, 20 Jun 2016 04:09:35 -0400 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5K89YLw015303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jun 2016 04:09:34 -0400 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9DB896F8; Mon, 20 Jun 2016 08:09:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AE9C1AC5B; Mon, 20 Jun 2016 08:09:31 +0000 (UTC) From: Hannes Reinecke To: Christophe Varoqui Date: Mon, 20 Jun 2016 10:09:03 +0200 Message-Id: <1466410153-23896-17-git-send-email-hare@suse.de> In-Reply-To: <1466410153-23896-1-git-send-email-hare@suse.de> References: <1466410153-23896-1-git-send-email-hare@suse.de> X-Greylist: Sender IP whitelisted by DNSRBL, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 20 Jun 2016 08:09:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 20 Jun 2016 08:09:34 +0000 (UTC) for IP:'195.135.220.15' DOMAIN:'mx2.suse.de' HELO:'mx2.suse.de' FROM:'hare@suse.de' RCPT:'' X-RedHat-Spam-Score: -3.327 (BAYES_50, DCC_REPUT_00_12, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SPF_PASS) 195.135.220.15 mx2.suse.de 195.135.220.15 mx2.suse.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.76 on 10.5.110.27 X-loop: dm-devel@redhat.com Cc: Hannes Reinecke , dm-devel@redhat.com Subject: [dm-devel] [PATCH 16/26] discovery: Pass in 'hwtable' for get_state() and scsi_sysfs_discovery() 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-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Hannes Reinecke --- libmultipath/discovery.c | 28 ++++++++++++++-------------- libmultipath/discovery.h | 2 +- multipathd/main.c | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 0bf1bc2..e598337 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1067,7 +1067,7 @@ get_vpd_sgio (int fd, int pg, char * str, int maxlen) } static int -scsi_sysfs_pathinfo (struct path * pp) +scsi_sysfs_pathinfo (struct path * pp, vector hwtable) { struct udev_device *parent; const char *attr_path = NULL; @@ -1109,7 +1109,7 @@ scsi_sysfs_pathinfo (struct path * pp) /* * set the hwe configlet pointer */ - pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id, pp->rev); + pp->hwe = find_hwe(hwtable, pp->vendor_id, pp->product_id, pp->rev); /* * host / bus / target / lun @@ -1134,7 +1134,7 @@ scsi_sysfs_pathinfo (struct path * pp) } static int -ccw_sysfs_pathinfo (struct path * pp) +ccw_sysfs_pathinfo (struct path * pp, vector hwtable) { struct udev_device *parent; char attr_buff[NAME_SIZE]; @@ -1170,7 +1170,7 @@ ccw_sysfs_pathinfo (struct path * pp) /* * set the hwe configlet pointer */ - pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id, NULL); + pp->hwe = find_hwe(hwtable, pp->vendor_id, pp->product_id, NULL); /* * host / bus / target / lun @@ -1193,7 +1193,7 @@ ccw_sysfs_pathinfo (struct path * pp) } static int -cciss_sysfs_pathinfo (struct path * pp) +cciss_sysfs_pathinfo (struct path * pp, vector hwtable) { const char * attr_path = NULL; struct udev_device *parent; @@ -1233,7 +1233,7 @@ cciss_sysfs_pathinfo (struct path * pp) /* * set the hwe configlet pointer */ - pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id, pp->rev); + pp->hwe = find_hwe(hwtable, pp->vendor_id, pp->product_id, pp->rev); /* * host / bus / target / lun @@ -1323,7 +1323,7 @@ path_offline (struct path * pp) } int -sysfs_pathinfo(struct path * pp) +sysfs_pathinfo(struct path * pp, vector hwtable) { if (common_sysfs_pathinfo(pp)) return 1; @@ -1339,13 +1339,13 @@ sysfs_pathinfo(struct path * pp) if (pp->bus == SYSFS_BUS_UNDEF) return 0; else if (pp->bus == SYSFS_BUS_SCSI) { - if (scsi_sysfs_pathinfo(pp)) + if (scsi_sysfs_pathinfo(pp, hwtable)) return 1; } else if (pp->bus == SYSFS_BUS_CCW) { - if (ccw_sysfs_pathinfo(pp)) + if (ccw_sysfs_pathinfo(pp, hwtable)) return 1; } else if (pp->bus == SYSFS_BUS_CCISS) { - if (cciss_sysfs_pathinfo(pp)) + if (cciss_sysfs_pathinfo(pp, hwtable)) return 1; } return 0; @@ -1397,7 +1397,7 @@ cciss_ioctl_pathinfo (struct path * pp, int mask) } int -get_state (struct path * pp, int daemon) +get_state (struct path * pp, vector hwtable, int daemon) { struct checker * c = &pp->checker; int state; @@ -1406,7 +1406,7 @@ get_state (struct path * pp, int daemon) if (!checker_selected(c)) { if (daemon) { - if (pathinfo(pp, conf->hwtable, DI_SYSFS) != PATHINFO_OK) { + if (pathinfo(pp, hwtable, DI_SYSFS) != PATHINFO_OK) { condlog(3, "%s: couldn't get sysfs pathinfo", pp->dev); return PATH_UNCHECKED; @@ -1610,7 +1610,7 @@ pathinfo (struct path *pp, vector hwtable, int mask) /* * fetch info available in sysfs */ - if (mask & DI_SYSFS && sysfs_pathinfo(pp)) + if (mask & DI_SYSFS && sysfs_pathinfo(pp, hwtable)) return PATHINFO_FAILED; if (mask & DI_BLACKLIST && mask & DI_SYSFS) { @@ -1649,7 +1649,7 @@ pathinfo (struct path *pp, vector hwtable, int mask) if (mask & DI_CHECKER) { if (path_state == PATH_UP) { - pp->chkrstate = pp->state = get_state(pp, 0); + pp->chkrstate = pp->state = get_state(pp, hwtable, 0); if (pp->state == PATH_UNCHECKED || pp->state == PATH_WILD) goto blank; diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h index 45c8a4a..2619015 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -34,7 +34,7 @@ int path_discovery (vector pathvec, struct config * conf, int flag); int do_tur (char *); int path_offline (struct path *); -int get_state (struct path * pp, int daemon); +int get_state (struct path * pp, vector hwtable, int daemon); int pathinfo (struct path *, vector hwtable, int mask); int alloc_path_with_pathinfo (vector hwtable, struct udev_device *udevice, int flag, struct path **pp_ptr); diff --git a/multipathd/main.c b/multipathd/main.c index 9a44390..fe80d1a 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1421,7 +1421,7 @@ check_path (struct vectors * vecs, struct path * pp, int ticks) newstate = PATH_DOWN; if (newstate == PATH_UP) - newstate = get_state(pp, 1); + newstate = get_state(pp, conf->hwtable, 1); else checker_clear_message(&pp->checker);