From patchwork Fri Apr 20 06:57:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10351885 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 45775602B7 for ; Fri, 20 Apr 2018 06:59:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37C3E28668 for ; Fri, 20 Apr 2018 06:59:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C5222866C; Fri, 20 Apr 2018 06:59:26 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1AB528668 for ; Fri, 20 Apr 2018 06:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753810AbeDTG7Y (ORCPT ); Fri, 20 Apr 2018 02:59:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51926 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753904AbeDTG7X (ORCPT ); Fri, 20 Apr 2018 02:59:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2259C8DC4C; Fri, 20 Apr 2018 06:59:23 +0000 (UTC) Received: from localhost (ovpn-12-22.pek2.redhat.com [10.72.12.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id B45432023238; Fri, 20 Apr 2018 06:59:15 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Ming Lei , Omar Sandoval , "Martin K. Petersen" , James Bottomley , Christoph Hellwig , Don Brace , Kashyap Desai , Mike Snitzer , Hannes Reinecke , Laurence Oberman Subject: [PATCH 1/3] scsi: introduce scsi_host_busy() Date: Fri, 20 Apr 2018 14:57:40 +0800 Message-Id: <20180420065742.8043-2-ming.lei@redhat.com> In-Reply-To: <20180420065742.8043-1-ming.lei@redhat.com> References: <20180420065742.8043-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 20 Apr 2018 06:59:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 20 Apr 2018 06:59:23 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces SCSI middle layer API of scsi_host_busy() for drivers to read the host-wide counter of scsi_host->host_busy. Cc: Omar Sandoval , Cc: "Martin K. Petersen" , Cc: James Bottomley , Cc: Christoph Hellwig , Cc: Don Brace Cc: Kashyap Desai Cc: Mike Snitzer Cc: Hannes Reinecke Cc: Laurence Oberman Signed-off-by: Ming Lei --- drivers/scsi/hosts.c | 10 ++++++++++ include/scsi/scsi_host.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 7649d63a1b8d..69beb30205f1 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -565,6 +565,16 @@ struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost) EXPORT_SYMBOL(scsi_host_get); /** + * scsi_host_busy - Return the host busy counter + * @shost: Pointer to Scsi_Host to inc. + **/ +int scsi_host_busy(struct Scsi_Host *shost) +{ + return atomic_read(&shost->host_busy); +} +EXPORT_SYMBOL(scsi_host_busy); + +/** * scsi_host_put - dec a Scsi_Host ref count * @shost: Pointer to Scsi_Host to dec. **/ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 12f454cb6f61..44ab89268f30 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -758,6 +758,7 @@ extern void scsi_scan_host(struct Scsi_Host *); extern void scsi_rescan_device(struct device *); extern void scsi_remove_host(struct Scsi_Host *); extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); +extern int scsi_host_busy(struct Scsi_Host *shost); extern void scsi_host_put(struct Scsi_Host *t); extern struct Scsi_Host *scsi_host_lookup(unsigned short); extern const char *scsi_host_state_name(enum scsi_host_state);