From patchwork Mon Oct 29 16:34:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10659593 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 8EE8F3CF1 for ; Mon, 29 Oct 2018 16:35:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C0529C31 for ; Mon, 29 Oct 2018 16:35:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6707929C41; Mon, 29 Oct 2018 16:35:05 +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 17C3B29C31 for ; Mon, 29 Oct 2018 16:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727961AbeJ3BYY (ORCPT ); Mon, 29 Oct 2018 21:24:24 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:33764 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbeJ3BYY (ORCPT ); Mon, 29 Oct 2018 21:24:24 -0400 Received: by mail-it1-f194.google.com with SMTP id p11-v6so870676itf.0 for ; Mon, 29 Oct 2018 09:35:03 -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=vi0fbUFDDroXvBwykWpTCF/4gKIQmyo7qyw32sE6a8I=; b=cuynIKmjixaKqTOZNHR+aVHdeI/7I3cVxUt7OygP723Kp60FEyqeZk0jMlLSl4ckKc GNWdX2GOaN4a4UN0Vgnq7xPwTR7CbhfChVIlEobT4gnEjgH50rt7aOL0Bujf+c9cB5qs HVA3WR/8IZ/8KBb04g5Iu8dlboDnD5cqyJO86SEsq3iYW/R2ugKSTVk13L29GJk5ZWbm 2hnbFwBi+Rg/aNueHwhrNDPe1M7yYhj5lot0XZRvnrxd0NRWDBeQXwncN9OCue74vEb/ bYiEGYz7Vq1PkN9v5imvI6sWoUG2ovwP5OJFuwPOdwBD/MrzsjJJ/pJ4MSFo/1WEH742 7vZA== 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=vi0fbUFDDroXvBwykWpTCF/4gKIQmyo7qyw32sE6a8I=; b=LUvIBPHPP3NksOtFRjSeLfgESkoYvyM4TgA80vYgw7/Q8NMazZSHsBToV8Y/7a3eSI LGzfbRfRn4q2wPZ/DLHiV349U+hDBIuZ3rUX3kSYnUfG/wwyL2Vy1N6GYtBnpy9ACFQc UPp+3Eyn6fl42EX2O8mDrR+Jqww+4gvfRm0Bu3EsOpSrEBU6QyWpqD81hWCJUM/PRBn1 PtZTqgOvzZdwKy6DProNRL2Tpz2rGkNaw+o1B6262cVDVaPnUNWyTj80EvIUSqbPnbcS L/XtnbeIMPRpMFDJV4v/tqF9jdYNB1C6J+SL86XelgpLVFcjMfKjfLhkzgP+u/3mEGu9 pkSg== X-Gm-Message-State: AGRZ1gK7v6fS5B90DQrZCAsbNzqgfD7nsVTclp+BYarA1hEvfJlTVnXG m3+S8SHocQHZDgI57XpbZ4/iQA== X-Google-Smtp-Source: AJdET5fO8vXDWGwjKErB9MMCCM1XJtlVaARa9q9ODwCMmTr0cRvO4/YAIIp7TH47RaUU07VAW/IGdA== X-Received: by 2002:a24:9717:: with SMTP id k23-v6mr7425648ite.94.1540830903204; Mon, 29 Oct 2018 09:35:03 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id n7-v6sm6464500itb.22.2018.10.29.09.35.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 09:35:02 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 07/29] blk-mq: provide mq_ops->busy() hook Date: Mon, 29 Oct 2018 10:34:22 -0600 Message-Id: <20181029163444.9940-8-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181029163444.9940-1-axboe@kernel.dk> References: <20181029163444.9940-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. Signed-off-by: Jens Axboe Reviewed-by: Hannes Reinecke --- 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