Skip to contentSkip to conversation

f2fs: format segment_info's show for better legibility

PATCH In review Gu Zheng 2 participants 4 messages Mar 7, 2014 – Mar 17, 2014 F2FS file system

lore
Share & tools
lore

Gu Zheng

author
#0 lore raw

PATCH 3/5 f2fs: format segment_info's show for better legibility

The original segment_info's show is a bit out-of-format:

[root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1 [root@guz Demoes]#

so we fix it here for better legibility. [root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1
[root@guz Demoes]#

---
 fs/f2fs/super.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/super.c +4 -3
index 72df734..6e4851c 100644
@@ -546,11 +546,12 @@ static int segment_info_seq_show(struct seq_file *seq, void *offset)
 
 	for (i = 0; i < total_segs; i++) {
 		seq_printf(seq, "%u", get_valid_blocks(sbi, i, 1));
-		if (i != 0 && (i % 10) == 0)
-			seq_puts(seq, "\n");
+		if ((i % 10) == 9 || i == (total_segs - 1))
+			seq_putc(seq, '\n');
 		else
-			seq_puts(seq, " ");
+			seq_putc(seq, ' ');
 	}
+
 	return 0;
 }
 
Signature · 1 line
1.7.7
Reviewed-by on v1 3/5
#1 lore raw

Hi Gu,

Quoted 17 lines

-----Original Message-----
From: Gu Zheng [mailto:[email protected]]
Sent: Friday, March 07, 2014 6:44 PM
To: Kim
Cc: linux-kernel; f2fs
Subject: [f2fs-dev] [PATCH 3/5] f2fs: format segment_info's show for better legibility

The original segment_info's show is a bit out-of-format:

[root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1 [root@guz Demoes]#

Quoted 9 lines

so we fix it here for better legibility. [root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1
[root@guz Demoes]#

Here is one case, this looks not legible.

0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 509 512 512 512
512 512 512 512 512 512 512 512 512 512
512 512 512 512 331 278 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 512 512 512
512 512 512 512 512 512 512 512 512 512
0 512 512 512 512 512 512 1 0 512

So how about modifying code as following?

Quoted 2 lines

fs/f2fs/super.c static int segment_info_seq_show(struct seq_file *seq, void *offset) · line 548

Quoted 12 lines
---
 fs/f2fs/super.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/super.c +0 -0
index 72df734..6e4851c 100644
@@ -546,11 +546,12 @@ static int segment_info_seq_show(struct seq_file *seq, void *offset)
 
 	for (i = 0; i < total_segs; i++) {
 		seq_printf(seq, "%u", get_valid_blocks(sbi, i, 1));
		seq_printf(seq, "%-3u ", get_valid_blocks(sbi, i, 1));
Quoted 26 lines
fs/f2fs/super.c +4 -4
-		if (i != 0 && (i % 10) == 0)
-			seq_puts(seq, "\n");
+		if ((i % 10) == 9 || i == (total_segs - 1))
+			seq_putc(seq, '\n');
 		else
-			seq_puts(seq, " ");
+			seq_putc(seq, ' ');
 	}
+
 	return 0;
 }
 
--

1.7.7

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#2 lore raw

Hi,

Quoted 62 lines · Chao Yu

Hi Gu,

Quoted 17 lines

-----Original Message-----
From: Gu Zheng [mailto:[email protected]]
Sent: Friday, March 07, 2014 6:44 PM
To: Kim
Cc: linux-kernel; f2fs
Subject: [f2fs-dev] [PATCH 3/5] f2fs: format segment_info's show for better legibility

The original segment_info's show is a bit out-of-format:

[root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1 [root@guz Demoes]#

Quoted 9 lines

so we fix it here for better legibility. [root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1
[root@guz Demoes]#

Here is one case, this looks not legible.

0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 509 512 512 512
512 512 512 512 512 512 512 512 512 512
512 512 512 512 331 278 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 512 512 512
512 512 512 512 512 512 512 512 512 512
0 512 512 512 512 512 512 1 0 512

So how about modifying code as following?

Quoted 2 lines
Quoted 10 lines
---
 fs/f2fs/super.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/super.c +0 -0
index 72df734..6e4851c 100644
@@ -546,11 +546,12 @@ static int segment_info_seq_show(struct seq_file *seq, void *offset)
 
Quoted 4 lines

fs/f2fs/super.c static int segment_info_seq_show(struct seq_file *seq, void *offset) · line 548

Quoted 2 lines
fs/f2fs/super.c +0 -0
 	for (i = 0; i < total_segs; i++) {
 		seq_printf(seq, "%u", get_valid_blocks(sbi, i, 1));
		seq_printf(seq, "%-3u ", get_valid_blocks(sbi, i, 1));

Hmm, this patch has been applied to f2fs-dev tree, so maybe you can send a patch to enhance it directly!:)

Regards,
Gu

Quoted 29 lines
Quoted 27 lines
fs/f2fs/super.c +4 -4
-		if (i != 0 && (i % 10) == 0)
-			seq_puts(seq, "\n");
+		if ((i % 10) == 9 || i == (total_segs - 1))
+			seq_putc(seq, '\n');
 		else
-			seq_puts(seq, " ");
+			seq_putc(seq, ' ');
 	}
+
 	return 0;
 }
 
--

1.7.7

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw

Hi Gu,

Quoted 72 lines

-----Original Message-----
From: Gu Zheng [mailto:[email protected]]
Sent: Thursday, March 13, 2014 5:58 PM
To: Chao Yu
Cc: 'Kim'; 'linux-kernel'; 'f2fs'
Subject: Re: [f2fs-dev] [PATCH 3/5] f2fs: format segment_info's show for better legibility

Hi,

Quoted 62 lines · Chao Yu

Hi Gu,

Quoted 17 lines

-----Original Message-----
From: Gu Zheng [mailto:[email protected]]
Sent: Friday, March 07, 2014 6:44 PM
To: Kim
Cc: linux-kernel; f2fs
Subject: [f2fs-dev] [PATCH 3/5] f2fs: format segment_info's show for better legibility

The original segment_info's show is a bit out-of-format:

[root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1 [root@guz Demoes]#

Quoted 9 lines

so we fix it here for better legibility. [root@guz Demoes]# cat /proc/fs/f2fs/loop0/segment_info 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
......
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1
[root@guz Demoes]#

Here is one case, this looks not legible.

0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 509 512 512 512
512 512 512 512 512 512 512 512 512 512
512 512 512 512 331 278 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 512 512 512
512 512 512 512 512 512 512 512 512 512
0 512 512 512 512 512 512 1 0 512

So how about modifying code as following?

Quoted 2 lines
Quoted 10 lines
---
 fs/f2fs/super.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/super.c +0 -0
index 72df734..6e4851c 100644
@@ -546,11 +546,12 @@ static int segment_info_seq_show(struct seq_file *seq, void *offset)
 
Quoted 7 lines
Quoted 4 lines

fs/f2fs/super.c static int segment_info_seq_show(struct seq_file *seq, void *offset) · line 548

Quoted 2 lines
fs/f2fs/super.c +0 -0
 	for (i = 0; i < total_segs; i++) {
 		seq_printf(seq, "%u", get_valid_blocks(sbi, i, 1));
		seq_printf(seq, "%-3u ", get_valid_blocks(sbi, i, 1));

Hmm, this patch has been applied to f2fs-dev tree, so maybe you can send a patch to enhance it directly!:)

Alright, I will send another patch to fix it. :)
Thanks.

Quoted 33 lines

Regards,
Gu

Quoted 29 lines
Quoted 27 lines
fs/f2fs/super.c +4 -4
-		if (i != 0 && (i % 10) == 0)
-			seq_puts(seq, "\n");
+		if ((i % 10) == 9 || i == (total_segs - 1))
+			seq_putc(seq, '\n');
 		else
-			seq_puts(seq, " ");
+			seq_putc(seq, ' ');
 	}
+
 	return 0;
 }
 
--

1.7.7

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel