Linux-f2fs-devel Archive mirror
 help / color / mirror / Atom feed
From: Sheng Yong via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jaegeuk@kernel.org, chao@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] f2fs-tools: print extension list properly
Date: Mon,  8 Apr 2024 21:11:40 +0800	[thread overview]
Message-ID: <20240408131140.4100090-1-shengyong@oppo.com> (raw)

The "hot file extensions" list does not print properly.

**Before**

extension_count                         [0x      23 : 35]
cold file extentsions
                                        [mp      wm      og      jp      ]
                                        [avi     m4v     m4p     mkv     ]
                                        [mov     webm    wav     m4a     ]
                                        [3gp     opus    flac    gif     ]
                                        [png     svg     webp    jar     ]
                                        [deb     iso     gz      xz      ]
                                        [zst     pdf     pyc     ttc     ]
                                        [ttf     exe     apk     cnt     ]
                                        [exo     odex    vdex    ]
hot_ext_count                           [0x       1 : 1]
hot file extentsions
db      ]
cp_payload                              [0x       0 : 0]

**After**

extension_count                         [0x      23 : 35]
cold file extentsions
                                        [mp      wm      og      jp      ]
                                        [avi     m4v     m4p     mkv     ]
                                        [mov     webm    wav     m4a     ]
                                        [3gp     opus    flac    gif     ]
                                        [png     svg     webp    jar     ]
                                        [deb     iso     gz      xz      ]
                                        [zst     pdf     pyc     ttc     ]
                                        [ttf     exe     apk     cnt     ]
                                        [exo     odex    vdex            ]
hot_ext_count                           [0x       1 : 1]
hot file extentsions
                                        [db                              ]
cp_payload                              [0x       0 : 0]

Signed-off-by: Sheng Yong <shengyong@oppo.com>
---
 fsck/mount.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index b983920..8524335 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -429,20 +429,26 @@ void print_extention_list(struct f2fs_super_block *sb, int cold)
 
 	printf("%s file extentsions\n", cold ? "cold" : "hot");
 
-	for (i = start; i < end; i++) {
+	for (i = 0; i < end - start; i++) {
 		if (c.layout) {
 			printf("%-30s %-8.8s\n", "extension_list",
-						sb->extension_list[i]);
+					sb->extension_list[start + i]);
 		} else {
 			if (i % 4 == 0)
 				printf("%-30s\t\t[", "");
 
-			printf("%-8.8s", sb->extension_list[i]);
+			printf("%-8.8s", sb->extension_list[start + i]);
 
-			if (i % 4 == 4 - 1 || i == end - start - 1)
+			if (i % 4 == 4 - 1)
 				printf("]\n");
 		}
 	}
+
+	for (; i < round_up(end - start, 4) * 4; i++) {
+		printf("%-8.8s", "");
+		if (i % 4 == 4 - 1)
+			printf("]\n");
+	}
 }
 
 static void DISP_label(const char *name)
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

             reply	other threads:[~2024-04-08 13:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 13:11 Sheng Yong via Linux-f2fs-devel [this message]
2024-04-09  3:26 ` [f2fs-dev] [PATCH] f2fs-tools: print extension list properly Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240408131140.4100090-1-shengyong@oppo.com \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=shengyong@oppo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).