From: Jens Axboe <axboe@fb.com>
To: <linux-block@vger.kernel.org>
Cc: <ming.lei@redhat.com>, <hch@lst.de>, Jens Axboe <axboe@fb.com>
Subject: [PATCH 3/7] mtip32xx: abstract out "are any commands active" helper
Date: Fri, 28 Apr 2017 08:55:36 -0600 [thread overview]
Message-ID: <1493391340-24629-4-git-send-email-axboe@fb.com> (raw)
In-Reply-To: <1493391340-24629-1-git-send-email-axboe@fb.com>
This is a prep patch for backoff in ->queue_rq() for non-ncq commands.
Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
---
drivers/block/mtip32xx/mtip32xx.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 36f3d34f2156..aee94f260725 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -1030,6 +1030,22 @@ static bool mtip_pause_ncq(struct mtip_port *port,
return false;
}
+static bool mtip_commands_active(struct mtip_port *port)
+{
+ unsigned int active;
+ unsigned int n;
+
+ /*
+ * Ignore s_active bit 0 of array element 0.
+ * This bit will always be set
+ */
+ active = readl(port->s_active[0]) & 0xFFFFFFFE;
+ for (n = 1; n < port->dd->slot_groups; n++)
+ active |= readl(port->s_active[n]);
+
+ return active != 0;
+}
+
/*
* Wait for port to quiesce
*
@@ -1043,8 +1059,7 @@ static bool mtip_pause_ncq(struct mtip_port *port,
static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout)
{
unsigned long to;
- unsigned int n;
- unsigned int active = 1;
+ bool active = true;
blk_mq_stop_hw_queues(port->dd->queue);
@@ -1061,14 +1076,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout)
if (mtip_check_surprise_removal(port->dd->pdev))
goto err_fault;
- /*
- * Ignore s_active bit 0 of array element 0.
- * This bit will always be set
- */
- active = readl(port->s_active[0]) & 0xFFFFFFFE;
- for (n = 1; n < port->dd->slot_groups; n++)
- active |= readl(port->s_active[n]);
-
+ active = mtip_commands_active(port);
if (!active)
break;
} while (time_before(jiffies, to));
--
2.7.4
next prev parent reply other threads:[~2017-04-28 14:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 14:55 [PATCH v3 0/7] Fixup mtip32xx for scheduling Jens Axboe
2017-04-28 14:55 ` [PATCH 1/7] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() Jens Axboe
2017-04-28 14:55 ` [PATCH 2/7] mtip32xx: kill atomic argument to mtip_quiesce_io() Jens Axboe
2017-04-28 14:55 ` Jens Axboe [this message]
2017-04-28 14:55 ` [PATCH 4/7] blk-mq: add and export helper to tell if a request is reserved Jens Axboe
2017-04-28 15:04 ` Bart Van Assche
2017-04-28 15:22 ` Ming Lei
2017-05-02 6:12 ` Hannes Reinecke
2017-04-28 14:55 ` [PATCH 5/7] mtip32xx: convert internal command issue to block IO path Jens Axboe
2017-05-02 6:14 ` Hannes Reinecke
2017-04-28 14:55 ` [PATCH 6/7] blk-mq-sched: remove hack that bypasses scheduler for reserved requests Jens Axboe
2017-04-28 15:22 ` Ming Lei
2017-05-02 6:15 ` Hannes Reinecke
2017-04-28 14:55 ` [PATCH 7/7] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe
2017-05-02 6:15 ` Hannes Reinecke
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=1493391340-24629-4-git-send-email-axboe@fb.com \
--to=axboe@fb.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@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