f2fs-tools: introduce f2fs_update_sparse_file()
PATCH v3 2/2 f2fs-tools: introduce f2fs_update_sparse_file()
This patch fixes to initialize NAT/SIT/CP.payload region in sparse file mode for fsck/sload/resize/defrag/dump tools.
Signed-off-by Chao Yu <[email protected]>
---
v3:
- print message after variable assignment.
- use DEFAULT_BLOCKS_PER_SEGMENT instead of get_sb(log_blocks_per_seg).
fsck/fsck.h | 1 + fsck/main.c | 5 +++ fsck/mount.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/libf2fs_io.c | 9 ------ 4 files changed, 88 insertions(+), 9 deletions(-)
fsck/fsck.h +1 -0
@@ -181,6 +181,7 @@ extern int fsck_verify(struct f2fs_sb_info *);extern void fsck_free (struct f2fs_sb_info *);extern int f2fs_do_mount (struct f2fs_sb_info *);extern void f2fs_do_umount (struct f2fs_sb_info *); +extern int f2fs_update_sparse_file (struct f2fs_sb_info *);extern void flush_journal_entries (struct f2fs_sb_info *);extern void zero_journal_entries (struct f2fs_sb_info *);
fsck/main.c +5 -0
@@ -845,6 +845,11 @@ retry: goto fsck_again; } } + + ret =f2fs_update_sparse_file (sbi); +if (ret <0 ) +return ret; + ret =f2fs_finalize_device ();if (ret <0 )return ret;
fsck/mount.c +82 -0
85 lines not on this page · raw message
lib/libf2fs_io.c +0 -9
@@ -358,15 +358,6 @@ int f2fs_finalize_device(void)int64_t chunk_start = (blocks[0 ] ==NULL ) ?-1 :0 ;uint64_t j; -if (c.func !=MKFS ) { -sparse_file_destroy (f2fs_sparse_file); - ret =ftruncate (c.devices[0 ].fd,0 ); -ASSERT (!ret); -lseek (c.devices[0 ].fd,0 ,SEEK_SET ); - f2fs_sparse_file =sparse_file_new (F2FS_BLKSIZE , - c.device_size); - } -for (j =0 ; j < blocks_count; ++j) {if (chunk_start !=-1 ) {if (j - chunk_start >=MAX_CHUNK_COUNT ) {
Signature · 1 line
2.18.0.rc1