diff mbox series

[1/2] xfs_io: only print the header once when dumping fsmap in csv format

Message ID 162528109507.38807.485600723669552708.stgit@locust (mailing list archive)
State Superseded
Headers show
Series xfs_io: small fixes to fsmap command | expand

Commit Message

Darrick J. Wong July 3, 2021, 2:58 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Only print the column names once when we're dumping fsmap information in
csv format.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 io/fsmap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig July 5, 2021, 3:21 p.m. UTC | #1
On Fri, Jul 02, 2021 at 07:58:15PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Only print the column names once when we're dumping fsmap information in
> csv format.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/io/fsmap.c b/io/fsmap.c
index 4b217595..9f179fa8 100644
--- a/io/fsmap.c
+++ b/io/fsmap.c
@@ -116,7 +116,8 @@  dump_map_machine(
 	struct fsmap		*p;
 	char			*fork;
 
-	printf(_("EXT,MAJOR,MINOR,PSTART,PEND,OWNER,OSTART,OEND,LENGTH\n"));
+	if (*nr == 0)
+		printf(_("EXT,MAJOR,MINOR,PSTART,PEND,OWNER,OSTART,OEND,LENGTH\n"));
 	for (i = 0, p = head->fmh_recs; i < head->fmh_entries; i++, p++) {
 		printf("%llu,%u,%u,%lld,%lld,", i + (*nr),
 			major(p->fmr_device), minor(p->fmr_device),