From patchwork Wed Oct 31 17:58:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10663049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD35F1751 for ; Wed, 31 Oct 2018 17:59:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEAA82B4DC for ; Wed, 31 Oct 2018 17:59:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B32CB2B4DD; Wed, 31 Oct 2018 17:59:43 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 5FB162B4D5 for ; Wed, 31 Oct 2018 17:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730157AbeKAC6q (ORCPT ); Wed, 31 Oct 2018 22:58:46 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:51688 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730161AbeKAC6p (ORCPT ); Wed, 31 Oct 2018 22:58:45 -0400 Received: by mail-it1-f196.google.com with SMTP id h13so6713364itl.1 for ; Wed, 31 Oct 2018 10:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Nb4Amz8UubZm8zMSQWxQLbSmCNxi6ej3MxYT4bCFheU=; b=SrPGcN3CKspdGKWMpah5FolGXY9JE2xCdiJRcDHhSMhL9jKra8ZQbZUmE3AeE37/n/ cy4GHffwUQLODOHO7PO2j1TuDSL8ttUeUlunKeanqKVGhHkdcKZ5VOUM2Vw6nvRRpVoe GWDIhqzLsWcxh6T7umHPPNfK/G8bGgqGalb3BOGKIscZQJolVkIls3vaXplWlgE0XXj8 V9op5kEqVUkqvv7CzcANDQe/2qcZ0u0sXZ2xokie4KeAH+INjVRZuCInL7zVimt+FEn+ xjHdH0Je8F+wA7btN0BXa5iX2Up8nU3j1rgWPBM9zp8mZGaVC5X/TlOH0VXaEhkhyvD2 XQ4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Nb4Amz8UubZm8zMSQWxQLbSmCNxi6ej3MxYT4bCFheU=; b=CHk12BDutBkKk47fx8KW5FWlu2oQDMXNLMFRc9YDMKf9JnXuHhamnUKrANBCuFxkNV 9Q6M8Klan+kIivByK1q6G4mSR+MWmisBA4Ix7bIIQfS/Ze4Gn6fnFIW+U2PT9CA2Jpzt jQEO+Bn83qX0wSz1FwofrHmd2Dk2eSqIV4o7NtYCo68x3KRY+5mp3PC7tsU5kSZJhLzd lYIT197cRK/gQB9WIDb3sIYWbxl7la/tzYCvfTcf6/Y8oSL5VBrJ7Mk8m0wfe5FjA1cn 9SP49duB/ZEcyPpTpvxYJ8apkU+3ZRgowSC2ije9T/XqGRHGF0fgyN2fYKQDyu8yH3tv HAmA== X-Gm-Message-State: AGRZ1gK8gGPAMMgjdwW5PHBqcDLasRGlfi/kevagdSrXF8Pt3egkdbai sAm4WQStHECGJ6yq9gfTJiFwTBbJPUw= X-Google-Smtp-Source: AJdET5fummKMyolDxOK5aRH3rBEXrVGN5+C/N8GsqD5bMXfdDqlO5Va8ZOzycvDdQ99wxhyzPIgUXw== X-Received: by 2002:a02:5605:: with SMTP id o5-v6mr3249779jab.107.1541008781234; Wed, 31 Oct 2018 10:59:41 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id 197-v6sm10982947iou.87.2018.10.31.10.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 10:59:39 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 07/30] blk-mq: provide mq_ops->busy() hook Date: Wed, 31 Oct 2018 11:58:59 -0600 Message-Id: <20181031175922.8849-8-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031175922.8849-1-axboe@kernel.dk> References: <20181031175922.8849-1-axboe@kernel.dk> 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 We'll hook into this from blk_lld_busy(), allowing blk-mq to also return whether or not a given queue currently has requests in progress. Reviewed-by: Hannes Reinecke Signed-off-by: Jens Axboe --- block/blk-core.c | 2 ++ include/linux/blk-mq.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index bc6ea87d10e0..c99088d0e80b 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -3429,6 +3429,8 @@ int blk_lld_busy(struct request_queue *q) { if (q->lld_busy_fn) return q->lld_busy_fn(q); + if (q->mq_ops && q->mq_ops->busy) + return q->mq_ops->busy(q); return 0; } diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 2286dc12c6bc..5c8418ebbfd6 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -114,6 +114,7 @@ typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *, typedef void (busy_tag_iter_fn)(struct request *, void *, bool); typedef int (poll_fn)(struct blk_mq_hw_ctx *, unsigned int); typedef int (map_queues_fn)(struct blk_mq_tag_set *set); +typedef bool (busy_fn)(struct request_queue *); struct blk_mq_ops { @@ -165,6 +166,11 @@ struct blk_mq_ops { /* Called from inside blk_get_request() */ void (*initialize_rq_fn)(struct request *rq); + /* + * If set, returns whether or not this queue currently is busy + */ + busy_fn *busy; + map_queues_fn *map_queues; #ifdef CONFIG_BLK_DEBUG_FS