Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3748569rwa; Tue, 23 Aug 2022 09:26:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR5HpyunyBq4bqDNa7McYLPP0FhJLAy9aXMll54tjhWgRx2NPxumEza2uNEUFUS2HzV1jjl8 X-Received: by 2002:a17:902:7796:b0:172:c716:d3ac with SMTP id o22-20020a170902779600b00172c716d3acmr18740933pll.137.1661272014396; Tue, 23 Aug 2022 09:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661272014; cv=none; d=google.com; s=arc-20160816; b=0HqrCmP51xANeofT/ceTq3jsPPwb8zoJy/fPPbdZG3FUhyuQ1guFsz2/9jDa21V4hZ SDaIMKSjd0bJsg5lKncOqEwh+ZbpW3Re/BVh0pNvvqkLEC1g9uw4WxQiK5Y8KeeU927R 7E0YXCtTPaCqkCI0iBMDEsiNrt2vILvPVx3Y3oa2L5hNZ6qvFfKZa+pyzJXzM8nLZH/w GldBJZJrrOyvEo9sR7Eiw0sVSRko2hel/0q8lN2F4FesGLc72rOY4W/rEsd/HLrwZ3ho NXIen0i7pYX7TlB4fbaRvum6esMtR+odvAtbfVAwsbIqIkmwRrYd+nNbFdO1DwmXzrh/ yOJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=6P1R/E9YGiOBn04IzPo5prb2SpaL2SRQk5AKU4iXtGo=; b=PAus1aS/drozfOByA1ujZrNQWavSrR1iSsq6D7/qSfslfliO4c9aQQ51uqiYm8C8BI Y1/NJm2V2Wq7R9gTBnT3vgW5f9pm0+rHNB5yrUEU8MngDonsZfnm/TlwxicQyEwXdWER rpUGBldIG6mM+2Fv2GvhMosGCP6UeK13kMrVfRtxqRlbK0f3INktw0NnsdmB/2giLZjW rcqTy8VvVJQ2aCCyXM9nSoPnne+pCX5VkeitwzeWBczdXKesxwgmpNKRVCD1zJ8GAm+r SsJ13NYS/Pm7O4e6R6XbiheNy5CNzpnyCsZm9gYXOXC5KkAs9UKmkjOQNm5FpE32UijV RO3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QeHS5rKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a1709026ac400b00170a89f32ccsi14830080plt.131.2022.08.23.09.26.43; Tue, 23 Aug 2022 09:26:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QeHS5rKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244655AbiHWQRE (ORCPT + 99 others); Tue, 23 Aug 2022 12:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244512AbiHWQQW (ORCPT ); Tue, 23 Aug 2022 12:16:22 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E05E32E083 for ; Tue, 23 Aug 2022 05:37:37 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220823121905euoutp0262bbd72fc39524e351ad42cea87eb3ae~N_JKREv6m2185121851euoutp02O for ; Tue, 23 Aug 2022 12:19:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220823121905euoutp0262bbd72fc39524e351ad42cea87eb3ae~N_JKREv6m2185121851euoutp02O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1661257145; bh=6P1R/E9YGiOBn04IzPo5prb2SpaL2SRQk5AKU4iXtGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QeHS5rKgu0j20EdL4dm7Hsc12Lz1jmX0rDcJU5/xjr6N62JWeqQmAQ5jhg8+JNItp vtOHVNRtZ0kNajkgf8O23jlGeoQ6+kdIDFfthXPTbiLaTG5CfbwSOA4klvADgCBVUF HR3F1Flgj1bLUpruGneAt0AzVu+hLs1JPmaMcO/0= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220823121904eucas1p21882ea32eaa14c1822e3cc091f51cfe0~N_JIrXXlB1780717807eucas1p2i; Tue, 23 Aug 2022 12:19:04 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 46.82.29727.8B5C4036; Tue, 23 Aug 2022 13:19:04 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220823121903eucas1p230518b312d5260d28e356ba911a27469~N_JIAX5Sx2020620206eucas1p2N; Tue, 23 Aug 2022 12:19:03 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220823121903eusmtrp14bf9acadd2de37d63b4d534af5195731~N_JH-ndbR1042010420eusmtrp11; Tue, 23 Aug 2022 12:19:03 +0000 (GMT) X-AuditID: cbfec7f2-21dff7000001741f-75-6304c5b86dd9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4E.71.10862.7B5C4036; Tue, 23 Aug 2022 13:19:03 +0100 (BST) Received: from localhost (unknown [106.210.248.52]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220823121903eusmtip21130b9482eb3022901311def411bb039~N_JHsahh32346623466eusmtip2C; Tue, 23 Aug 2022 12:19:03 +0000 (GMT) From: Pankaj Raghav To: agk@redhat.com, snitzer@kernel.org, axboe@kernel.dk, damien.lemoal@opensource.wdc.com, hch@lst.de Cc: pankydev8@gmail.com, Johannes.Thumshirn@wdc.com, linux-block@vger.kernel.org, dm-devel@redhat.com, hare@suse.de, jaegeuk@kernel.org, linux-kernel@vger.kernel.org, matias.bjorling@wdc.com, gost.dev@samsung.com, bvanassche@acm.org, linux-nvme@lists.infradead.org, Pankaj Raghav Subject: [PATCH v12 02/13] block:rearrange bdev_{is_zoned,zone_sectors,get_queue} helpers in blkdev.h Date: Tue, 23 Aug 2022 14:18:48 +0200 Message-Id: <20220823121859.163903-3-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220823121859.163903-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djP87o7jrIkG3ybzm2x/tQxZovVd/vZ LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i /rKn7BYT2r4yW3xe2sJusebmUxaLE7ekHQQ9Ll/x9tg56y67x+WzpR6bVnWyeWxeUu+x+2YD m8fO1vusHu/3XWXz6NuyitFj8+lqj8+b5DzaD3QzBfBEcdmkpOZklqUW6dslcGWsPHKJpeCF aMWT05fYGhhnC3UxcnJICJhIPH35mRnEFhJYwSix6F8JhP2FUeJqh34XI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g56y67x+WzpR6bVnWyeWxeUu+x+2YD m8fO1vusHu/3XWXz6NuyitFj8+lqj8+b5DzaD3QzBfBE6dkU5ZeWpCpk5BeX2CpFG1oY6Rla WugZmVjqGRqbx1oZmSrp29mkpOZklqUW6dsl6GWsPHKJpeCFaMWT05fYGhhnC3UxcnJICJhI bG86ytTFyMUhJLCUUeL9hfXsEAkJidsLmxghbGGJP9e62CCKnjFKbN/+kqWLkYODTUBLorET rF5EIFfi8OYJYIOYBY4wSaxuXMsKkhAWSJXYefsY2CAWAVWJg5O+gsV5BawkFt37wwKxQF5i 5qXvYIM4Bawl5i09BVYvBFQz/9YnNoh6QYmTM5+A1TMD1Tdvnc08gVFgFpLULCSpBYxMqxhF UkuLc9Nzi430ihNzi0vz0vWS83M3MQJjdtuxn1t2MK589VHvECMTB+MhRgkOZiUR3uqLDMlC vCmJlVWpRfnxRaU5qcWHGE2B7p7ILCWanA9MGnkl8YZmBqaGJmaWBqaWZsZK4ryeBR2JQgLp iSWp2ampBalFMH1MHJxSDUyL67UEN+tPbficdih617b1IrnJfHY5Jx9JsPY9u6LgnjAtUdjq 1lyBniNPdulOmzbHzUxJTn1W1DrBLFOVcE9X1utJKid+GM09k8kz85fWxt6P3fMEVv1pZwzd 7R1jt7cuhEWd8dIxdb1H6b8W+ObomnYYdp9ak+Znlnbo2c/vIckffHccYHH/6eBSl8SbOMXU c9JbnrX2KjfWJ79irEl+f0llouiBLRv/PDTtUROap+op/mta+/Egp4I3rJyCPyT3t+7MVOm+ qne6dk3+7087H8l8ePHJ9urCxkXCp/3b1pdV9P1UORE6k3u+n4FwVYGb5iE1+/8Xtp5J5L78 uC3iwpuP2y/sN2ZafLrsRKoSS3FGoqEWc1FxIgCJP07aYgMAAA== X-CMS-MailID: 20220823121903eucas1p230518b312d5260d28e356ba911a27469 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220823121903eucas1p230518b312d5260d28e356ba911a27469 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220823121903eucas1p230518b312d5260d28e356ba911a27469 References: <20220823121859.163903-1-p.raghav@samsung.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Define bdev_is_zoned(), bdev_zone_sectors() and bdev_get_queue() earlier in the blkdev.h include file. Simplify bdev_is_zoned() by removing the superfluous NULL check for request queue while we are at it. This commit has no functional change, and it is a prep patch for allowing zoned devices with non-power-of-2 zone sizes in the block layer. Signed-off-by: Pankaj Raghav Reviewed-by: Damien Le Moal --- include/linux/blkdev.h | 43 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ab82d1ff0cce..84e7881262e3 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -635,6 +635,11 @@ static inline bool queue_is_mq(struct request_queue *q) return q->mq_ops; } +static inline struct request_queue *bdev_get_queue(struct block_device *bdev) +{ + return bdev->bd_queue; /* this is never NULL */ +} + #ifdef CONFIG_PM static inline enum rpm_status queue_rpm_status(struct request_queue *q) { @@ -666,6 +671,20 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) } } +static inline bool bdev_is_zoned(struct block_device *bdev) +{ + return blk_queue_is_zoned(bdev_get_queue(bdev)); +} + +static inline sector_t bdev_zone_sectors(struct block_device *bdev) +{ + struct request_queue *q = bdev_get_queue(bdev); + + if (!blk_queue_is_zoned(q)) + return 0; + return q->limits.chunk_sectors; +} + #ifdef CONFIG_BLK_DEV_ZONED static inline unsigned int disk_nr_zones(struct gendisk *disk) { @@ -892,11 +911,6 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags); int iocb_bio_iopoll(struct kiocb *kiocb, struct io_comp_batch *iob, unsigned int flags); -static inline struct request_queue *bdev_get_queue(struct block_device *bdev) -{ - return bdev->bd_queue; /* this is never NULL */ -} - /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */ const char *blk_zone_cond_str(enum blk_zone_cond zone_cond); @@ -1296,25 +1310,6 @@ static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev) return BLK_ZONED_NONE; } -static inline bool bdev_is_zoned(struct block_device *bdev) -{ - struct request_queue *q = bdev_get_queue(bdev); - - if (q) - return blk_queue_is_zoned(q); - - return false; -} - -static inline sector_t bdev_zone_sectors(struct block_device *bdev) -{ - struct request_queue *q = bdev_get_queue(bdev); - - if (!blk_queue_is_zoned(q)) - return 0; - return q->limits.chunk_sectors; -} - static inline int queue_dma_alignment(const struct request_queue *q) { return q ? q->dma_alignment : 511; -- 2.25.1