From patchwork Wed Sep 28 23:59:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9355387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E3F806077A for ; Thu, 29 Sep 2016 00:00:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4D652969B for ; Thu, 29 Sep 2016 00:00:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7B98296AD; Thu, 29 Sep 2016 00:00:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B933F2969B for ; Thu, 29 Sep 2016 00:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196AbcI2AAA (ORCPT ); Wed, 28 Sep 2016 20:00:00 -0400 Received: from mail-cys01nam02on0052.outbound.protection.outlook.com ([104.47.37.52]:57156 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753068AbcI1X76 (ORCPT ); Wed, 28 Sep 2016 19:59:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XITc/ZUQRB++iy1+pEeFLs+LuT86H2i6K1ERXCpAi4k=; b=Xga6uelcsaGCAtAwPkOW7M+ujIpkF+H3BFjznQpMrOyILXUOQeeZwKgMGyQPlOqrYE2OB7WbQKW7VO6AOhZ80QDNSsM2vhHKoWC182DNVYSYBe7iIf8MrArr+XJaCarTwI45SfgiqYUnuasASgMkCQOJlsS5MTNk4NdaA97O8K0= Received: from BY2PR02CA0070.namprd02.prod.outlook.com (10.242.32.28) by CY4PR02MB2741.namprd02.prod.outlook.com (10.175.59.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Wed, 28 Sep 2016 23:59:56 +0000 Received: from BL2FFO11FD056.protection.gbl (2a01:111:f400:7c09::104) by BY2PR02CA0070.outlook.office365.com (2a01:111:e400:2c2a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5 via Frontend Transport; Wed, 28 Sep 2016 23:59:56 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BL2FFO11FD056.mail.protection.outlook.com (10.173.161.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.5 via Frontend Transport; Wed, 28 Sep 2016 23:59:50 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 4B.97.26959.F175CE75; Wed, 28 Sep 2016 16:49:52 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.301.0; Wed, 28 Sep 2016 16:59:47 -0700 X-AuditID: 0ac94369-b97ff7000001694f-77-57ec571fe372 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 48.84.02783.2795CE75; Wed, 28 Sep 2016 16:59:47 -0700 (PDT) Subject: [PATCH v2 4/7] blk-mq: Introduce blk_quiesce_queue() and blk_resume_queue() To: Jens Axboe References: CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-nvme@lists.infradead.org" From: Bart Van Assche Message-ID: Date: Wed, 28 Sep 2016 16:59:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIIsWRmVeSWpSXmKPExsXCddJ5ka5C+Jtwg3cHrSz+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwWy4//Y7Jo2/iV0YHbY2LzO3aP xXteMnk8OLSZxWPzknqP3Tcb2Dw+Pr3F4vF+31U2j8+b5AI4orhsUlJzMstSi/TtErgyVt6e ylzw0bPizO4HrA2M8227GDk5JARMJLovT2XvYuTiEBJYyiTx+OcOFghnB6PE1RWL2GCq3jxc D5VYyihx8Mt+dpCEsECYxKOPV8BsEQFZie+7X4M1CAnYSUyb38wI0sAs8IFZ4m3vUbAEm4CR xLf3M1lAbF6goubzzxhBbBYBVYn+xllgtqhAhMSthx1QNYISJ2c+AbI5ODgF7CWuP9UAMZkF NCXW79IHqWAWkJfY/nYOM8gqCYGfrBKnZp9nhLhBXeLkkvlMExiFZyGZNAuhfRaS9gWMz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== X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(3190300001)(189002)(199003)(50466002)(2270400002)(81166006)(81156014)(77096005)(305945005)(69596002)(106466001)(5660300001)(230700001)(19580395003)(83506001)(11100500001)(87936001)(64126003)(586003)(2906002)(36756003)(33646002)(4326007)(68736007)(23676002)(97736004)(86362001)(189998001)(92566002)(4001350100001)(8936002)(31696002)(65806001)(65956001)(47776003)(19580405001)(53416004)(6916009)(8676002)(7416002)(65826007)(2950100002)(31686004)(7846002)(76176999)(229853001)(110136003)(50986999)(356003)(54356999)(626004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR02MB2741; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD056; 1:/PC+nk+MoMZ/AXnjtW60mBcac9EPjN5H+cTY/7tkNtjVZZIuTd7RUTTMUN7jyJXY82kppBmxu1UzF1O4s/vzPR5l5rFpFvJVr8NkV7jo7YI9yXX1zpyKg3q1KRqJYePQxrjF5ceV8S7SAHet+DPus0FAy8kRXK20UM/y72B0eguLFiMnvB9Lhl5ArDT//6iJveEYwrdN2HSss/+8WoGzw+eAeJ+aU554Aepnisf1CdqWt6LtnAsubFtYPP1UGYu0Vtx8EhuRbmSCYok07MMpopUU4NAKo3tDa1XnuJbtOXZTgG8Hcfv212qhUzmRYDk8pzvff9hk5rZuApEgDnwlCXv3TEPHydOUmFOSd0hkqZ9D+sqEl0+q4ots7c1e1eb5Kod1wwe5QBL7rOgKhfTtwGPlyVlRGP7iqE7SHxfJgMzEm2JmIiAOBT5eyahikr0ByB8PbFZcx729xn0lSnao2RTpOaYA5ln+vWNMTPSGfgEtqnKLCxmO8kY4OHk2jxlY24hO1eF4hujcORU+qu/cqaxL5MpXOqHupcf6o7/58EYPy70q6ST0+OGKbRudEtopr4vp63rq5JGCod69+8tfbw== X-MS-Office365-Filtering-Correlation-Id: 4d1eae21-3cc0-4dea-9546-08d3e7fb8bc6 X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2741; 2:RBRgi1bM31w0l3/P7Q7NZjYrJDy0qyaaVXzYxlaSe4kQXM3JIpPbSwxs07RfWTaFwuLbqyeP1KrKVcdf8rPqcbXp26LT/R1OJOBsic2voE/AnTkSAxQQ4QhBuYn8362s1AbUZgasHJdd82am9ZZZHkTr1Ll4vzm14DPvuOLsghAWkqKglj//gX50LDakIiZI; 3:1L2f57CH63gBJcaPLT8foEfC7fwUEsyCGNm9JI/BqKmqHMqvLvR0mYwbh/nxcYC4s4MlupuH7Ghv1gzosb4RzWWzDgmEZK78/TJtp6NrgBuDPFZ/zUd0fI7p21S8VDcvzV+RohGStlnV+iOeM7IMTGDD/fpyDB6RCIkdU7D1gktY8IQrIb1CYXkjgFemn4UKMvluDtblJ68Pm10SiAP1jKpRE3Fl9NbUxVXxYMudsmEWicigvgZoArbYuEHm6azVJHk6/T/bizVKOyVJtqTeNA==; 25:lsTOINhJ6QAQVQJSNZNMUgKvAC1NmTbGgLCAM6WBfogVNhXuwDBGBrJchesPO692XT/UnsBBPyJpSS/R7V05UbhzgpaRX9xPfGaMzvyy03/Th0V3/TaDkAU1kiDAR5PWMQE/RVCZ8uYedbLO1aUUmxf46e2TLm5Nd4enMLCmjG/3CJO58SyRLuRretY+28I2EQd218LUC9XZyFPh6Vvbp8gexyNkUB9EWCuQpP/KCl4AaqUNoPFYA+mGZW6/Z3NkZG2fQZLEtAWyzUIMX3L2PQukeaxD4wwA7ErBD+1kKRRildMdu661tiodnWAz7Zkfzrof6kak+Az2R10G5rFKR0kLzeXSVKHTq93cXMV8uBD7g4Ez7Vuhu6FXhWeBUkfFD2VYrpag9xPYdAzZzYAj3XKtYY6LIh115IUJuPH8kM8= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:CY4PR02MB2741; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2741; 31:tkgeH5w7Beo+aQ85DSA+daT2O1XcyhceyDT4oCtEVMl/4k9q7EYMxPJShVnBtwxg03Z8KKAQyKdbprUBrwiLfGewEQbiviOJo//EdnLwTDKfOkFmMCAoG4zs5y+Jmq5s9zOJGTQq7nogxAWIEHBWPfpF07iB5LUwYYlDG/a/9rrl6YWyW9Tf2yAM1AP1CMIZVFOMbIAIF8gK/ofaLuJkYdSYwUA7XmL0yv9Rlf0oQ1g=; 20:CdN21VmhwvpG18JpvUsKYGEdBMnrXN9pC5vdoRa8t2k6z8ekXjx/o2bTuKnfvMtY0q6uoxnjVN/92yqz7sljyftJnnmoAuvZWIVnelr9uLljKTUleu/9SaRjKhr3bnixx99SligFDx+cRLAosQnO+sWRMXfkW8+LA8JgxZnGarkeKDShJ/YKxAOeH1O08Hfi67pWpFVZABlgC8DqJ/Kc/OnK8c7Ml+q9SgZDZczkksp/Yj8UZWxjJNSWVeit9SmW/X6HAVQ1QAnZCQiR7kMFLo+xq7K8qinQ9SZgVBRqxNu7BP8KQLh/M/AFG2YVkZG0nR+xganF1f0KAsqCEBXqxXxt2uiNib2uZXHwMbHgJsK40S0OEWIqQ8VPcnh783GrzbqeZ5zVMKFv9rpAnDC71BqVJgNKG/xErasWo90muQ2BlpAeYB2+Ak+V0zcY2w+QcEsFuw2ETwxlzSvlwM/AGylAeljGz++8rDr01XWE9mGglqj+bn3V7tzv9jSYAkhG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(13016025)(13018025)(8121501046)(3002001)(10201501046)(6055026); SRVR:CY4PR02MB2741; BCL:0; PCL:0; RULEID:; SRVR:CY4PR02MB2741; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2741; 4:B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UxqmXbcL5aytcQ==; 24:Zj2RjgLBfTMIyExBvTKiJD1t5D17gkMdBAJS+H0eJAa/Am9+Bz2QlLndoUrLGKFQWKjm28kIUkUQ3K5GCpJZfptMJ7S+w7bhbzJ2xyZxdnU=; 7:qId3CWnuKgN9pqqJvzMwh7/YHqMw7niQ+pPZ5zJrLH+IEEr1y2U9jlvDx2Z3Fy89PV/PIDBUT4+jHXPyr+klZ5bMpMx200gay7Vs5O1FIu+rj/NHNF2qRxbV05N9nLNEY6EWBd6zw+KrP3cBZV3119rMt5FhKNBimGK7f//dBsuIQtnvehR3kjsnnWdrxf2BWol1bw9flZmkSlQ9cNGQJoMp63p5ns4jHUYNTLOYWxJc+6x3d2jkJufL6KY1o22pW8nz/XVDGd2sGYFZLdBAzyZHLYE/53CvlPUWf3OLbxDAvgPcsH81HtoHOKmEzRfV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2741; 20:hQZXbMcPYaDvhGNELaDrkUOy0PxwpPpV1MGqGXSoSHwksxOzfaEGkyF08kWKHvVbIRFTjbYVm6gLNzIQEHT5U/9yFDMORyr3W3VDcnrPFJH3zolSRfF56+PNcPE3gFNncZkBUTjeDrINIZ52Hd2yPY+ozd9fQhrRSlaaE4BXzmUo4CcZUlhUC/L6EvLAIP2BuSX17Liwv7M4eBU618rwUU/37AhymtOA1osIu7zLLnbFrH3XlOVXgdk5T/VVqwu3 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2016 23:59:50.5591 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2741 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP blk_quiesce_queue() prevents that new queue_rq() invocations occur and waits until ongoing invocations have finished. This function does *not* wait until all outstanding requests have finished (this means invocation of request.end_io()). blk_resume_queue() resumes normal I/O processing. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Johannes Thumshirn Reviewed-by: Hannes Reinecke --- block/blk-mq.c | 137 ++++++++++++++++++++++++++++++++++++++++++++----- include/linux/blk-mq.h | 2 + include/linux/blkdev.h | 5 ++ 3 files changed, 131 insertions(+), 13 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index d8c45de..f5c71ad 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -58,15 +58,23 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx, sbitmap_clear_bit(&hctx->ctx_map, ctx->index_hw); } -void blk_mq_freeze_queue_start(struct request_queue *q) +static bool __blk_mq_freeze_queue_start(struct request_queue *q, + bool kill_percpu_ref) { int freeze_depth; freeze_depth = atomic_inc_return(&q->mq_freeze_depth); if (freeze_depth == 1) { - percpu_ref_kill(&q->q_usage_counter); + if (kill_percpu_ref) + percpu_ref_kill(&q->q_usage_counter); blk_mq_run_hw_queues(q, false); } + return freeze_depth == 1; +} + +void blk_mq_freeze_queue_start(struct request_queue *q) +{ + __blk_mq_freeze_queue_start(q, true); } EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start); @@ -102,19 +110,90 @@ void blk_mq_freeze_queue(struct request_queue *q) } EXPORT_SYMBOL_GPL(blk_mq_freeze_queue); -void blk_mq_unfreeze_queue(struct request_queue *q) +static bool __blk_mq_unfreeze_queue(struct request_queue *q, + bool reinit_percpu_ref) { int freeze_depth; freeze_depth = atomic_dec_return(&q->mq_freeze_depth); WARN_ON_ONCE(freeze_depth < 0); if (!freeze_depth) { - percpu_ref_reinit(&q->q_usage_counter); + if (reinit_percpu_ref) + percpu_ref_reinit(&q->q_usage_counter); wake_up_all(&q->mq_freeze_wq); } + return freeze_depth == 0; +} + +void blk_mq_unfreeze_queue(struct request_queue *q) +{ + __blk_mq_unfreeze_queue(q, true); } EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue); +/** + * blk_mq_quiesce_queue() - wait until all pending queue_rq calls have finished + * + * Prevent that new I/O requests are queued and wait until all pending + * queue_rq() calls have finished. Must not be called if the queue has already + * been frozen. Additionally, freezing the queue after having quiesced the + * queue and before resuming the queue is not allowed. + * + * Note: this function does not prevent that the struct request end_io() + * callback function is invoked. + */ +void blk_mq_quiesce_queue(struct request_queue *q) +{ + struct blk_mq_hw_ctx *hctx; + unsigned int i; + bool res, rcu = false; + + spin_lock_irq(q->queue_lock); + WARN_ON_ONCE(blk_queue_quiescing(q)); + queue_flag_set(QUEUE_FLAG_QUIESCING, q); + spin_unlock_irq(q->queue_lock); + + res = __blk_mq_freeze_queue_start(q, false); + WARN_ON_ONCE(!res); + queue_for_each_hw_ctx(q, hctx, i) { + if (hctx->flags & BLK_MQ_F_BLOCKING) { + mutex_lock(&hctx->queue_rq_mutex); + mutex_unlock(&hctx->queue_rq_mutex); + } else { + rcu = true; + } + } + if (rcu) + synchronize_rcu(); + + spin_lock_irq(q->queue_lock); + WARN_ON_ONCE(!blk_queue_quiescing(q)); + queue_flag_clear(QUEUE_FLAG_QUIESCING, q); + spin_unlock_irq(q->queue_lock); +} +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue); + +/** + * blk_mq_resume_queue() - resume request processing + * + * Resume blk_queue_enter() calls that have been suspended by + * blk_mq_quiesce_queue(). + * + * The caller is responsible for serializing blk_mq_quiesce_queue() and + * blk_mq_resume_queue(). + */ +void blk_mq_resume_queue(struct request_queue *q) +{ + bool res; + + res = __blk_mq_unfreeze_queue(q, false); + WARN_ON_ONCE(!res); + WARN_ON_ONCE(blk_queue_quiescing(q)); + + blk_mq_run_hw_queues(q, false); +} +EXPORT_SYMBOL_GPL(blk_mq_resume_queue); + void blk_mq_wake_waiters(struct request_queue *q) { struct blk_mq_hw_ctx *hctx; @@ -488,6 +567,9 @@ static void blk_mq_requeue_work(struct work_struct *work) struct request *rq, *next; unsigned long flags; + if (blk_queue_quiescing(q)) + return; + spin_lock_irqsave(&q->requeue_lock, flags); list_splice_init(&q->requeue_list, &rq_list); spin_unlock_irqrestore(&q->requeue_lock, flags); @@ -782,7 +864,7 @@ static inline unsigned int queued_to_index(unsigned int queued) * of IO. In particular, we'd like FIFO behaviour on handling existing * items on the hctx->dispatch list. Ignore that for now. */ -static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) +static void blk_mq_process_rq_list(struct blk_mq_hw_ctx *hctx) { struct request_queue *q = hctx->queue; struct request *rq; @@ -791,9 +873,6 @@ 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))) - return; - WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) && cpu_online(hctx->next_cpu)); @@ -883,7 +962,24 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) * * blk_mq_run_hw_queue() already checks the STOPPED bit **/ - blk_mq_run_hw_queue(hctx, true); + if (!blk_queue_quiescing(q)) + blk_mq_run_hw_queue(hctx, true); + } +} + +static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) +{ + if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) + return; + + if (hctx->flags & BLK_MQ_F_BLOCKING) { + mutex_lock(&hctx->queue_rq_mutex); + blk_mq_process_rq_list(hctx); + mutex_unlock(&hctx->queue_rq_mutex); + } else { + rcu_read_lock(); + blk_mq_process_rq_list(hctx); + rcu_read_unlock(); } } @@ -1341,7 +1437,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) blk_mq_bio_to_request(rq, bio); /* - * We do limited pluging. If the bio can be merged, do that. + * We do limited plugging. If the bio can be merged, do that. * Otherwise the existing request in the plug list will be * issued. So the plug list will have one request at most */ @@ -1361,9 +1457,23 @@ 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 (!blk_mq_direct_issue_request(old_rq, &cookie)) - goto done; - blk_mq_insert_request(old_rq, false, true, true); + + if (data.hctx->flags & BLK_MQ_F_BLOCKING) { + mutex_lock(&data.hctx->queue_rq_mutex); + if (blk_queue_quiescing(q) || + blk_mq_direct_issue_request(old_rq, &cookie) != 0) + blk_mq_insert_request(old_rq, false, true, + true); + mutex_unlock(&data.hctx->queue_rq_mutex); + } else { + rcu_read_lock(); + if (blk_queue_quiescing(q) || + blk_mq_direct_issue_request(old_rq, &cookie) != 0) + blk_mq_insert_request(old_rq, false, true, + true); + rcu_read_unlock(); + } + goto done; } @@ -1702,6 +1812,7 @@ static int blk_mq_init_hctx(struct request_queue *q, INIT_DELAYED_WORK(&hctx->delay_work, blk_mq_delay_work_fn); spin_lock_init(&hctx->lock); INIT_LIST_HEAD(&hctx->dispatch); + mutex_init(&hctx->queue_rq_mutex); hctx->queue = q; hctx->queue_num = hctx_idx; hctx->flags = set->flags & ~BLK_MQ_F_TAG_SHARED; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 368c460d..4b970f1 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -41,6 +41,8 @@ struct blk_mq_hw_ctx { struct blk_mq_tags *tags; + struct mutex queue_rq_mutex; + unsigned long queued; unsigned long run; #define BLK_MQ_MAX_DISPATCH_ORDER 7 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c47c358..d365cdf 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -505,6 +505,7 @@ struct request_queue { #define QUEUE_FLAG_FUA 24 /* device supports FUA writes */ #define QUEUE_FLAG_FLUSH_NQ 25 /* flush not queueuable */ #define QUEUE_FLAG_DAX 26 /* device supports DAX */ +#define QUEUE_FLAG_QUIESCING 27 #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ (1 << QUEUE_FLAG_STACKABLE) | \ @@ -595,6 +596,8 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) #define blk_queue_secure_erase(q) \ (test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags)) #define blk_queue_dax(q) test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags) +#define blk_queue_quiescing(q) test_bit(QUEUE_FLAG_QUIESCING, \ + &(q)->queue_flags) #define blk_noretry_request(rq) \ ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ @@ -824,6 +827,8 @@ extern void __blk_run_queue(struct request_queue *q); extern void __blk_run_queue_uncond(struct request_queue *q); extern void blk_run_queue(struct request_queue *); extern void blk_run_queue_async(struct request_queue *q); +extern void blk_mq_quiesce_queue(struct request_queue *q); +extern void blk_mq_resume_queue(struct request_queue *q); extern int blk_rq_map_user(struct request_queue *, struct request *, struct rq_map_data *, void __user *, unsigned long, gfp_t);