From: Bart Van Assche <bart.vanassche@sandisk.com> To: Jens Axboe <axboe@fb.com> Cc: "Christoph Hellwig" <hch@lst.de>, "James Bottomley" <jejb@linux.vnet.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, "Mike Snitzer" <snitzer@redhat.com>, "Doug Ledford" <dledford@redhat.com>, "Keith Busch" <keith.busch@intel.com>, "Ming Lei" <tom.leiming@gmail.com>, "Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>, "Roger Pau Monné" <roger.pau@citrix.com>, "Laurence Oberman" <loberman@redhat.com>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>, "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org> Subject: [PATCH v5 02/14] blk-mq: Introduce blk_mq_hctx_stopped() Date: Fri, 28 Oct 2016 17:19:15 -0700 [thread overview] Message-ID: <075bab96-4f5f-d68c-843b-f2358319a0a6@sandisk.com> (raw) In-Reply-To: <7460e8b2-2cfd-c0d5-7ae7-7f662d89dad3@sandisk.com> Multiple functions test the BLK_MQ_S_STOPPED bit so introduce a helper function that performs this test. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Ming Lei <tom.leiming@gmail.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> --- block/blk-mq.c | 12 ++++++------ block/blk-mq.h | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index ad459e4..bc1f462 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -787,7 +787,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) struct list_head *dptr; int queued; - if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) + if (unlikely(blk_mq_hctx_stopped(hctx))) return; WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) && @@ -912,8 +912,8 @@ static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx) void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async) { - if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state) || - !blk_mq_hw_queue_mapped(hctx))) + if (unlikely(blk_mq_hctx_stopped(hctx) || + !blk_mq_hw_queue_mapped(hctx))) return; if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) { @@ -938,7 +938,7 @@ void blk_mq_run_hw_queues(struct request_queue *q, bool async) queue_for_each_hw_ctx(q, hctx, i) { if ((!blk_mq_hctx_has_pending(hctx) && list_empty_careful(&hctx->dispatch)) || - test_bit(BLK_MQ_S_STOPPED, &hctx->state)) + blk_mq_hctx_stopped(hctx)) continue; blk_mq_run_hw_queue(hctx, async); @@ -988,7 +988,7 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async) int i; queue_for_each_hw_ctx(q, hctx, i) { - if (!test_bit(BLK_MQ_S_STOPPED, &hctx->state)) + if (!blk_mq_hctx_stopped(hctx)) continue; clear_bit(BLK_MQ_S_STOPPED, &hctx->state); @@ -1332,7 +1332,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) blk_mq_put_ctx(data.ctx); if (!old_rq) goto done; - if (test_bit(BLK_MQ_S_STOPPED, &data.hctx->state) || + if (blk_mq_hctx_stopped(data.hctx) || blk_mq_direct_issue_request(old_rq, &cookie) != 0) blk_mq_insert_request(old_rq, false, true, true); goto done; diff --git a/block/blk-mq.h b/block/blk-mq.h index e5d2524..ac772da 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -100,6 +100,11 @@ static inline void blk_mq_set_alloc_data(struct blk_mq_alloc_data *data, data->hctx = hctx; } +static inline bool blk_mq_hctx_stopped(struct blk_mq_hw_ctx *hctx) +{ + return test_bit(BLK_MQ_S_STOPPED, &hctx->state); +} + static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx) { return hctx->nr_ctx && hctx->tags; -- 2.10.1
WARNING: multiple messages have this Message-ID (diff)
From: bart.vanassche@sandisk.com (Bart Van Assche) Subject: [PATCH v5 02/14] blk-mq: Introduce blk_mq_hctx_stopped() Date: Fri, 28 Oct 2016 17:19:15 -0700 [thread overview] Message-ID: <075bab96-4f5f-d68c-843b-f2358319a0a6@sandisk.com> (raw) In-Reply-To: <7460e8b2-2cfd-c0d5-7ae7-7f662d89dad3@sandisk.com> Multiple functions test the BLK_MQ_S_STOPPED bit so introduce a helper function that performs this test. Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com> Reviewed-by: Ming Lei <tom.leiming at gmail.com> Reviewed-by: Hannes Reinecke <hare at suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de> Reviewed-by: Sagi Grimberg <sagi at grimberg.me> Reviewed-by: Christoph Hellwig <hch at lst.de> --- block/blk-mq.c | 12 ++++++------ block/blk-mq.h | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index ad459e4..bc1f462 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -787,7 +787,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) struct list_head *dptr; int queued; - if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) + if (unlikely(blk_mq_hctx_stopped(hctx))) return; WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) && @@ -912,8 +912,8 @@ static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx) void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async) { - if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state) || - !blk_mq_hw_queue_mapped(hctx))) + if (unlikely(blk_mq_hctx_stopped(hctx) || + !blk_mq_hw_queue_mapped(hctx))) return; if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) { @@ -938,7 +938,7 @@ void blk_mq_run_hw_queues(struct request_queue *q, bool async) queue_for_each_hw_ctx(q, hctx, i) { if ((!blk_mq_hctx_has_pending(hctx) && list_empty_careful(&hctx->dispatch)) || - test_bit(BLK_MQ_S_STOPPED, &hctx->state)) + blk_mq_hctx_stopped(hctx)) continue; blk_mq_run_hw_queue(hctx, async); @@ -988,7 +988,7 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async) int i; queue_for_each_hw_ctx(q, hctx, i) { - if (!test_bit(BLK_MQ_S_STOPPED, &hctx->state)) + if (!blk_mq_hctx_stopped(hctx)) continue; clear_bit(BLK_MQ_S_STOPPED, &hctx->state); @@ -1332,7 +1332,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) blk_mq_put_ctx(data.ctx); if (!old_rq) goto done; - if (test_bit(BLK_MQ_S_STOPPED, &data.hctx->state) || + if (blk_mq_hctx_stopped(data.hctx) || blk_mq_direct_issue_request(old_rq, &cookie) != 0) blk_mq_insert_request(old_rq, false, true, true); goto done; diff --git a/block/blk-mq.h b/block/blk-mq.h index e5d2524..ac772da 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -100,6 +100,11 @@ static inline void blk_mq_set_alloc_data(struct blk_mq_alloc_data *data, data->hctx = hctx; } +static inline bool blk_mq_hctx_stopped(struct blk_mq_hw_ctx *hctx) +{ + return test_bit(BLK_MQ_S_STOPPED, &hctx->state); +} + static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx) { return hctx->nr_ctx && hctx->tags; -- 2.10.1
next prev parent reply other threads:[~2016-10-29 0:19 UTC|newest] Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-10-29 0:18 [PATCH v5 0/14] Fix race conditions related to stopping block layer queues Bart Van Assche 2016-10-29 0:18 ` Bart Van Assche 2016-10-29 0:18 ` [PATCH v5 01/14] blk-mq: Do not invoke .queue_rq() for a stopped queue Bart Van Assche 2016-10-29 0:18 ` Bart Van Assche 2016-10-29 0:19 ` Bart Van Assche [this message] 2016-10-29 0:19 ` [PATCH v5 02/14] blk-mq: Introduce blk_mq_hctx_stopped() Bart Van Assche 2016-10-29 0:19 ` [PATCH v5 03/14] blk-mq: Introduce blk_mq_queue_stopped() Bart Van Assche 2016-10-29 0:19 ` Bart Van Assche 2016-10-29 0:20 ` [PATCH v5 04/14] blk-mq: Move more code into blk_mq_direct_issue_request() Bart Van Assche 2016-10-29 0:20 ` Bart Van Assche 2016-10-29 0:20 ` [PATCH v5 05/14] blk-mq: Avoid that requeueing starts stopped queues Bart Van Assche 2016-10-29 0:20 ` Bart Van Assche 2016-10-29 0:20 ` Bart Van Assche 2016-11-01 16:01 ` Sagi Grimberg 2016-11-01 16:01 ` Sagi Grimberg 2016-11-01 16:01 ` Sagi Grimberg 2016-10-29 0:20 ` [PATCH v5 06/14] blk-mq: Remove blk_mq_cancel_requeue_work() Bart Van Assche 2016-10-29 0:20 ` Bart Van Assche 2016-10-29 0:20 ` Bart Van Assche 2016-11-01 16:01 ` Sagi Grimberg 2016-11-01 16:01 ` Sagi Grimberg 2016-10-29 0:21 ` [PATCH v5 07/14] blk-mq: Introduce blk_mq_quiesce_queue() Bart Van Assche 2016-10-29 0:21 ` Bart Van Assche 2016-10-29 0:21 ` Bart Van Assche 2016-11-01 16:02 ` Sagi Grimberg 2016-11-01 16:02 ` Sagi Grimberg 2016-11-02 2:08 ` Ming Lei 2016-11-02 2:08 ` Ming Lei 2016-11-02 2:08 ` Ming Lei 2016-10-29 0:21 ` [PATCH v5 08/14] blk-mq: Add a kick_requeue_list argument to blk_mq_requeue_request() Bart Van Assche 2016-10-29 0:21 ` Bart Van Assche 2016-10-29 0:21 ` Bart Van Assche 2016-11-01 16:02 ` Sagi Grimberg 2016-11-01 16:02 ` Sagi Grimberg 2016-10-29 0:22 ` [PATCH v5 09/14] dm: Use BLK_MQ_S_STOPPED instead of QUEUE_FLAG_STOPPED in blk-mq code Bart Van Assche 2016-10-29 0:22 ` Bart Van Assche 2016-10-29 0:22 ` [PATCH v5 10/14] dm: Fix a race condition related to stopping and starting queues Bart Van Assche 2016-10-29 0:22 ` Bart Van Assche 2016-10-29 0:22 ` [PATCH v5 11/14] SRP transport: Move queuecommand() wait code to SCSI core Bart Van Assche 2016-10-29 0:22 ` Bart Van Assche 2016-11-01 16:03 ` Sagi Grimberg 2016-11-01 16:03 ` Sagi Grimberg 2016-11-01 16:11 ` Martin K. Petersen 2016-11-01 16:11 ` Martin K. Petersen 2016-11-01 16:11 ` Martin K. Petersen 2016-10-29 0:23 ` [PATCH v5 12/14] SRP transport, scsi-mq: Wait for .queue_rq() if necessary Bart Van Assche 2016-10-29 0:23 ` Bart Van Assche 2016-11-01 16:03 ` Sagi Grimberg 2016-11-01 16:03 ` Sagi Grimberg 2016-11-01 16:03 ` Sagi Grimberg 2016-11-01 16:12 ` Martin K. Petersen 2016-11-01 16:12 ` Martin K. Petersen 2016-10-29 0:23 ` [PATCH v5 13/14] nvme: Fix a race condition related to stopping queues Bart Van Assche 2016-10-29 0:23 ` Bart Van Assche 2016-10-29 0:23 ` Bart Van Assche 2016-11-01 16:03 ` Sagi Grimberg 2016-11-01 16:03 ` Sagi Grimberg 2016-10-29 0:23 ` [PATCH v5 14/14] nvme: Use BLK_MQ_S_STOPPED instead of QUEUE_FLAG_STOPPED in blk-mq code Bart Van Assche 2016-10-29 0:23 ` Bart Van Assche 2016-10-31 13:53 ` Laurence Oberman 2016-10-31 13:53 ` Laurence Oberman 2016-10-31 13:59 ` Bart Van Assche 2016-10-31 13:59 ` Bart Van Assche 2016-10-31 13:59 ` Bart Van Assche 2016-10-31 15:10 ` Bart Van Assche 2016-10-31 15:10 ` Bart Van Assche 2016-10-31 15:10 ` Bart Van Assche 2016-11-02 15:17 ` [PATCH v5 0/14] Fix race conditions related to stopping block layer queues Christoph Hellwig 2016-11-02 15:17 ` Christoph Hellwig 2016-11-02 18:52 ` Jens Axboe 2016-11-02 18:52 ` Jens Axboe 2016-11-02 18:52 ` Jens Axboe 2016-11-02 19:35 ` Bart Van Assche 2016-11-02 19:35 ` Bart Van Assche
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=075bab96-4f5f-d68c-843b-f2358319a0a6@sandisk.com \ --to=bart.vanassche@sandisk.com \ --cc=axboe@fb.com \ --cc=dledford@redhat.com \ --cc=hch@lst.de \ --cc=jejb@linux.vnet.ibm.com \ --cc=keith.busch@intel.com \ --cc=konrad.wilk@oracle.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=linux-rdma@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=loberman@redhat.com \ --cc=martin.petersen@oracle.com \ --cc=roger.pau@citrix.com \ --cc=snitzer@redhat.com \ --cc=tom.leiming@gmail.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.