mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 01:59:54 +00:00
mkfs.f2fs: adjust zone alignment when using multi-partitions
commit 316e128fe3
category: bugfix
issue: #I6VAS0
CVE: NA
Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------
When formatting conventional partition with zoned one, we should align
the starting block address of next device to the zone size.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
parent
3a346afe9f
commit
153382836d
@ -256,14 +256,22 @@ static int f2fs_prepare_super_block(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c.zoned_mode && c.ndevs > 1)
|
||||
zone_align_start_offset +=
|
||||
(c.devices[0].total_sectors * c.sector_size) % zone_size_bytes;
|
||||
|
||||
set_sb(segment0_blkaddr, zone_align_start_offset / blk_size_bytes);
|
||||
sb->cp_blkaddr = sb->segment0_blkaddr;
|
||||
|
||||
MSG(0, "Info: zone aligned segment0 blkaddr: %u\n",
|
||||
get_sb(segment0_blkaddr));
|
||||
|
||||
if (c.zoned_mode && (get_sb(segment0_blkaddr) + c.start_sector /
|
||||
DEFAULT_SECTORS_PER_BLOCK) % c.zone_blocks) {
|
||||
if (c.zoned_mode &&
|
||||
((c.ndevs == 1 &&
|
||||
(get_sb(segment0_blkaddr) + c.start_sector /
|
||||
DEFAULT_SECTORS_PER_BLOCK) % c.zone_blocks) ||
|
||||
(c.ndevs > 1 &&
|
||||
c.devices[1].start_blkaddr % c.zone_blocks))) {
|
||||
MSG(1, "\tError: Unaligned segment0 block address %u\n",
|
||||
get_sb(segment0_blkaddr));
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user