mkfs.f2fs: trim all the devices except the first one
PATCH 1/1 mkfs.f2fs: trim all the devices except the first one
We need to check the first disk only, and trim the other disks.
--- mkfs/f2fs_format_utils.c | 4 ++++ 1 file changed, 4 insertions(+)
mkfs/f2fs_format_utils.c +4 -0
@@ -129,6 +129,10 @@ static bool is_wiped_device(int i)int nblocks =4096 ;/* 16MB size */ int j; +/* let's trim the other devices except the first device */ +if (i >0 ) +return false; + buf =malloc (F2FS_BLKSIZE );if (buf ==NULL ) {MSG (1 ,"\tError: Malloc Failed for buf!!!\n" );
Signature · 8 lines
2.39.1.519.gcb327c4b5f-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 1 line · Jaegeuk Kim
We need to check the first disk only, and trim the other disks.
I'm confused, why we don't need to trim first disk?
Thanks,
Quoted 11 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- mkfs/f2fs_format_utils.c | 4 ++++ 1 file changed, 4 insertions(+)mkfs/f2fs_format_utils.c +0
-0
mkfs/f2fs_format_utils.c static bool is_wiped_device(int i) · line 138
Quoted 10 lines
mkfs/f2fs_format_utils.c +4
-0@@ -129,6 +129,10 @@ static bool is_wiped_device(int i)int nblocks =4096 ;/* 16MB size */ int j; +/* let's trim the other devices except the first device */ +if (i >0 ) +return false; + buf =malloc (F2FS_BLKSIZE );if (buf ==NULL ) {MSG (1 ,"\tError: Malloc Failed for buf!!!\n" );
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 4 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim
We need to check the first disk only, and trim the other disks.
I'm confused, why we don't need to trim first disk?
dd9c372646ed ("mkfs.f2fs: check zeros in first 16MB for Android")
- We actually don't need to issue trim on entire disk by checking first blocks having zeros.
This is what Android checks when to decide format as we expect the first disk was supposed to have a written superblock. That's not for secondary disk and so on.
Quoted 9 lines
Thanks,
Quoted 6 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- mkfs/f2fs_format_utils.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 14 lines
Quoted 5 lines
mkfs/f2fs_format_utils.c +0
-0mkfs/f2fs_format_utils.c static bool is_wiped_device(int i) · line 137
Quoted 9 lines
mkfs/f2fs_format_utils.c +4
-0@@ -129,6 +129,10 @@ static bool is_wiped_device(int i)int nblocks =4096 ;/* 16MB size */ int j; +/* let's trim the other devices except the first device */ +if (i >0 ) +return false; + buf =malloc (F2FS_BLKSIZE );if (buf ==NULL ) {MSG (1 ,"\tError: Malloc Failed for buf!!!\n" );
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel