mkfs.f2fs: ensure zone size is equal or bigger than segment size
PATCH v2 1/1 mkfs.f2fs: ensure zone size is equal or bigger than segment size
From: Daeho Jeong <[email protected]>
Otherwise, it doesn't work with a crash.
---
v2: relocate the code
--- lib/libf2fs.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/libf2fs.c +5 -0
@@ -1347,6 +1347,11 @@ int f2fs_get_f2fs_info(void) } c.zone_blocks = c.devices[i].zone_blocks; } +if (c.zone_blocks <DEFAULT_BLOCKS_PER_SEGMENT ) { +MSG (0 ,"\tError: zone size should not be less " +"than segment size\n" ); +return -1 ; + }/* * Align sections to the device zone size and align F2FS zones
Signature · 1 line
2.49.0.1151.ga128411c76-goog
Quoted 16 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
Otherwise, it doesn't work with a crash.
Signed-off-by Daeho Jeong <[email protected]>---
v2: relocate the code--- lib/libf2fs.c | 5 +++++ 1 file changed, 5 insertions(+)lib/libf2fs.c +0
-0
lib/libf2fs.c int f2fs_get_f2fs_info(void) · line 1350
Quoted 4 lines
lib/libf2fs.c +1
-0@@ -1347,6 +1347,11 @@ int f2fs_get_f2fs_info(void) } c.zone_blocks = c.devices[i].zone_blocks; } +if (c.zone_blocks <DEFAULT_BLOCKS_PER_SEGMENT ) {
If c.zone_blocks can not be aligned to DEFAULT_BLOCKS_PER_SEGMENT, do we need to handle below code?
/*
* Align sections to the device zone size and align F2FS zones
* to the device zones. For F2FS_ZONED_HA model without the
* BLKZONED feature set at format time, this is only an
* optimization as sequential writes will not be enforced. */
c.segs_per_sec = c.zone_blocks / DEFAULT_BLOCKS_PER_SEGMENT;
Thanks,
Quoted 7 lines
lib/libf2fs.c +4
-0+MSG (0 ,"\tError: zone size should not be less " +"than segment size\n" ); +return -1 ; + }/* * Align sections to the device zone size and align F2FS zones
Quoted 13 lines · Chao Yu
Quoted 11 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
Otherwise, it doesn't work with a crash.
Signed-off-by Daeho Jeong <[email protected]>---
v2: relocate the code--- lib/libf2fs.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 12 lines
lib/libf2fs.c int f2fs_get_f2fs_info(void) · line 1350
Quoted 9 lines
lib/libf2fs.c +1
-0@@ -1347,6 +1347,11 @@ int f2fs_get_f2fs_info(void) } c.zone_blocks = c.devices[i].zone_blocks; } +if (c.zone_blocks <DEFAULT_BLOCKS_PER_SEGMENT ) {If c.zone_blocks can not be aligned to
DEFAULT_BLOCKS_PER_SEGMENT, do we need to handle below code?
We need to make sure that c.zone_blocks is a multiple of DEFAULT_BLOCKS_PER_SEGMENT, right?
Quoted 19 lines
/*
* Align sections to the device zone size and align F2FS zones
* to the device zones. ForF2FS_ZONED_HAmodel without the
* BLKZONED feature set at format time, this is only an
* optimization as sequential writes will not be enforced. */
c.segs_per_sec = c.zone_blocks /DEFAULT_BLOCKS_PER_SEGMENT;Thanks,
Quoted 7 lines
lib/libf2fs.c +4
-0+MSG (0 ,"\tError: zone size should not be less " +"than segment size\n" ); +return -1 ; + }/* * Align sections to the device zone size and align F2FS zones
Quoted 27 lines · Daeho Jeong
Quoted 13 lines · Chao Yu
Quoted 11 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
Otherwise, it doesn't work with a crash.
Signed-off-by Daeho Jeong <[email protected]>---
v2: relocate the code--- lib/libf2fs.c | 5 +++++ 1 file changed, 5 insertions(+)Quoted 12 lines
lib/libf2fs.c int f2fs_get_f2fs_info(void) · line 1350
Quoted 9 lines
lib/libf2fs.c +1
-0@@ -1347,6 +1347,11 @@ int f2fs_get_f2fs_info(void) } c.zone_blocks = c.devices[i].zone_blocks; } +if (c.zone_blocks <DEFAULT_BLOCKS_PER_SEGMENT ) {If c.zone_blocks can not be aligned to
DEFAULT_BLOCKS_PER_SEGMENT, do we need to handle below code?
Quoted 2 lines
We need to make sure that c.zone_blocks is a multiple of
DEFAULT_BLOCKS_PER_SEGMENT, right?
Yes, if c.zone_blocks % DEFAULT_BLOCKS_PER_SEGMENT is true, we should fail mkfs?
Thanks,
Quoted 20 lines
Quoted 20 lines
/*
* Align sections to the device zone size and align F2FS zones
* to the device zones. ForF2FS_ZONED_HAmodel without the
* BLKZONED feature set at format time, this is only an
* optimization as sequential writes will not be enforced. */
c.segs_per_sec = c.zone_blocks /DEFAULT_BLOCKS_PER_SEGMENT;Thanks,
Quoted 7 lines
lib/libf2fs.c +4
-0+MSG (0 ,"\tError: zone size should not be less " +"than segment size\n" ); +return -1 ; + }/* * Align sections to the device zone size and align F2FS zones