Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp303431iob; Thu, 28 Apr 2022 02:46:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4055JpblF95nebqPu2QJEiMTd6eZWSajrIVXk7y3lgQjAH8/8+oM8qro0+rRRjdueJ3xd X-Received: by 2002:a17:90b:390e:b0:1d9:b7fc:7a77 with SMTP id ob14-20020a17090b390e00b001d9b7fc7a77mr13556851pjb.191.1651139218036; Thu, 28 Apr 2022 02:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651139218; cv=none; d=google.com; s=arc-20160816; b=xcxMFSAN7cCiZfxuSoesLMRPYKC3BVF4xm7e3HVN3t9IQG919URx7RttDdxAQ/W//H 7qrkuZU6+Xhg8gET7NzJitTxqY/FRSHEOtWP07wICJPOuJWCDC2hJjovO7Brz9BkMKR3 nPLuOOMvtbhn8Jvz3kImRnuH7V7uS4XMPXpQrSlTHKFqEPSoSXhYGwNDEIcgET2MO/5H PHKSbtv5kJwZ+1K98zzUOxyZYotK+1svlNTIvmpENFaRMaOAbHh0zqhpK8F/nF+PuYMN asRgK7yKf76PjjIv1X3gObxZrE7B4KPYEmSOabkCpqNPlIL7wDd0H7fjuZPznKXjPL43 DfxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=PnDK63gcXNRgV//CCqerJpeFWxiM6q0NYD5whOcQOd0=; b=Oc8XFacY84QQ3UZMwblJPGbsVND9lcmM5QmkBXdwpGLP0IjlWrKg62Kp7lXrA6lA0s oVvXRQGUKM1T9y2yQmHObzlp//OTxRQwwIix7cIxzECs5tt6RJrbMeewNgupthc7apjV aysuvZv0LaE72l61Mc0/zdQA3/1os7xtY5HXZ7QD36KpWJhmFv3WIme4dWklIsOJiYWk Kdy3jzFTPxS+jjT+juWyxnSva3sOvjSRvR6Ge44y+uJnV7giBj60Z6ht2VzpI2oXrQjm vERXYQTQQwvKY+s0JqtOVaLpfvz/dU0rFl2PP4EzxNLhb15uUFfxsSbYgbdIMu63brFD E+fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=UxwxbAqs; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=PdTQSxxj; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w127-20020a628285000000b0050d2398a2b9si3675176pfd.221.2022.04.28.02.46.43; Thu, 28 Apr 2022 02:46:58 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=UxwxbAqs; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=PdTQSxxj; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbiD0Xe6 (ORCPT + 99 others); Wed, 27 Apr 2022 19:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbiD0Xez (ORCPT ); Wed, 27 Apr 2022 19:34:55 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7570124BE0 for ; Wed, 27 Apr 2022 16:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1651102303; x=1682638303; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=gLrzp6duhkPkV6taMyjQM6C7cL2l+fGNVwimG4CXPYA=; b=UxwxbAqsimwtwGRnt2pWvurMD3DKCoV4txQE4Qikvpz85X7zOij+G24A dYV++q3vdl/S2zGz6mPwlw3o1/RtH7HvwCa8ouDXOzPy5ELiBfrGDraa5 0IEkT469+4ei67t8VBwIsBWL/yl4idrCL8X5+UMrjkWDN7PpE8s48Oelk dKvPifu1CsGXUvSNt9jqMqul96gf8TVr+kGYhrqXORkDwY1Ul++seufeB A/JxKLXZLOAx/MnYVHvYl+cijAIq2sAxagbSzApTmD7WDYoJAKe05MPUl XYGG4e2PKccIJv7SwaS6GVdic4zJzXC/F+hBMZqGIb/GzXxXUbWLc+b4N A==; X-IronPort-AV: E=Sophos;i="5.90,294,1643644800"; d="scan'208";a="197843992" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 28 Apr 2022 07:31:41 +0800 IronPort-SDR: u5zRuMAHLRXyvomKiQ/A2Iidcd56TFdqTVBQmQTRb4Ch4keX4cjmaiiZb26t+Hm9c0D15zmJ0G xVoCotHvbYT9A+kjqOBo4xLapn9dBtxncwCIid8EUmPD4q3K5QQ2KNWnXDRPdlTZsgr3B8t40U /FBmAy0ANxRrNUFw7KMpieJmk2PTdquzSALt7CZhNCNwsvBz9Ywmr913BQ7kwWUq5C/e6ljlKc 11kffB9YdCSZY1vKcJj6FdY+uuMmUvd5oBu8wR6nS3FvdV/9bQm1hbehWGf062kKGExihuIb1g Jg/2Z0W84eJ0watfW6pKBP+D Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Apr 2022 16:01:50 -0700 IronPort-SDR: g8ONq31hVr5ZR9+jpOUGm0xDQDqFKLkeoj8UjaIII0lLAFM1RE55MRctFc8W/q/iFcprb0xxbz on7XKVTdIz15VjMAlcQcqbdAITZJPjuS1bCHf9Uy6jtrV7SI5uVgDYpuIhlJmu0DVQB1cFfUeO UDAbj7lZB7Q7r7lPpuCLWqQBxPt9QxsZNc3ye0kXNGeooDD4muH2jxAEWjcg+S64J3BWOku5L6 976t52EvVVYakl7NKXJ+bgBqHHDB5IMy5L8RK8P5ekp2oBisumVtZYrkLpc4Gzaoyf+g/Wdr+j 5kI= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Apr 2022 16:31:41 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KpZlJ5Lpjz1SHwl for ; Wed, 27 Apr 2022 16:31:40 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1651102299; x=1653694300; bh=gLrzp6duhkPkV6taMyjQM6C7cL2l+fGNVwi mG4CXPYA=; b=PdTQSxxj3EOLpYEGcnBYVKUPguXiBCCpr5ymI7+k28TTGz3mfSs KbvC8k3lhS5m6XprU6x/phnhFmDH5Zdpl9mtNhPvxWLwoLZA79RJ39tzK0T66DJg cQ1J9s5aD6mTMKCIx7SKO/H0j3TVPipsOior8762yACFqgZPSPwSaryNVkrWfY9P vFK6Qn1Dlh6ebNdzrLYEPjfHxjH1TIuA8nWpktFuNYhAu/AUjrulRyzZmZH+ftr1 f82lyX/KB3APT/Gb/yPBy31svE2vEO1vB1f3Yyd5uBMXra+42NUkawZ+Cd66ga7/ bklmIOigH4dlDMngOOGM9ReZ0ePeHAN6LGA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9T_Ych45457I for ; Wed, 27 Apr 2022 16:31:39 -0700 (PDT) Received: from [10.225.163.27] (unknown [10.225.163.27]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KpZlB5PzJz1Rvlc; Wed, 27 Apr 2022 16:31:34 -0700 (PDT) Message-ID: <652c33b5-1d85-e356-05b9-7bd84b768143@opensource.wdc.com> Date: Thu, 28 Apr 2022 08:31:33 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 03/16] block: add bdev_zone_no helper Content-Language: en-US To: Pankaj Raghav , jaegeuk@kernel.org, axboe@kernel.dk, snitzer@kernel.org, hch@lst.de, mcgrof@kernel.org, naohiro.aota@wdc.com, sagi@grimberg.me, dsterba@suse.com, johannes.thumshirn@wdc.com Cc: linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, clm@fb.com, gost.dev@samsung.com, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, josef@toxicpanda.com, jonathan.derrick@linux.dev, agk@redhat.com, kbusch@kernel.org, kch@nvidia.com, linux-nvme@lists.infradead.org, dm-devel@redhat.com, bvanassche@acm.org, jiangbo.365@bytedance.com, linux-fsdevel@vger.kernel.org, matias.bjorling@wdc.com, linux-block@vger.kernel.org References: <20220427160255.300418-1-p.raghav@samsung.com> <20220427160255.300418-4-p.raghav@samsung.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220427160255.300418-4-p.raghav@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 On 4/28/22 01:02, Pankaj Raghav wrote: > Many places in the filesystem for zoned devices open code this function > to find the zone number for a given sector with power of 2 assumption. > This generic helper can be used to calculate zone number for a given > sector in a block device > > This helper internally uses blk_queue_zone_no to find the zone number. > > Reviewed-by: Luis Chamberlain > Signed-off-by: Pankaj Raghav > --- > include/linux/blkdev.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index f8f2d2998afb..55293e0a8702 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1392,6 +1392,15 @@ static inline bool bdev_zone_aligned(struct block_device *bdev, sector_t sec) > return false; > } > > +static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec) > +{ > + struct request_queue *q = bdev_get_queue(bdev); > + > + if (q) q is never NULL. So this can be simplified to: return blk_queue_zone_no(bdev_get_queue(bdev), sector); > + return blk_queue_zone_no(q, sec); > + return 0; > +} > + > static inline unsigned int bdev_max_open_zones(struct block_device *bdev) > { > struct request_queue *q = bdev_get_queue(bdev); -- Damien Le Moal Western Digital Research