Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp859296ybh; Tue, 10 Mar 2020 09:33:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvqMVfQFfHXy5lzHPGzZ2UdmW5BoSrS2Y4RUOtb5STdvGMnxhxq6KECuaZDQ98ZMvt5rAiv X-Received: by 2002:aca:1a06:: with SMTP id a6mr1735277oia.148.1583858034842; Tue, 10 Mar 2020 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583858034; cv=none; d=google.com; s=arc-20160816; b=gK2LjyVZ6t8ljjL9mP4uPdYUV2u/UI80bCTBQMMbizgrpy2H/UNF8MnWmfSbNCEVzt bSwW39sRjpECRkxNgLjXOPdOnh+uAgqe91gDXNZVf/odj62PAL33APtKEYPMrpy8k4Y2 cTeboM84wg/7+AG6dDCK26eRhPBN9y8RNP43MrKmbgFfqc1KujmV7x5eO6vwq4j/NABP 9O5WpKrp7t6dWNpnmWG8ozxsT/8+uDaNea8W2pIDI2EklJYxDsI52j8YualY6f5Puak1 vf7t1cKqNn0LW9dibVrmPwUS79tGOBMvgPk2TCtze7Eofp/IfKJerstzoW577niCnW2B /MUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=WF/CZV880g4Vs9Wmtpwiq/xqRMCF1HgUJ5XrJ7JW/eQ=; b=IvZEcUqMZf8C3Ae3RpcKbWsKgufdy1aZU+xgXyv6d8BKGRVHQmj8cEXmjaAYl+lPfN k2pENCFNNtKmqUFrdJ7rj6hp4j366n06/UDjHeqbrSIzgXXD2gaRd9wrNsWH0Ur/abvy 6WWmxbShXaNS+u1+NaNIQ8IEQLp7MaCUaXAunUp0hC6Rav91Blajmowata5Mi+D6E9+W JUd/riu+5/YGFwMAowVwL0craLpGmuO/MunBJQ/s5comNdknxY8rLJ4wlcxbP76iSy2/ PZX0KxDXHqY5B5GDHBmKITNupMxckuu2mtvq0CZLhyGovCaV+cZxR0yLhRDOkDCbqCmp VUYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si5809126otp.314.2020.03.10.09.33.43; Tue, 10 Mar 2020 09:33:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727662AbgCJQb6 (ORCPT + 99 others); Tue, 10 Mar 2020 12:31:58 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35668 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727075AbgCJQao (ORCPT ); Tue, 10 Mar 2020 12:30:44 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EE4AD346438384E4A2EA; Wed, 11 Mar 2020 00:30:33 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 11 Mar 2020 00:30:24 +0800 From: John Garry To: , , , , , , CC: , , , , , , Hannes Reinecke Subject: [PATCH RFC v2 03/24] blk-mq: Implement blk_mq_rq_is_reserved() Date: Wed, 11 Mar 2020 00:25:29 +0800 Message-ID: <1583857550-12049-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1583857550-12049-1-git-send-email-john.garry@huawei.com> References: <1583857550-12049-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke Add function to check if a blk-mq request is from the reserved pool Signed-off-by: Hannes Reinecke --- block/blk-mq.c | 13 +++++++++++++ include/linux/blk-mq.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index d92088dec6c3..603c60a1956c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -269,6 +269,19 @@ static inline bool blk_mq_need_time_stamp(struct request *rq) return (rq->rq_flags & (RQF_IO_STAT | RQF_STATS)) || rq->q->elevator; } +/** + * blk_mq_rq_is_reserved - Check if a request has a reserved tag + * + * @rq: Request to check + */ +bool blk_mq_rq_is_reserved(struct request *rq) +{ + struct blk_mq_hw_ctx *hctx = rq->mq_hctx; + + return blk_mq_tag_is_reserved(hctx->tags, rq->tag); +} +EXPORT_SYMBOL_GPL(blk_mq_rq_is_reserved); + static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, unsigned int tag, unsigned int op, u64 alloc_time_ns) { diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 11cfd6470b1a..8bdc35ac4a63 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -548,6 +548,8 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq) return rq + 1; } +bool blk_mq_rq_is_reserved(struct request *rq); + #define queue_for_each_hw_ctx(q, hctx, i) \ for ((i) = 0; (i) < (q)->nr_hw_queues && \ ({ hctx = (q)->queue_hw_ctx[i]; 1; }); (i)++) -- 2.17.1