Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4720729ioa; Wed, 27 Apr 2022 09:37:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUMPPRvj9qN7LvWTxQKdFQGXxXE4/cDSl5aHRZjHWBsxxi7rNr1uoY34WWcBTjvGftTQu8 X-Received: by 2002:a63:286:0:b0:3ab:971a:eb4c with SMTP id 128-20020a630286000000b003ab971aeb4cmr6969907pgc.105.1651077476007; Wed, 27 Apr 2022 09:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651077476; cv=none; d=google.com; s=arc-20160816; b=wDvphuAgyhXyYNg5Qw2g+N3QcKNHgg2gT4wN6eQQUVfS4rboPyaFwjLbxUso5Xb2WY blnq9OSZoq3CBFVzULdS6pa2rxe17zBlkn4MFSHYgXgV+J5n6isAV5/Ioo15APQplcd4 zVaQJLTRsx104MDCcw7ua27pYDhoNVrJzDST44SJN8zwvahBzcivf+Z4q7/+xih4yZYL Vd6Lsk6HRU6Y6iwBCilvId6DokQXxbVJoWjBC09guOvkmP1yqqTc+xW4Kl5TUnv1WYDS Q1B39qjBUAy17s/LFGOaAF9ELsIL5H3on82GwPp9V3O7IwPNC/OR89PWkhQK9okbI1jZ cKLA== 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=a76qyKknkM0wvqdFNEHw+s8BT16u2uGhpV7aO9NKOYY=; b=wriI+fQg6ChO8ZwnKa5qhU5vfMPA2lHV5SAUtxQFWY1Na3vz7l13KivUPVAoFBL5S4 xfkKJZ1h5FfQhjZQlzAY/L5yzTiXsimCQujIjIuNKWm4dSumjh4jzaaR79tJLVC/Yziw XyCe+1Ul0F30aJUmLFb6s7RnoovZCLsziQdFkcmRS1Eai+CYQb5035K4fjhBI93b2zYT vlSgJHdtTYKCqq1u1658KEpnXd+22NaA/HyoC3zMTtuotU9jNCIAXIWEx89sdgm8pAPg 2vyEmzccNtU+K0Lb/F034b+JAX0cv6CGpcUqk0d8rvR51hOxs1OHWMHXlbS1w9HmLUft qB4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="uTmyJt/F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h1-20020a63e141000000b003986443b1f0si1975854pgk.832.2022.04.27.09.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 09:37:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="uTmyJt/F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E8BA485959; Wed, 27 Apr 2022 09:07:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241818AbiD0QKC (ORCPT + 99 others); Wed, 27 Apr 2022 12:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241857AbiD0QHb (ORCPT ); Wed, 27 Apr 2022 12:07:31 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D313A3CF57C for ; Wed, 27 Apr 2022 09:03:19 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220427160313euoutp02ddd1e98ed746b29525c72af62b1e3f00~pzFKML7TV1400814008euoutp02C for ; Wed, 27 Apr 2022 16:03:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220427160313euoutp02ddd1e98ed746b29525c72af62b1e3f00~pzFKML7TV1400814008euoutp02C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1651075393; bh=a76qyKknkM0wvqdFNEHw+s8BT16u2uGhpV7aO9NKOYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTmyJt/Fj7B4+/K/zKEUMK6Ipat+TX8HPxfYnEo40bgAUnZbIsbpsqzG5w9+P2wVG TRJQ+J0CtnKw4bAxDzstGzuT7ljO7vhp4g1vXOvaydPr2cFfbL34VktgitNST7VJd0 0cjytuutkeUKGQMoeGLw6Zp66yTyHmeihbn02hnY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220427160311eucas1p292a05a97a5799178d307b83156d7614c~pzFInhDTQ0627806278eucas1p2B; Wed, 27 Apr 2022 16:03:11 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 46.14.09887.F3969626; Wed, 27 Apr 2022 17:03:11 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220427160311eucas1p151141fc73adc590b40ad6f935b1ac214~pzFIDq05j2685026850eucas1p1l; Wed, 27 Apr 2022 16:03:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220427160311eusmtrp19ad138dbf7fe61a8204739883754e403~pzFICnC7Y2142221422eusmtrp1I; Wed, 27 Apr 2022 16:03:11 +0000 (GMT) X-AuditID: cbfec7f4-45bff7000000269f-66-6269693f394f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F9.A7.09404.E3969626; Wed, 27 Apr 2022 17:03:10 +0100 (BST) Received: from localhost (unknown [106.210.248.162]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220427160310eusmtip1f0d4275814b6fa6855728a90524835ba~pzFHtPgBm1783517835eusmtip1O; Wed, 27 Apr 2022 16:03:10 +0000 (GMT) From: Pankaj Raghav To: jaegeuk@kernel.org, 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 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, Pankaj Raghav Subject: [PATCH 14/16] f2fs: call bdev_zone_sectors() only once on init_blkz_info() Date: Wed, 27 Apr 2022 18:02:53 +0200 Message-Id: <20220427160255.300418-15-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427160255.300418-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0xTVxzOuef2tnSrXKqZZ8iyUbYs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x8TBKdXAtKfn//y8 /uJTqw+fsrirF7fqvdE3B42bVc5X82SyOFT4M+SP8m91/mrY9/Op6sbdO7sm9t4Qil4s5l64 UmnjntXTbM+9vnze5eQnkfKyjZe3WIQ6uu6W7n5zuWRW6Zk/0yY1/dzU4c2w3CHMiE9swo5M qbDrLy683XZWfZnuqSkfFjPfbdsX9UdRRcGIX0/0BluZX/cZH44VwilTVV/8XL2uMrruopIx n5SOldf0VV4NNxPT5N8uMLtUGvdAZV7Q5CXmL5tqtI4FxFZkXdozjeHW1Ec9ezUOf5y1xlgn oszwi7JpXoxPnErd79RHPCqd9y6Ub47n91vsUL9gT9S9tpsMUVwXt6vuE+jTrzslqcRSnJFo qMVcVJwIAAeEaE6wAwAA X-CMS-MailID: 20220427160311eucas1p151141fc73adc590b40ad6f935b1ac214 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220427160311eucas1p151141fc73adc590b40ad6f935b1ac214 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220427160311eucas1p151141fc73adc590b40ad6f935b1ac214 References: <20220427160255.300418-1-p.raghav@samsung.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE 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 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