From patchwork Mon Sep 26 18:28:24 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: 9351181 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 BCCC26077B for ; Mon, 26 Sep 2016 18:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B01F828A58 for ; Mon, 26 Sep 2016 18:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A452828ADA; Mon, 26 Sep 2016 18:44:23 +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=unavailable 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 61BD228A58 for ; Mon, 26 Sep 2016 18:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035015AbcIZSoN (ORCPT ); Mon, 26 Sep 2016 14:44:13 -0400 Received: from mail-bn3nam01on0041.outbound.protection.outlook.com ([104.47.33.41]:27840 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1035004AbcIZSoJ (ORCPT ); Mon, 26 Sep 2016 14:44:09 -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=Wo7hxrCwQdeLD4UQeP+TAq9onC30pxbCaoOAxkdKmuk=; b=iszPnM+36CwD6DJ8JPa3n+QV6zHySU0IENSXiBE5KCQVgZ2WaXUfUlsBBqk9V265jEBlz6u8F80LK/qWBJBH90UNlOKyTqhCWtCEK8kAmU8RBVXxEiKOs/DuH6ITDPfXpDxDbyz1OXQfJJKXi3D66owgETHzpRWM4gwU9AuJwbY= Received: from BLUPR02CA058.namprd02.prod.outlook.com (10.160.23.176) by CY1PR02MB2137.namprd02.prod.outlook.com (10.166.190.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Mon, 26 Sep 2016 18:28:33 +0000 Received: from BY2FFO11OLC015.protection.gbl (2a01:111:f400:7c0c::180) by BLUPR02CA058.outlook.office365.com (2a01:111:e400:8ad::48) 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; Mon, 26 Sep 2016 18:28:32 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by BY2FFO11OLC015.mail.protection.outlook.com (10.1.15.59) 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; Mon, 26 Sep 2016 18:28:27 +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 4E.DD.61581.3C669E75; Mon, 26 Sep 2016 11:19:48 -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; Mon, 26 Sep 2016 11:28:25 -0700 X-AuditID: 0ac94371-952c29800000f08d-55-57e966c3e24f Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id DB.DC.02783.9C869E75; Mon, 26 Sep 2016 11:28:25 -0700 (PDT) Subject: [PATCH 7/9] blk-mq: Introduce blk_quiesce_queue() and blk_resume_queue() To: Jens Axboe References: <7948dbb8-6333-dc62-2673-4da35b4dfdbc@sandisk.com> 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: <517396c6-1392-0b42-cc6c-e48652897cf6@sandisk.com> Date: Mon, 26 Sep 2016 11:28:24 -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: <7948dbb8-6333-dc62-2673-4da35b4dfdbc@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIIsWRmVeSWpSXmKPExsXCddJ5ke6RtJfhBu1buS3+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwWy4//Y7Jo2/iV0YHbY2LzO3aP xXteMnk8OLSZxWPzknqP3Tcb2Dw+Pr3F4vF+31U2j8+b5AI4orhsUlJzMstSi/TtErgymvec YizotK/40/uFrYFxtUkXIyeHhICJxPuW+WwgtpDAUiaJCysTuhi5gOwdjBJHXrxkgim6NuE8 M0RiKaNE45Iv7CAJYYFgiUWnmlhAbBEBWYnvu19DTbKTmDW7jQ2kgVngA7PE296jYAk2ASOJ b+9ngjXwAhVt6J4FFmcRUJWY+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rlq6CLJtNnWL/hCtSp9D0i9mLJ6kVvj9mGTz4692FWwY0/H1b/d0tzanDszZK5 bevXGiKx60PL94RmmWPX1n0tuD/jk8aEO0osxRmJhlrMRcWJAP4HuwksAgAA X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(110136003)(92566002)(8676002)(19580405001)(6916009)(11100500001)(2950100002)(33646002)(65826007)(19580395003)(47776003)(229853001)(106466001)(36756003)(189998001)(7416002)(83506001)(68736007)(31686004)(5660300001)(4001350100001)(230700001)(53416004)(65956001)(626004)(65806001)(2906002)(356003)(2270400002)(76176999)(54356999)(50986999)(87936001)(97736004)(7846002)(69596002)(305945005)(77096005)(586003)(64126003)(23676002)(4326007)(81166006)(81156014)(8936002)(86362001)(50466002)(31696002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR02MB2137; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC015; 1:BWrNBt4xB2w7pvBK/oRIqZDmdwCiqouiVirkaZPOXEJembsgCooK/H1Nd70dofGijPARE6X7F3kynswqMfQTEAAhuIeufw7GwRDBBzjTQC5uvEnO0KieTYtKU3GunM6726m7o5S6FSY/ejRPpsJerNW6FdcCFr6VHV7IzEsiQKBYBnCPetIu9ucXDMdF1voKh204UnyvI3i3qLfvTVs9PqCgzk8zUkriNHvjdTijvwTzw2Hp0eaddsxtTm9gQMU5O7yJ6/U2pUl6l30R1tOlHelRP2XvTPNkLclxfa5MntLifp1BAKm0pSIf2Zrdn5LCLV0BVOxVvzCT6BUrm6EDB8HULNrS9o2z8OznnCcCJCNmnjhhW/gjktpbnT5blu+vPaNTKynuQLHGD7Sg5r1HjwDB7Nntsn4/RUsvZ29hT43uSkHrEduV8KN3yXUByFJByaMXfTvkXKr5ixJf5BMJi8ANTg3PiG+osTGpcTU/Wp9zznh3/M9Li3EUSdYsQMnDPodEdVrkr4sF6oUDIJlNBTojPZm0UgmnWNK4WI3gRf/EY90xsTtv5CwEZJGvq4iO X-MS-Office365-Filtering-Correlation-Id: ff3b061f-f8df-4ea5-45e7-08d3e63aeb32 X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB2137; 2:E4jYMr9Ek9D5fVaodhtqjxa+24fRvlC7eVVr0OcbySUTJZZB0k/5QlDLk0MDZH+khTftzm4Omn10Sonm8WPkPDVSMsDlxtTX1dSH4Kqze396c5NQBzV+Ay8wwyCemEUfYY2gW+/xVTX4duWwZmGmyd2h8VFl+lqmWVuapZY2vyRldPqiB28rtrLuKELx9jY+; 3:EWdxI85DMe0tLMVfBqpTXKLnVsptpcbIMkMek5xwqrk5qzAV9RWB5g4E5ZORFJJFV/zHwEVGNGLeYAaYgu3+rci5PR37QYEIiGZ5vIzM5ZlAhapi9QZWwy/oDsd/wL0xfPQqn/+H4grsgd8hxh2zxzHHq4M1yYHuogoHFc0rv0pJGs+AGjrt/NiPTtJNNgVanevqGhpUAgvApDyYEnI5tsFlVIz9vc5FUbwrcirD4Cd/e6yYKpb1baxwKEyq5hB9B5esVMM4OsMzElI73TKssQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:CY1PR02MB2137; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB2137; 25:tHHhvQ3WH1aLxuGHo+pk/VzgGmrN5SeYCPLXwQbV90fAgEnj0rXFC/Zd16FeQpVOruDyHxPV3l/AdbqAKFr24TJcJzt26PZOdVllLFOW7YBi1pTZg4AvebEa0ByDaHToo24bszuPYvkykY26gUzULET/YmU8hXkVB/g6rrhVSHrU3465TGXekEIEfazK62nC0SbzX8oWeZBPVrvzq9L4/w/J4YchePlM//hsQ+XvbbR7ocSdFKSf/EAL8f2rM2l0ncgwKXw9R+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9MFOqv51Jzj0suGmSGREQYu8HcUF0sqIEoVcnMMad+r2ihIv7yL2v1jg5ifJgAwckUllbnPEO6RH4Tq6KO1R6GKUqAsoNzqP2RlEJ+Z6FbN1ETTKCynfBCKnfANjnYEHEe+zCFcYyCgwCoBCJkQR3WAZPRHrB9iEbd+l6zOW/lx1AK9CSih3SYTs9tjZqD3bSzijun4lqsZGzLCbU6N9l2CkonmAdvcgxN+rM1qoU/xU+7ooaiScblH7Kmmcdt/1SSPaE 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)(8121501046)(13016025)(13018025)(3002001)(10201501046)(6055026); SRVR:CY1PR02MB2137; BCL:0; PCL:0; RULEID:; SRVR:CY1PR02MB2137; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB2137; 4:ZQjqDUDpLaJoIkjHSU7ug6Jt7hp3PLD5OkQkeCWJiUQERMhhjcWh/sS1DpxQrwg0CE7m9uJvnvsZiwwMoaFMCbJ7eXt5cfiZ75FLF2YgTd2YOhSl8SVsWVun00M0nxBsjuVsmqinNM0JcYKHyyG1IVT67q2MZsLvTR2+RWRzwp6sGqNd/JU9IXJEd5UujqQTCsktkydW3fXvPVxLIk650GzBheHLoZ3EEYa14mLOBUM7G7LBB/t15zNCZ38dZ9G9oE2fPOafwMFcNZzDr0Fe4/OvgcOlwVenX5Kop7+6Jj+Cz3awIIbxQCfihKYUzTjr9tQh+YJ+VHDmCheKLjBx2UtKrRDbBOXoBeh3hR7B0QutrR+onxC4uJS7GLaSEummcAA7fCK9pGOp2qNYkXxnvXq4EmFzsl0SzmMbhMShVQuQ3whNMXJobs1oZWTopsmxfmIKyx6v1jEX2RW2vOZpQbSYhIlDS/AKN+2AAUFkgys= X-Forefront-PRVS: 00770C4423 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyTUIyMTM3OzIz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Aw0AKsvoBH1kD27YhqkFwmnK59MW4ifkGhbyhkZJKk0hWNiJSds1sVJwynuY26127D52yLb3wV9AtNm4tWAkDgrGj7xgPEEfV7QuZ+9jl+NPL3syBb6+4AHHpyTzaBk2kYCj01gVUtUqQwgBXfpL8EFRbdcQ2LAswuhmwR9Vj1cxNZrDuG2+w6efDXL1iQUyF X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2016 18:28:27.6464 (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.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR02MB2137 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@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 --- block/blk-core.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++---- block/blk-mq.c | 24 +++++++++++++----- block/blk.h | 2 +- include/linux/blkdev.h | 5 ++++ 4 files changed, 85 insertions(+), 12 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 0ff5d57..62cb6ae 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -682,18 +682,20 @@ static void blk_queue_usage_counter_release(struct percpu_ref *ref) wake_up_all(&q->freeze_wq); } -void blk_freeze_queue_start(struct request_queue *q) +bool blk_freeze_queue_start(struct request_queue *q, bool kill_percpu_ref) { int freeze_depth; freeze_depth = atomic_inc_return(&q->freeze_depth); if (freeze_depth == 1) { - percpu_ref_kill(&q->q_usage_counter); + if (kill_percpu_ref) + percpu_ref_kill(&q->q_usage_counter); if (q->mq_ops) blk_mq_run_hw_queues(q, false); else if (q->request_fn) blk_run_queue(q); } + return freeze_depth == 1; } void blk_freeze_queue_wait(struct request_queue *q) @@ -708,21 +710,75 @@ void blk_freeze_queue_wait(struct request_queue *q) */ void blk_freeze_queue(struct request_queue *q) { - blk_freeze_queue_start(q); + blk_freeze_queue_start(q, true); blk_freeze_queue_wait(q); } -void blk_unfreeze_queue(struct request_queue *q) +static bool __blk_unfreeze_queue(struct request_queue *q, + bool reinit_percpu_ref) { int freeze_depth; freeze_depth = atomic_dec_return(&q->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->freeze_wq); } + return freeze_depth == 0; +} + +void blk_unfreeze_queue(struct request_queue *q) +{ + __blk_unfreeze_queue(q, true); +} + +/** + * blk_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_quiesce_queue(struct request_queue *q) +{ + 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); + + WARN_ON_ONCE(!blk_freeze_queue_start(q, false)); + 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_quiesce_queue); + +/** + * blk_resume_queue() - resume request processing + * + * The caller is responsible for serializing blk_quiesce_queue() and + * blk_resume_queue(). + */ +void blk_resume_queue(struct request_queue *q) +{ + WARN_ON_ONCE(!__blk_unfreeze_queue(q, false)); + WARN_ON_ONCE(blk_queue_quiescing(q)); + + if (q->mq_ops) + blk_mq_run_hw_queues(q, false); + else + blk_run_queue(q); } +EXPORT_SYMBOL_GPL(blk_resume_queue); static void blk_rq_timed_out_timer(unsigned long data) { diff --git a/block/blk-mq.c b/block/blk-mq.c index e17a5bf..4df9e4f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -60,7 +60,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx, void blk_mq_freeze_queue_start(struct request_queue *q) { - blk_freeze_queue_start(q); + blk_freeze_queue_start(q, true); } EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start); @@ -441,6 +441,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); @@ -757,6 +760,8 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) */ flush_busy_ctxs(hctx, &rq_list); + rcu_read_lock(); + /* * If we have previous entries on our dispatch list, grab them * and stuff them at the front for more fair dispatch. @@ -836,8 +841,11 @@ 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); } + + rcu_read_unlock(); } /* @@ -1294,7 +1302,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 */ @@ -1314,9 +1322,13 @@ 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); + + 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; } diff --git a/block/blk.h b/block/blk.h index 12f7366..0e934b5 100644 --- a/block/blk.h +++ b/block/blk.h @@ -71,7 +71,7 @@ void __blk_queue_free_tags(struct request_queue *q); bool __blk_end_bidi_request(struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes); void blk_freeze_queue(struct request_queue *q); -void blk_freeze_queue_start(struct request_queue *q); +bool blk_freeze_queue_start(struct request_queue *q, bool kill_percpu_ref); void blk_freeze_queue_wait(struct request_queue *q); void blk_unfreeze_queue(struct request_queue *q); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f08dc65..06c9b21 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_quiesce_queue(struct request_queue *q); +extern void blk_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);