From patchwork Fri Nov 20 16:34:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 7669601 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8231B9F731 for ; Fri, 20 Nov 2015 16:40:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A150420434 for ; Fri, 20 Nov 2015 16:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5A072043C for ; Fri, 20 Nov 2015 16:40:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760790AbbKTQkd (ORCPT ); Fri, 20 Nov 2015 11:40:33 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:50135 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760752AbbKTQk3 (ORCPT ); Fri, 20 Nov 2015 11:40:29 -0500 Received: from p3ee3e1bb.dip0.t-ipconnect.de ([62.227.225.187] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zzojb-00064e-60; Fri, 20 Nov 2015 16:40:27 +0000 From: Christoph Hellwig To: keith.busch@intel.com, axboe@fb.com Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 04/47] block: provide a new BLK_EH_QUIESCED timeout return value Date: Fri, 20 Nov 2015 17:34:59 +0100 Message-Id: <1448037342-18384-5-git-send-email-hch@lst.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448037342-18384-1-git-send-email-hch@lst.de> References: <1448037342-18384-1-git-send-email-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This marks the request as one that's not actually completed yet, but should be reaped next time blk_mq_complete_request comes in. This is useful it the abort handler kicked of a reset that will complete all pending requests. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 6 +++++- block/blk-softirq.c | 3 ++- block/blk-timeout.c | 3 +++ block/blk.h | 1 + include/linux/blkdev.h | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 8354601..76773dc 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -383,7 +383,8 @@ void blk_mq_complete_request(struct request *rq, int error) if (unlikely(blk_should_fake_timeout(q))) return; - if (!blk_mark_rq_complete(rq)) { + if (!blk_mark_rq_complete(rq) || + test_and_clear_bit(REQ_ATOM_QUIESCED, &rq->atomic_flags)) { rq->errors = error; __blk_mq_complete_request(rq); } @@ -586,6 +587,9 @@ void blk_mq_rq_timed_out(struct request *req, bool reserved) break; case BLK_EH_NOT_HANDLED: break; + case BLK_EH_QUIESCED: + set_bit(REQ_ATOM_QUIESCED, &req->atomic_flags); + break; default: printk(KERN_ERR "block: bad eh return: %d\n", ret); break; diff --git a/block/blk-softirq.c b/block/blk-softirq.c index 53b1737..9d47fbc 100644 --- a/block/blk-softirq.c +++ b/block/blk-softirq.c @@ -167,7 +167,8 @@ void blk_complete_request(struct request *req) { if (unlikely(blk_should_fake_timeout(req->q))) return; - if (!blk_mark_rq_complete(req)) + if (!blk_mark_rq_complete(req) || + test_and_clear_bit(REQ_ATOM_QUIESCED, &req->atomic_flags)) __blk_complete_request(req); } EXPORT_SYMBOL(blk_complete_request); diff --git a/block/blk-timeout.c b/block/blk-timeout.c index aedd128..b3a7f20 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -96,6 +96,9 @@ static void blk_rq_timed_out(struct request *req) blk_add_timer(req); blk_clear_rq_complete(req); break; + case BLK_EH_QUIESCED: + set_bit(REQ_ATOM_QUIESCED, &req->atomic_flags); + break; case BLK_EH_NOT_HANDLED: /* * LLD handles this for now but in the future diff --git a/block/blk.h b/block/blk.h index 37b9165..f4c98f8 100644 --- a/block/blk.h +++ b/block/blk.h @@ -120,6 +120,7 @@ void blk_account_io_done(struct request *req); enum rq_atomic_flags { REQ_ATOM_COMPLETE = 0, REQ_ATOM_STARTED, + REQ_ATOM_QUIESCED, }; /* diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9a8424a..5df5fb13 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -223,6 +223,7 @@ enum blk_eh_timer_return { BLK_EH_NOT_HANDLED, BLK_EH_HANDLED, BLK_EH_RESET_TIMER, + BLK_EH_QUIESCED, }; typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *);