ANDROID: f2fs: Fix the calculation of the number of zones

Commit b50e6a61bb ("ANDROID: Revert "f2fs: ensure only power of 2 zone
sizes are allowed"") did not update all code that assumes that the zone
size is a power of two. Hence this (untested) patch.

This issue was discovered by running the following grep command:

    git grep -nH ' & .*zone.*- 1'

Bug: 269471019
Change-Id: I9aa4cd1e621f34ed774d89d4f9763981c4b95f50
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2023-10-26 11:15:37 -07:00
parent 2eb175772d
commit 858e65da9c

View File

@@ -3814,7 +3814,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
sbi->blocks_per_blkz = SECTOR_TO_BLOCK(zone_sectors);
FDEV(devi).nr_blkz = div_u64(SECTOR_TO_BLOCK(nr_sectors),
sbi->blocks_per_blkz);
if (nr_sectors & (zone_sectors - 1))
if (!bdev_is_zone_start(bdev, nr_sectors))
FDEV(devi).nr_blkz++;
FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi,