From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756913AbdLPMHu (ORCPT ); Sat, 16 Dec 2017 07:07:50 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:43194 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756759AbdLPMHm (ORCPT ); Sat, 16 Dec 2017 07:07:42 -0500 X-Google-Smtp-Source: ACJfBot5aeWqIH2U6Ol85HCa/g2Px8WXt/g/q2R9HPfGTLGl4gNwbsdBMp3kMj6JqYWl0GrIHJudrw== From: Tejun Heo To: jack@suse.cz, axboe@kernel.dk, clm@fb.com, jbacik@fb.com Cc: kernel-team@fb.com, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, peterz@infradead.org, jianchao.w.wang@oracle.com, Bart.VanAssche@wdc.com, Tejun Heo , Asai Thambi SP , Stefan Haberland , Jan Hoeppner Subject: [PATCH 4/7] blk-mq: make blk_abort_request() trigger timeout path Date: Sat, 16 Dec 2017 04:07:23 -0800 Message-Id: <20171216120726.517153-5-tj@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171216120726.517153-1-tj@kernel.org> References: <20171216120726.517153-1-tj@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With issue/complete and timeout paths now using the generation number and state based synchronization, blk_abort_request() is the only one which depends on REQ_ATOM_COMPLETE for arbitrating completion. There's no reason for blk_abort_request() to be a completely separate path. This patch makes blk_abort_request() piggyback on the timeout path instead of trying to terminate the request directly. This removes the last dependency on REQ_ATOM_COMPLETE in blk-mq. Note that this makes blk_abort_request() asynchronous - it initiates abortion but the actual termination will happen after a short while, even when the caller owns the request. AFAICS, SCSI and ATA should be fine with that and I think mtip32xx and dasd should be safe but not completely sure. It'd be great if people who know the drivers take a look. Signed-off-by: Tejun Heo Cc: Asai Thambi SP Cc: Stefan Haberland Cc: Jan Hoeppner --- block/blk-mq.c | 2 +- block/blk-mq.h | 2 -- block/blk-timeout.c | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 643a38d..88baa82 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -800,7 +800,7 @@ struct blk_mq_timeout_data { unsigned int nr_expired; }; -void blk_mq_rq_timed_out(struct request *req, bool reserved) +static void blk_mq_rq_timed_out(struct request *req, bool reserved) { const struct blk_mq_ops *ops = req->q->mq_ops; enum blk_eh_timer_return ret = BLK_EH_RESET_TIMER; diff --git a/block/blk-mq.h b/block/blk-mq.h index cf01f6f..6b2d616 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -94,8 +94,6 @@ extern int blk_mq_sysfs_register(struct request_queue *q); extern void blk_mq_sysfs_unregister(struct request_queue *q); extern void blk_mq_hctx_kobj_init(struct blk_mq_hw_ctx *hctx); -extern void blk_mq_rq_timed_out(struct request *req, bool reserved); - void blk_mq_release(struct request_queue *q); /** diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 6427be7..d580af3 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -156,12 +156,12 @@ void blk_timeout_work(struct work_struct *work) */ void blk_abort_request(struct request *req) { - if (blk_mark_rq_complete(req)) - return; - if (req->q->mq_ops) { - blk_mq_rq_timed_out(req, false); + req->deadline = jiffies; + mod_timer(&req->q->timeout, 0); } else { + if (blk_mark_rq_complete(req)) + return; blk_delete_timer(req); blk_rq_timed_out(req); } -- 2.9.5