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: 990383 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="cuynIKmj"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42kKvY0JHfz9s3l for ; Tue, 30 Oct 2018 03:35:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727956AbeJ3BYY (ORCPT ); Mon, 29 Oct 2018 21:24:24 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:38785 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727862AbeJ3BYY (ORCPT ); Mon, 29 Oct 2018 21:24:24 -0400 Received: by mail-it1-f194.google.com with SMTP id i76-v6so10161430ita.3 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=Si31lyIGUMDRhVfb2lIipfb0mOUAAF8/pksf8M4I3b2NM0dnEt/SSMYI3rUnlR4OS9 jPDm/SFX+pPuET4SBvNdH2gDxoOMfiWW81XfdXttz/2J5WuaQLimetEPCcGE4nLQekT/ GM8OoRWS0IxO0byvYwVnttnogeKKrjkoZ6eCXR0QpSK/0CgY39L4aXCLnjrvyB5R8tWz A0sifZgjKsj+pVA3fvgJMwk1We4AmGy+972LMH/O/MsHMpwbkRi9ddn4CcmR/rHYKil7 +LP1FowDUcOZL9qrvo6ip8PMiJQ7rcJAE9J7JxciiqJrzjiigCUO6mHnIcp6y68zLQQF V2wA== X-Gm-Message-State: AGRZ1gJsJDL/KVyTmGsHcU4HbjkXc/0nZ7YFUAoF6lJRAgeOaYQyiunm 2DfXgVMeoAOQXg0SbxUg8h7K1g== 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-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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