From patchwork Fri Apr 3 15:58:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 6157251 Return-Path: X-Original-To: patchwork-linux-scsi@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 2AF849F350 for ; Fri, 3 Apr 2015 15:58:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D361203DA for ; Fri, 3 Apr 2015 15:58:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73765203B6 for ; Fri, 3 Apr 2015 15:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752595AbbDCP6k (ORCPT ); Fri, 3 Apr 2015 11:58:40 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:31813 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752899AbbDCP6c (ORCPT ); Fri, 3 Apr 2015 11:58:32 -0400 Received: from pps.filterd (m0004060 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t33FtdXq003988; Fri, 3 Apr 2015 08:58:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=9BJThP8ViRJ0n4YN6r4XnedXtXlS1c/mv4u5Acs9/G0=; b=hHsURoAki9lgCjszetAE7za8EK7satXJyXsdfOuECPTjJlbhqwAbgnCSt3OdpKOpVf9Z aITm/G6ZI4AkI+aVKQpeugkiFfmVWkB18tjYSLaYG5BkRUN0KW5l/OipiXbTZyNV78br pwBaQKz4/gdZIBLitsku/+npyp6/xh1hUkM= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1thvcq89rg-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 03 Apr 2015 08:58:28 -0700 Received: from lenny.thefacebook.com (192.168.52.13) by mail.thefacebook.com (192.168.16.22) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 3 Apr 2015 08:58:26 -0700 From: Jens Axboe To: , , CC: , Jens Axboe Subject: [PATCH 2/7] blk-mq: add helper to iterate all busy tags on all hardware queues Date: Fri, 3 Apr 2015 09:58:18 -0600 Message-ID: <1428076703-31014-3-git-send-email-axboe@fb.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428076703-31014-1-git-send-email-axboe@fb.com> References: <1428076703-31014-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.52.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-04-03_06:2015-04-03, 2015-04-03, 1970-01-01 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_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 The current iter helper function deals with a hardware queue. Some callers want to access all queues, like the internal blk-mq timeout handling does. So add a helper for that. Signed-off-by: Jens Axboe --- block/blk-mq.c | 35 +++++++++++++++++++++++------------ include/linux/blk-mq.h | 2 ++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 1cd34d4d707c..d8dcb71d3076 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -561,6 +561,25 @@ void blk_mq_abort_requeue_list(struct request_queue *q) } EXPORT_SYMBOL(blk_mq_abort_requeue_list); +void blk_mq_queue_busy_iter(struct request_queue *q, busy_iter_fn *fn, + void *priv) +{ + struct blk_mq_hw_ctx *hctx; + int i; + + queue_for_each_hw_ctx(q, hctx, i) { + /* + * If no software queues are currently mapped to this + * hardware queue, there's nothing to check + */ + if (!blk_mq_hw_queue_mapped(hctx)) + continue; + + blk_mq_tag_busy_iter(hctx, fn, priv); + } +} +EXPORT_SYMBOL_GPL(blk_mq_queue_busy_iter); + static inline bool is_flush_request(struct request *rq, struct blk_flush_queue *fq, unsigned int tag) { @@ -659,24 +678,16 @@ static void blk_mq_rq_timer(unsigned long priv) .next = 0, .next_set = 0, }; - struct blk_mq_hw_ctx *hctx; - int i; - queue_for_each_hw_ctx(q, hctx, i) { - /* - * If not software queues are currently mapped to this - * hardware queue, there's nothing to check - */ - if (!blk_mq_hw_queue_mapped(hctx)) - continue; - - blk_mq_tag_busy_iter(hctx, blk_mq_check_expired, &data); - } + blk_mq_queue_busy_iter(q, blk_mq_check_expired, &data); if (data.next_set) { data.next = blk_rq_timeout(round_jiffies_up(data.next)); mod_timer(&q->timeout, data.next); } else { + struct blk_mq_hw_ctx *hctx; + int i; + queue_for_each_hw_ctx(q, hctx, i) blk_mq_tag_idle(hctx); } diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index b216deab80d9..8c010b5ea1b6 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -219,6 +219,8 @@ void blk_mq_stop_hw_queues(struct request_queue *q); void blk_mq_start_hw_queues(struct request_queue *q); void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); +void blk_mq_queue_busy_iter(struct request_queue *q, busy_iter_fn *fn, + void *priv); void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, void *priv); void blk_mq_freeze_queue(struct request_queue *q);