[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YnGKuET79JQ+ssPp@google.com>
Date: Tue, 3 May 2022 13:04:08 -0700
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: Pankaj Raghav <p.raghav@...sung.com>
Cc: axboe@...nel.dk, snitzer@...nel.org, hch@....de, mcgrof@...nel.org,
naohiro.aota@....com, sagi@...mberg.me,
damien.lemoal@...nsource.wdc.com, dsterba@...e.com,
johannes.thumshirn@....com, linux-kernel@...r.kernel.org,
linux-btrfs@...r.kernel.org, clm@...com, gost.dev@...sung.com,
chao@...nel.org, linux-f2fs-devel@...ts.sourceforge.net,
josef@...icpanda.com, jonathan.derrick@...ux.dev, agk@...hat.com,
kbusch@...nel.org, kch@...dia.com, linux-nvme@...ts.infradead.org,
dm-devel@...hat.com, bvanassche@....org, jiangbo.365@...edance.com,
linux-fsdevel@...r.kernel.org, matias.bjorling@....com,
linux-block@...r.kernel.org
Subject: Re: [PATCH 14/16] f2fs: call bdev_zone_sectors() only once on
init_blkz_info()
Applied to f2fs tree. Thanks,
On 04/27, Pankaj Raghav wrote:
> From: Luis Chamberlain <mcgrof@...nel.org>
>
> 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 <mcgrof@...nel.org>
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
> ---
> 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
Powered by blists - more mailing lists