public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Donald Douwsma <ddouwsma@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Donald Douwsma <ddouwsma@redhat.com>
Subject: [PATCH] xfs_repair: always print an estimate when reporting progress
Date: Wed, 31 May 2023 16:41:43 +1000	[thread overview]
Message-ID: <20230531064143.1737591-1-ddouwsma@redhat.com> (raw)
In-Reply-To: <20230531064024.1737213-1-ddouwsma@redhat.com>

If xfs_repair completes the work for a given phase while allocation
groups are still being processed the estimated time may be zero, when
this occures xfs_repair prints an incomplete string.

 # xfs_repair -o ag_stride=4 -t 1 /dev/sdc
 Phase 1 - find and verify superblock...
         - reporting progress in intervals of 1 second
 Phase 2 - using internal log
         - zero log...
         - 20:52:11: zeroing log - 0 of 2560 blocks done
         - 20:52:12: zeroing log - 2560 of 2560 blocks done
         - scan filesystem freespace and inode maps...
         - 20:52:12: scanning filesystem freespace - 3 of 4 allocation groups done
         - 20:52:13: scanning filesystem freespace - 4 of 4 allocation groups done
         - found root inode chunk
 Phase 3 - for each AG...
         - scan and clear agi unlinked lists...
         - 20:52:13: scanning agi unlinked lists - 4 of 4 allocation groups done
         - process known inodes and perform inode discovery...
         - agno = 0
         - 20:52:13: process known inodes and inode discovery - 3456 of 40448 inodes done
         - 20:52:14: process known inodes and inode discovery - 3456 of 40448 inodes done
         - 20:52:14: Phase 3: elapsed time 1 second - processed 207360 inodes per minute
         - 20:52:14: Phase 3: 8% done - estimated remaining time 10 seconds
         - 20:52:15: process known inodes and inode discovery - 3456 of 40448 inodes done
         - 20:52:15: Phase 3: elapsed time 2 seconds - processed 103680 inodes per minute
         - 20:52:15: Phase 3: 8% done - estimated remaining time 21 seconds
         - 20:52:16: process known inodes and inode discovery - 33088 of 40448 inodes done
         - 20:52:16: Phase 3: elapsed time 3 seconds - processed 661760 inodes per minute
         - 20:52:16: Phase 3: 81% done - estimated remaining time
         - agno = 1
 	...

Make this more consistent by printing 'estimated remaining time 0
seconds' if there is a 0 estimate.

Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
---
 repair/progress.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/repair/progress.c b/repair/progress.c
index f6c4d988..9fb6e3eb 100644
--- a/repair/progress.c
+++ b/repair/progress.c
@@ -501,6 +501,8 @@ duration(int length, char *buf)
 			strcat(buf, _(", "));
 		strcat(buf, temp);
 	}
+	if (!(weeks|days|hours|minutes|seconds))
+		sprintf(buf, _("0 seconds"));
 
 	return(buf);
 }
-- 
2.39.3


  parent reply	other threads:[~2023-05-31  6:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  6:40 [PATCH 0/2] xfstests/xfsprogs xfs_repair progress reporting test Donald Douwsma
2023-05-31  6:40 ` [PATCH v4] xfstests: add test for xfs_repair progress reporting Donald Douwsma
2023-06-09  1:50   ` Murphy Zhou
2023-06-09  3:36     ` Zorro Lang
2023-06-09 14:52   ` Darrick J. Wong
2023-06-10  6:38     ` Zorro Lang
2023-06-15  2:15       ` Donald Douwsma
2023-05-31  6:41 ` Donald Douwsma [this message]
2023-06-09 14:48   ` [PATCH] xfs_repair: always print an estimate when reporting progress Darrick J. Wong
2023-06-09 15:03   ` Bill O'Donnell

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=20230531064143.1737591-1-ddouwsma@redhat.com \
    --to=ddouwsma@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /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