Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp853939pxu; Wed, 14 Oct 2020 16:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSTiEhela6xhFg4H0ca6gi8lHqy5Uze+/z5AyiE/smCnU6kdfRMrchBZHEJtPk9CqyR9RH X-Received: by 2002:aa7:d1cc:: with SMTP id g12mr1361681edp.195.1602716609776; Wed, 14 Oct 2020 16:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602716609; cv=none; d=google.com; s=arc-20160816; b=lPyf8f+XQ7suariQaTSY53k/rT8ya/HaNaXNFRUSf0MxLWdOgChxTwh7m1OdpLsKTR mRm2fdAUG/UleWTCpjNZRgio0kH2i/vkCVihQW1OcOJEQ8wzYISNv3I/CtEp3nF7hGsz t97WAMKMdUGO6a3M+EQJhl+qs9N+s7g7xgPCPu4xInhhxhSl1t+Sj3GqwFRQcNT6Un4+ BC2ka1OgA9pbdQqlk6s0GGDRV7fN7NTNKrVHaozMj6xGVjPCYZPWX4j2M1KMUvVzR3Zy zmKPFHQi8HovBaLdY7hg8gWW7Ml+FygXl5RhDtAYQmu8GfwRsS2vQZN8tT1bfesQlxmL MB2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=auifDQ3WYAPOy0MfUAtIqVXPEcRI9G/z3ApGDahvzlA=; b=zraw2JMEYcsQTl49Vk7Ps7BDoAXtfnHmDpf9aEgjqqpb6RRsVIssmUlqn0o3MVzzse ugw5G4P7Pha0jpyJl5rrTBOhWAbPr1EJvcfE5h6m4k3Yd0oBbQXGp2BoYc+Kx/O1ITlY VMrjyffTBd4evi2IVi8pQSFQ8THJSJzkEhbu6rfQb8jBOxjgF1TP6oDP2zkbLI7F25Ll lcNCQv2ps6lxK8s37W7JcWUfSved6hzLvQynnF4SMLImtZ6Gny99/GKS7fIZ8tFMJGoB oePqRWBk3pGUYawHmkYOLTxlrMRO7B6yEzsWUP8tDfuGa4saK2rAzBSqmIr08nhH0VQv 1lrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si916050eja.422.2020.10.14.16.03.06; Wed, 14 Oct 2020 16:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731097AbgJNNHF (ORCPT + 99 others); Wed, 14 Oct 2020 09:07:05 -0400 Received: from smtp.h3c.com ([60.191.123.50]:42096 "EHLO h3cspam02-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbgJNNHF (ORCPT ); Wed, 14 Oct 2020 09:07:05 -0400 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([10.8.0.66]) by h3cspam02-ex.h3c.com with ESMTPS id 09ED6ZUb097099 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Oct 2020 21:06:35 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from localhost.localdomain (10.99.212.201) by DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 14 Oct 2020 21:06:38 +0800 From: Xianting Tian To: CC: , , Xianting Tian Subject: [PATCH] blk-mq: add helper function to test hctx inactive Date: Wed, 14 Oct 2020 20:56:48 +0800 Message-ID: <20201014125648.13778-1-tian.xianting@h3c.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.99.212.201] X-ClientProxiedBy: BJSMTP01-EX.srv.huawei-3com.com (10.63.20.132) To DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) X-DNSRBL: X-MAIL: h3cspam02-ex.h3c.com 09ED6ZUb097099 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce helper function blk_mq_hctx_inactive() to test BLK_MQ_S_INACTIVE as we already done for BLK_MQ_S_STOPPED. Signed-off-by: Xianting Tian --- block/blk-mq-tag.c | 2 +- block/blk-mq.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 32d82e23b..3119572bc 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -153,7 +153,7 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data) * Give up this allocation if the hctx is inactive. The caller will * retry on an active hctx. */ - if (unlikely(test_bit(BLK_MQ_S_INACTIVE, &data->hctx->state))) { + if (unlikely(blk_mq_hctx_inactive(data->hctx))) { blk_mq_put_tag(tags, data->ctx, tag + tag_offset); return BLK_MQ_NO_TAG; } diff --git a/block/blk-mq.h b/block/blk-mq.h index 863a2f334..9813269c2 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -171,6 +171,11 @@ static inline bool blk_mq_hctx_stopped(struct blk_mq_hw_ctx *hctx) return test_bit(BLK_MQ_S_STOPPED, &hctx->state); } +static inline bool blk_mq_hctx_inactive(struct blk_mq_hw_ctx *hctx) +{ + return test_bit(BLK_MQ_S_INACTIVE, &hctx->state); +} + static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx) { return hctx->nr_ctx && hctx->tags; -- 2.17.1