From patchwork Tue Jun 15 13:10:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12321275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F5BC49361 for ; Tue, 15 Jun 2021 13:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C628161474 for ; Tue, 15 Jun 2021 13:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbhFONPS (ORCPT ); Tue, 15 Jun 2021 09:15:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbhFONPR (ORCPT ); Tue, 15 Jun 2021 09:15:17 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9740FC061574; Tue, 15 Jun 2021 06:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=3sOwq+hqsIfCtHmI5VnrHqoqQW8aTy8WBTV/xW+v+Bk=; b=bnb8QT4UHLQhJGkaqMTFBoiFpx a9rPxgo3Faux9TOqGsa0OTMsF1U6PvoDaASJjHvYrKyscSkAL0HBO6pitNdBdi2y09PNy9dPzM8vo t1iV++71R/G20TOwCqBopxX5izHqs8dSWYc0FhHQ21tkKhzY6TWsUXqxnulGH10h3ns0XZoQzPIdR FlrNs+ACEDu056gTlk+ZsDPlZcHb16jY3GkDrHFSRPVpuOWMGtgMkG8O7MBuzDNYqPnGIlXcw3CRa sfnibKRGUgj2PjcOgojqMq2vamktny8X5djk1ZMGK2dp2+ClyR/ymMCpYHq0vM8lTWE30xcNgopk7 zP3FXntA==; Received: from [2001:4bb8:19b:fdce:9045:1e63:20f0:ca9] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lt8rV-006nFt-4u; Tue, 15 Jun 2021 13:12:30 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Jeffle Xu , Ming Lei , Damien Le Moal , Keith Busch , Sagi Grimberg , "Wunderlich, Mark" , "Vasudevan, Anil" , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nvme@lists.infradead.org Subject: [PATCH 06/16] blk-mq: remove blk_qc_t_to_tag and blk_qc_t_is_internal Date: Tue, 15 Jun 2021 15:10:24 +0200 Message-Id: <20210615131034.752623-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210615131034.752623-1-hch@lst.de> References: <20210615131034.752623-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Merge both functions into their only caller to keep the blk-mq tag to blk_qc_t mapping as private as possible in blk-mq.c. Signed-off-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Tested-by: Mark Wunderlich --- block/blk-mq.c | 8 +++++--- include/linux/blk_types.h | 10 ---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index f4bb6e1db36a..eb861839ff49 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -72,9 +72,11 @@ static inline struct blk_mq_hw_ctx *blk_qc_to_hctx(struct request_queue *q, static inline struct request *blk_qc_to_rq(struct blk_mq_hw_ctx *hctx, blk_qc_t qc) { - if (blk_qc_t_is_internal(qc)) - return blk_mq_tag_to_rq(hctx->sched_tags, blk_qc_t_to_tag(qc)); - return blk_mq_tag_to_rq(hctx->tags, blk_qc_t_to_tag(qc)); + unsigned int tag = qc & ((1U << BLK_QC_T_SHIFT) - 1); + + if (qc & BLK_QC_T_INTERNAL) + return blk_mq_tag_to_rq(hctx->sched_tags, tag); + return blk_mq_tag_to_rq(hctx->tags, tag); } /* diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index e2c4a7d5de05..abe00ac81b2e 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -511,16 +511,6 @@ static inline bool blk_qc_t_valid(blk_qc_t cookie) return cookie != BLK_QC_T_NONE; } -static inline unsigned int blk_qc_t_to_tag(blk_qc_t cookie) -{ - return cookie & ((1u << BLK_QC_T_SHIFT) - 1); -} - -static inline bool blk_qc_t_is_internal(blk_qc_t cookie) -{ - return (cookie & BLK_QC_T_INTERNAL) != 0; -} - struct blk_rq_stat { u64 mean; u64 min;