Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp518216iob; Wed, 4 May 2022 01:53:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnNZ2fSOeR6OCkW+MYEQmwgrtJ1JhARHb5vmmnnxWYk8pOmxYIbGqh1Mw1RirmkZFw2187 X-Received: by 2002:a17:906:a089:b0:6ef:e9e6:1368 with SMTP id q9-20020a170906a08900b006efe9e61368mr19154429ejy.626.1651654401346; Wed, 04 May 2022 01:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651654401; cv=none; d=google.com; s=arc-20160816; b=ZiWAz74Gj/u6bv/0RHmfNSPLLPlcYsuWhjpcNn8ffufs+aVneNffGdYUWELXlPqbaN s3oFBS/H5RLKB165sagYKgAIL5HSReoIrDPvaLmsg7pxwZIpk9EYZZ6CfKlUlCOAVMNh TueNjQ7L9wI/E6IXiUTvymmoJvLWE4Pk1Ii09O4ToATze8dhElYCbZzANQFywjmz7Ck0 TTvJFMjYsz9GBOoXy/bwzIWptigAwMswCYO25cxvX8aSkAmHfDrrRZSydPO1rOJB7xVb pcnuGa/fudcN6WC6eDm1GB3neUE0F4Fm5V+k5k567gFmkKsEgp/eBWzDcevMBUyRJWGp RuwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mbnLZXvmjiUydw6XV2zP4n7v0/cS2cpfMEj9/h01KLs=; b=oQxxA55WMgUfNiiHf3tW34pjOVUMXQjYMY4muKNy+KVzkjcRm6LkkXfeqrSHf8ZwvG kDm4YHNPkeSbZHAeyNmBZjWAF6Of4HdGibPsZhNwF+swOE3IRxqt9IGv8a9MmUfGFvYY nM2sqgkytu8xNqhW8ccbdIcGK+A7qB/RzxhSx0Jnxs4bRtQE5KAabEL7ks3CBJGm48lj ecrUAMqJv1yUgnV8NvV9JO7CQz9mIwNRTGv0qUrJmpJqDgpSzmtBw2x7TVJmt/ZDi96N xSyhiRoCSHZ2NmvY7r8rC1cyud3j/3IZ5hRaYoHFHOCa8L+UzA/YP+jzWm4UDa2ymJu+ R2qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GI4PqtOA; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a1709060ad000b006f01fd542c2si15258830ejf.606.2022.05.04.01.52.57; Wed, 04 May 2022 01:53:21 -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=@kernel.org header.s=k20201202 header.b=GI4PqtOA; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236959AbiECUHs (ORCPT + 99 others); Tue, 3 May 2022 16:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236354AbiECUHq (ORCPT ); Tue, 3 May 2022 16:07:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93517403CC; Tue, 3 May 2022 13:04:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F6BCB82062; Tue, 3 May 2022 20:04:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21F65C385A4; Tue, 3 May 2022 20:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651608251; bh=yEwIKUkYrUe+UB4k6sDSTOcJaUQFRLK0s3/p+P/axO8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GI4PqtOAj9PMvq17VbxQwejZWyW9waSFBPKixzYGnlcgVZKbWRTtbDsNIZZwaqgJW oRbRzsBLXIeXqedBxITy5sBQxpsdE8I0dm3cEPiXGUZcnaeNIQ12WIBdr1DNLQll1t +pUS07koL10aaZ31K0ZVF/uLZ+EZZBoxW+DCQadgwgerGjiYcHn3UgSgB4OcJyJiYe i6tehN8h7cCda5ctDbs17t6pRzGracdobePQtcHkfSJEEz+G6rES43RSs+L4zfA7c4 iHfsO8Ek/+4eQNxEj3/7v/WG9g0aL4gDw9K4vOzjBpm1V5OnkKQ8fUIpjm9PDrF8aA kouE3UjVHDJkQ== Date: Tue, 3 May 2022 13:04:08 -0700 From: Jaegeuk Kim To: Pankaj Raghav Cc: axboe@kernel.dk, snitzer@kernel.org, hch@lst.de, mcgrof@kernel.org, naohiro.aota@wdc.com, sagi@grimberg.me, damien.lemoal@opensource.wdc.com, dsterba@suse.com, johannes.thumshirn@wdc.com, 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 Subject: Re: [PATCH 14/16] f2fs: call bdev_zone_sectors() only once on init_blkz_info() Message-ID: References: <20220427160255.300418-1-p.raghav@samsung.com> <20220427160255.300418-15-p.raghav@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220427160255.300418-15-p.raghav@samsung.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Applied to f2fs tree. Thanks, On 04/27, Pankaj Raghav wrote: > From: Luis Chamberlain > > Instead of calling bdev_zone_sectors() multiple times, call > it once and cache the value locally. This will make the > subsequent change easier to read. > > Signed-off-by: Luis Chamberlain > Signed-off-by: Pankaj Raghav > --- > fs/f2fs/super.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index ea939db18f88..f64761a15df7 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -3678,22 +3678,25 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) > struct block_device *bdev = FDEV(devi).bdev; > sector_t nr_sectors = bdev_nr_sectors(bdev); > struct f2fs_report_zones_args rep_zone_arg; > + u64 zone_sectors; > int ret; > > if (!f2fs_sb_has_blkzoned(sbi)) > return 0; > > + zone_sectors = bdev_zone_sectors(bdev); > + > if (sbi->blocks_per_blkz && sbi->blocks_per_blkz != > - SECTOR_TO_BLOCK(bdev_zone_sectors(bdev))) > + SECTOR_TO_BLOCK(zone_sectors)) > return -EINVAL; > - sbi->blocks_per_blkz = SECTOR_TO_BLOCK(bdev_zone_sectors(bdev)); > + sbi->blocks_per_blkz = SECTOR_TO_BLOCK(zone_sectors); > if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz != > __ilog2_u32(sbi->blocks_per_blkz)) > return -EINVAL; > sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz); > FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >> > sbi->log_blocks_per_blkz; > - if (nr_sectors & (bdev_zone_sectors(bdev) - 1)) > + if (nr_sectors & (zone_sectors - 1)) > FDEV(devi).nr_blkz++; > > FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi, > -- > 2.25.1