mkfs.f2fs: show bytes for total_sectors
PATCH 1/3 mkfs.f2fs: show bytes for total_sectors
This patch shows correct information about total_sectors.
Signed-off-by Jaegeuk Kim <[email protected]>
--- lib/libf2fs.c | 4 ++-- mkfs/f2fs_format_main.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
lib/libf2fs.c +2 -2
@@ -497,8 +497,8 @@ int f2fs_get_device_info(struct f2fs_configuration *c) }MSG (0 ,"Info: sector size = %u\n" , c->sector_size); -MSG (0 ,"Info: total sectors = %" PRIu64" (in %u bytes)\n" , - c->total_sectors, c->sector_size); +MSG (0 ,"Info: total sectors = %" PRIu64" (%" PRIu64" MB)\n" , + c->total_sectors, c->total_sectors >>11 );if (c->total_sectors < (F2FS_MIN_VOLUME_SIZE / c->sector_size)) { MSG(0, "Error: Min volume size supported is %d\n",
mkfs/f2fs_format_main.c +3 -2
@@ -103,8 +103,9 @@ static void f2fs_parse_options(int argc, char *argv[])if ((optind +1 ) < argc) {/* We have a sector count. */ config.total_sectors =atoll (argv[optind+1 ]); -MSG (0 ,"\ttotal_sectors=%08" PRIx64" (%s bytes)\n" , - config.total_sectors, argv[optind+1 ]); +MSG (1 ,"\ttotal_sectors=%" PRIx64" (%" PRIx64" bytes)\n" , + config.total_sectors, + config.total_sectors *512 ); } config.reserved_segments =
Signature · 9 lines
2.1.1 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
PATCH 2/3 fsck.f2fs: show cp_state for fsck.f2fs
This patch adds to show cp_state during fsck.f2fs.
Signed-off-by Jaegeuk Kim <[email protected]>
--- fsck/f2fs.h | 1 - fsck/fsck.h | 1 + fsck/main.c | 21 +++++---------------- fsck/mount.c | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 17 deletions(-)
fsck/f2fs.h +0 -1
@@ -159,7 +159,6 @@ struct f2fs_sb_info {u32 s_next_generation;/* for NFS support */ unsigned int cur_victim_sec;/* current victim section num */ - };static inline struct f2fs_super_block *F2FS_RAW_SUPER (struct f2fs_sb_info *sbi)
fsck/fsck.h +1 -0
@@ -96,6 +96,7 @@ extern int fsck_chk_dentry_blk(struct f2fs_sb_info *, u32, u32 *, u32 *, int);int fsck_chk_inline_dentries (struct f2fs_sb_info *,struct f2fs_node *,u32 *,u32 *); +void print_cp_state (u32 );extern void print_node_info (struct f2fs_node *);extern void print_inode_info (struct f2fs_inode *,int );extern struct seg_entry *get_seg_entry (struct f2fs_sb_info *,unsigned int );
fsck/main.c +5 -16
@@ -140,10 +140,14 @@ void f2fs_parse_options(int argc, char *argv[])static void do_fsck (struct f2fs_sb_info *sbi) { +struct f2fs_checkpoint *ckpt =F2FS_CKPT (sbi); +u32 flag =le32_to_cpu (ckpt->ckpt_flags);u32 blk_cnt;fsck_init (sbi); +print_cp_state (flag); +fsck_chk_orphan_node (sbi);/* Traverse all block recursively from root inode */
@@ -175,22 +179,7 @@ static void do_dump(struct f2fs_sb_info *sbi) goto cleanup; } -MSG (0 ,"Info: checkpoint state = %x : " , flag); -if (flag &CP_FSCK_FLAG ) -MSG (0 ,"%s" ," fsck" ); -if (flag &CP_ERROR_FLAG ) -MSG (0 ,"%s" ," error" ); -if (flag &CP_COMPACT_SUM_FLAG ) -MSG (0 ,"%s" ," compacted_summary" ); -if (flag &CP_ORPHAN_PRESENT_FLAG ) -MSG (0 ,"%s" ," orphan_inodes" ); -if (flag &CP_FASTBOOT_FLAG ) -MSG (0 ,"%s" ," fastboot" ); -if (flag &CP_UMOUNT_FLAG ) -MSG (0 ,"%s" ," unmount" ); -else -MSG (0 ,"%s" ," sudden-power-off" ); -MSG (0 ,"\n" ); +print_cp_state (flag);dump_node (sbi, opt->nid); cleanup:
fsck/mount.c +20 -0
@@ -204,6 +204,26 @@ void print_ckpt_info(struct f2fs_sb_info *sbi)printf ("\n\n" ); } +void print_cp_state (u32 flag) +{ +MSG (0 ,"Info: checkpoint state = %x : " , flag); +if (flag &CP_FSCK_FLAG ) +MSG (0 ,"%s" ," fsck" ); +if (flag &CP_ERROR_FLAG ) +MSG (0 ,"%s" ," error" ); +if (flag &CP_COMPACT_SUM_FLAG ) +MSG (0 ,"%s" ," compacted_summary" ); +if (flag &CP_ORPHAN_PRESENT_FLAG ) +MSG (0 ,"%s" ," orphan_inodes" ); +if (flag &CP_FASTBOOT_FLAG ) +MSG (0 ,"%s" ," fastboot" ); +if (flag &CP_UMOUNT_FLAG ) +MSG (0 ,"%s" ," unmount" ); +else +MSG (0 ,"%s" ," sudden-power-off" ); +MSG (0 ,"\n" ); +} +int sanity_check_raw_super (struct f2fs_super_block *raw_super) {unsigned int blocksize;
Signature · 9 lines
2.1.1 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
PATCH 3/3 fsck.f2fs: show total sectors consumed by filesystem
In reply to Jaegeuk KimThis patch shows the information about the number of total sectors composing filesystem.
Signed-off-by Jaegeuk Kim <[email protected]>
--- fsck/mount.c | 6 ++++++ 1 file changed, 6 insertions(+)
fsck/mount.c +6 -0
@@ -312,6 +312,7 @@ int validate_super_block(struct f2fs_sb_info *sbi, int block)int init_sb_info (struct f2fs_sb_info *sbi) {struct f2fs_super_block *raw_super = sbi->raw_super; +u64 total_sectors; sbi->log_sectors_per_block =le32_to_cpu (raw_super->log_sectors_per_block);
@@ -329,6 +330,11 @@ int init_sb_info(struct f2fs_sb_info *sbi) sbi->node_ino_num =le32_to_cpu (raw_super->node_ino); sbi->meta_ino_num =le32_to_cpu (raw_super->meta_ino); sbi->cur_victim_sec =NULL_SEGNO ; + + total_sectors =le64_to_cpu (raw_super->block_count) << + sbi->log_sectors_per_block; +MSG (0 ,"Info: total FS sectors = %" PRIu64" (%" PRIu64" MB)\n" , + total_sectors, total_sectors >>11 );return 0 ; }
Signature · 9 lines
2.1.1 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/