From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org, Christoph Hellwig <hch@infradead.org>, Mike Snitzer <snitzer@redhat.com> Cc: dm-devel@redhat.com, Ming Lei <ming.lei@redhat.com>, Laurence Oberman <loberman@redhat.com>, Bart Van Assche <bart.vanassche@sandisk.com> Subject: [PATCH 2/5] dm-rq: handle dispatch exception in dm_dispatch_clone_request() Date: Mon, 22 Jan 2018 11:35:47 +0800 [thread overview] Message-ID: <20180122033550.27855-3-ming.lei@redhat.com> (raw) In-Reply-To: <20180122033550.27855-1-ming.lei@redhat.com> So we can clean up map_request() a bit, no functional change. Cc: Mike Snitzer <snitzer@redhat.com> Cc: Laurence Oberman <loberman@redhat.com> Cc: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/md/dm-rq.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index e0bb56723b9b..1408e6664c16 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -12,6 +12,9 @@ #define DM_MSG_PREFIX "core-rq" +#define dispatch_busy(r) \ + (((r) == BLK_STS_RESOURCE) || ((r) == BLK_STS_DEV_RESOURCE)) + #define DM_MQ_NR_HW_QUEUES 1 #define DM_MQ_QUEUE_DEPTH 2048 static unsigned dm_mq_nr_hw_queues = DM_MQ_NR_HW_QUEUES; @@ -399,7 +402,8 @@ static void end_clone_request(struct request *clone, blk_status_t error) dm_complete_request(tio->orig, error); } -static blk_status_t dm_dispatch_clone_request(struct request *clone, struct request *rq) +static blk_status_t dm_dispatch_clone_request(struct dm_rq_target_io *tio, + struct request *clone, struct request *rq) { blk_status_t r; @@ -408,9 +412,17 @@ static blk_status_t dm_dispatch_clone_request(struct request *clone, struct requ clone->start_time = jiffies; r = blk_insert_cloned_request(clone->q, clone); - if (r != BLK_STS_OK && r != BLK_STS_RESOURCE) + if (dispatch_busy(r)) { + blk_rq_unprep_clone(clone); + tio->ti->type->release_clone_rq(clone); + tio->clone = NULL; + } else if (r != BLK_STS_OK) { /* must complete clone in terms of original request */ dm_complete_request(rq, r); + + /* we handled the failure, so return OK */ + r = BLK_STS_OK; + } return r; } @@ -499,11 +511,8 @@ static int map_request(struct dm_rq_target_io *tio) /* The target has remapped the I/O so dispatch it */ trace_block_rq_remap(clone->q, clone, disk_devt(dm_disk(md)), blk_rq_pos(rq)); - ret = dm_dispatch_clone_request(clone, rq); - if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) { - blk_rq_unprep_clone(clone); - tio->ti->type->release_clone_rq(clone); - tio->clone = NULL; + ret = dm_dispatch_clone_request(tio, clone, rq); + if (dispatch_busy(ret)) { if (!rq->q->mq_ops) r = DM_MAPIO_DELAY_REQUEUE; else -- 2.9.5
WARNING: multiple messages have this Message-ID (diff)
From: Ming Lei <ming.lei@redhat.com> To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org, Christoph Hellwig <hch@infradead.org>, Mike Snitzer <snitzer@redhat.com> Cc: Bart Van Assche <bart.vanassche@sandisk.com>, dm-devel@redhat.com, Laurence Oberman <loberman@redhat.com>, Ming Lei <ming.lei@redhat.com> Subject: [PATCH 2/5] dm-rq: handle dispatch exception in dm_dispatch_clone_request() Date: Mon, 22 Jan 2018 11:35:47 +0800 [thread overview] Message-ID: <20180122033550.27855-3-ming.lei@redhat.com> (raw) In-Reply-To: <20180122033550.27855-1-ming.lei@redhat.com> So we can clean up map_request() a bit, no functional change. Cc: Mike Snitzer <snitzer@redhat.com> Cc: Laurence Oberman <loberman@redhat.com> Cc: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/md/dm-rq.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index e0bb56723b9b..1408e6664c16 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -12,6 +12,9 @@ #define DM_MSG_PREFIX "core-rq" +#define dispatch_busy(r) \ + (((r) == BLK_STS_RESOURCE) || ((r) == BLK_STS_DEV_RESOURCE)) + #define DM_MQ_NR_HW_QUEUES 1 #define DM_MQ_QUEUE_DEPTH 2048 static unsigned dm_mq_nr_hw_queues = DM_MQ_NR_HW_QUEUES; @@ -399,7 +402,8 @@ static void end_clone_request(struct request *clone, blk_status_t error) dm_complete_request(tio->orig, error); } -static blk_status_t dm_dispatch_clone_request(struct request *clone, struct request *rq) +static blk_status_t dm_dispatch_clone_request(struct dm_rq_target_io *tio, + struct request *clone, struct request *rq) { blk_status_t r; @@ -408,9 +412,17 @@ static blk_status_t dm_dispatch_clone_request(struct request *clone, struct requ clone->start_time = jiffies; r = blk_insert_cloned_request(clone->q, clone); - if (r != BLK_STS_OK && r != BLK_STS_RESOURCE) + if (dispatch_busy(r)) { + blk_rq_unprep_clone(clone); + tio->ti->type->release_clone_rq(clone); + tio->clone = NULL; + } else if (r != BLK_STS_OK) { /* must complete clone in terms of original request */ dm_complete_request(rq, r); + + /* we handled the failure, so return OK */ + r = BLK_STS_OK; + } return r; } @@ -499,11 +511,8 @@ static int map_request(struct dm_rq_target_io *tio) /* The target has remapped the I/O so dispatch it */ trace_block_rq_remap(clone->q, clone, disk_devt(dm_disk(md)), blk_rq_pos(rq)); - ret = dm_dispatch_clone_request(clone, rq); - if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) { - blk_rq_unprep_clone(clone); - tio->ti->type->release_clone_rq(clone); - tio->clone = NULL; + ret = dm_dispatch_clone_request(tio, clone, rq); + if (dispatch_busy(ret)) { if (!rq->q->mq_ops) r = DM_MAPIO_DELAY_REQUEUE; else -- 2.9.5
next prev parent reply other threads:[~2018-01-22 3:35 UTC|newest] Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-01-22 3:35 [PATCH 0/5] blk-mq & dm: fix IO hang and deal with one performance issue Ming Lei 2018-01-22 3:35 ` [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE Ming Lei 2018-01-22 16:32 ` Christoph Hellwig 2018-01-22 16:49 ` Bart Van Assche 2018-01-22 16:49 ` Bart Van Assche 2018-01-23 0:57 ` Ming Lei 2018-01-23 16:17 ` Bart Van Assche 2018-01-23 16:26 ` Ming Lei 2018-01-23 16:37 ` Bart Van Assche 2018-01-23 16:41 ` Ming Lei 2018-01-23 16:47 ` Bart Van Assche 2018-01-23 16:47 ` Bart Van Assche 2018-01-23 16:49 ` Ming Lei 2018-01-23 16:54 ` Bart Van Assche 2018-01-23 16:54 ` Bart Van Assche 2018-01-23 16:59 ` Ming Lei 2018-01-23 16:59 ` Ming Lei 2018-01-23 22:01 ` Bart Van Assche 2018-01-23 22:01 ` Bart Van Assche 2018-01-24 2:31 ` Ming Lei 2018-01-22 3:35 ` Ming Lei [this message] 2018-01-22 3:35 ` [PATCH 2/5] dm-rq: handle dispatch exception in dm_dispatch_clone_request() Ming Lei 2018-01-22 3:35 ` [PATCH 3/5] dm-rq: return BLK_STS_* from map_request() Ming Lei 2018-01-22 3:35 ` Ming Lei 2018-01-22 5:35 ` Ming Lei 2018-01-22 3:35 ` [PATCH 4/5] blk-mq: introduce blk_get_request_notify Ming Lei 2018-01-22 10:19 ` Ming Lei 2018-01-22 17:13 ` Bart Van Assche 2018-01-22 17:13 ` Bart Van Assche 2018-01-23 1:29 ` Ming Lei 2018-01-22 3:35 ` [PATCH 5/5] dm-mpath: use blk_mq_alloc_request_notify for allocating blk-mq req 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=20180122033550.27855-3-ming.lei@redhat.com \ --to=ming.lei@redhat.com \ --cc=axboe@kernel.dk \ --cc=bart.vanassche@sandisk.com \ --cc=dm-devel@redhat.com \ --cc=hch@infradead.org \ --cc=linux-block@vger.kernel.org \ --cc=loberman@redhat.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: 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.