All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mkfs.f2fs: show bytes for total_sectors
@ 2015-03-21  6:06 Jaegeuk Kim
  2015-03-21  6:06 ` [PATCH 2/3] fsck.f2fs: show cp_state for fsck.f2fs Jaegeuk Kim
  2015-03-21  6:06 ` [PATCH 3/3] fsck.f2fs: show total sectors consumed by filesystem Jaegeuk Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2015-03-21  6:06 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch shows correct information about total_sectors.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 lib/libf2fs.c           | 4 ++--
 mkfs/f2fs_format_main.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 9e19e9b..7fd2550 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -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",
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index bba2085..aefe9fc 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -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  =
-- 
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/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] fsck.f2fs: show cp_state for fsck.f2fs
  2015-03-21  6:06 [PATCH 1/3] mkfs.f2fs: show bytes for total_sectors Jaegeuk Kim
@ 2015-03-21  6:06 ` Jaegeuk Kim
  2015-03-21  6:06 ` [PATCH 3/3] fsck.f2fs: show total sectors consumed by filesystem Jaegeuk Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2015-03-21  6:06 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch adds to show cp_state during fsck.f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fsck/f2fs.h  |  1 -
 fsck/fsck.h  |  1 +
 fsck/main.c  | 21 +++++----------------
 fsck/mount.c | 20 ++++++++++++++++++++
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/fsck/f2fs.h b/fsck/f2fs.h
index c268f15..709fbf3 100644
--- a/fsck/f2fs.h
+++ b/fsck/f2fs.h
@@ -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)
diff --git a/fsck/fsck.h b/fsck/fsck.h
index 9cad013..98425c6 100644
--- a/fsck/fsck.h
+++ b/fsck/fsck.h
@@ -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);
diff --git a/fsck/main.c b/fsck/main.c
index 3606f62..16fab9c 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -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:
diff --git a/fsck/mount.c b/fsck/mount.c
index 6d96db8..879cadb 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -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;
-- 
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/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] fsck.f2fs: show total sectors consumed by filesystem
  2015-03-21  6:06 [PATCH 1/3] mkfs.f2fs: show bytes for total_sectors Jaegeuk Kim
  2015-03-21  6:06 ` [PATCH 2/3] fsck.f2fs: show cp_state for fsck.f2fs Jaegeuk Kim
@ 2015-03-21  6:06 ` Jaegeuk Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2015-03-21  6:06 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch shows the information about the number of total sectors composing
filesystem.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fsck/mount.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fsck/mount.c b/fsck/mount.c
index 879cadb..dfaa596 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -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;
 }
 
-- 
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/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-21  6:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-21  6:06 [PATCH 1/3] mkfs.f2fs: show bytes for total_sectors Jaegeuk Kim
2015-03-21  6:06 ` [PATCH 2/3] fsck.f2fs: show cp_state for fsck.f2fs Jaegeuk Kim
2015-03-21  6:06 ` [PATCH 3/3] fsck.f2fs: show total sectors consumed by filesystem Jaegeuk Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.