From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@fb.com>
Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
Ming Lei <ming.lei@redhat.com>, Omar Sandoval <osandov@fb.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Christoph Hellwig <hch@lst.de>,
Don Brace <don.brace@microsemi.com>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Mike Snitzer <snitzer@redhat.com>, Hannes Reinecke <hare@suse.de>,
Laurence Oberman <loberman@redhat.com>
Subject: [PATCH 1/3] scsi: introduce scsi_host_busy()
Date: Fri, 20 Apr 2018 14:57:40 +0800 [thread overview]
Message-ID: <20180420065742.8043-2-ming.lei@redhat.com> (raw)
In-Reply-To: <20180420065742.8043-1-ming.lei@redhat.com>
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 <osandov@fb.com>,
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Cc: James Bottomley <james.bottomley@hansenpartnership.com>,
Cc: Christoph Hellwig <hch@lst.de>,
Cc: Don Brace <don.brace@microsemi.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
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);
--
2.9.5
next prev parent reply other threads:[~2018-04-20 6:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 6:57 [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path Ming Lei
2018-04-20 6:57 ` Ming Lei [this message]
2018-04-27 15:47 ` [PATCH 1/3] scsi: introduce scsi_host_busy() Bart Van Assche
2018-04-20 6:57 ` [PATCH 2/3] scsi: read host_busy via scsi_host_busy() Ming Lei
2018-04-27 15:51 ` Bart Van Assche
2018-04-28 8:17 ` Ming Lei
2018-04-20 6:57 ` [PATCH 3/3] scsi: avoid to hold host-wide counter of host_busy for scsi_mq Ming Lei
2018-04-27 16:16 ` Bart Van Assche
2018-04-28 8:26 ` Ming Lei
2018-04-27 15:31 ` [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path Bart Van Assche
2018-04-27 15:39 ` Jens Axboe
2018-04-27 15:48 ` Bart Van Assche
2018-04-27 15:55 ` Laurence Oberman
2018-04-27 16:19 ` Jens Axboe
2018-04-28 8:47 ` Ming Lei
2018-06-22 15:29 ` Bart Van Assche
2018-06-22 21:43 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180420065742.8043-2-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@fb.com \
--cc=don.brace@microsemi.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=martin.petersen@oracle.com \
--cc=osandov@fb.com \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox