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: 10663051 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 21D833CF1 for ; Wed, 31 Oct 2018 17:59:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14AAD2B4D3 for ; Wed, 31 Oct 2018 17:59:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 095762B4DC; Wed, 31 Oct 2018 17:59:44 +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=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 B42762B4D5 for ; Wed, 31 Oct 2018 17:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730165AbeKAC6q (ORCPT ); Wed, 31 Oct 2018 22:58:46 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:40814 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730157AbeKAC6p (ORCPT ); Wed, 31 Oct 2018 22:58:45 -0400 Received: by mail-it1-f194.google.com with SMTP id i191-v6so19537670iti.5 for ; Wed, 31 Oct 2018 10:59:41 -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=VrDVl3hUAv8j0zwD0AWNvWRDGc9K/O4RXUo6wOnJjtaGVb567NhXWHKjrqWvDSw7xM o9NbaEGHUZPdzOJ4a9w7Trtbpt5J5kH9RNYnP+7lXDxKrayKj2nJvlZOCGEBt+IuY7FT 9v38TvnkVw/WNFyQctiFavZbkMkbvUi3xDJ2yynDqrMx4Z4JjxaQ19x6tNxYB2ptS7TZ PkjtLlPLR1EJoGI/1esYL2dH64vEEpsKSCCaPEYfkuCqUgshBAriqD83myzW/dbpivJy 1maT6MOpoWs/tRGfbxMIlGSjzXbhZ18yqhfz/lKFxf84mpbAuZWEzXlr1duk1tVxSvoQ onAQ== X-Gm-Message-State: AGRZ1gI3Tl8zPFqcG8/KfLyB6KUW8kzr0FJmwgJieyTLBgpjmmWTgvQn t5nF+q4UFK/BbqP8VKHwtOGPNw== 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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