[PATCH] xfs_repair: always print an estimate when reporting progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux