Skip to contentSkip to conversation

xfstests/xfsprogs xfs_repair progress reporting test

PATCH New Donald Douwsma 5 participants 10 messages May 31, 2023 – Jun 15, 2023

lore
Share & tools
lore
#0 lore raw

cover xfstests/xfsprogs xfs_repair progress reporting test

A while ago I was working on a test for xfs_repair's progress reporting. Due to some inconsistency in the the progress reporting output the test would occasionally fail and was never merged.

https://lore.kernel.org/linux-xfs/[email protected]/

This came back and bit me when I noticed it was still broken in a specific downstream release.

While I could just filter the odd xfs repair output I think it makes sense to try and make the xfs_repair more consistent. A delay of 38ms seems to hit this regularly for me on a dual processor vm with the current fstests/common/populate.

- Don

Donald Douwsma (2):
fstests: add test for xfs_repair progress reporting
xfs_repair: always print an estimate when reporting progress

Signature · 1 line
2.39.3
#1 lore raw

PATCH v4 1/1 xfstests: add test for xfs_repair progress reporting

Confirm that xfs_repair reports on its progress if -o ag_stride is enabled.

---
Changes since v3
- Rebase after tests/xfs/groups removal (tools/convert-group), drop _supported_os
- Shorten the delay, remove superfluous dm-delay parameters
Changes since v2:
- Fix cleanup handling and function naming
- Added to auto group
Changes since v1:
- Use _scratch_xfs_repair
- Filter only repair output
- Make the filter more tolerant of whitespace and plurals
- Take golden output from 'xfs_repair: fix progress reporting'

 tests/xfs/999     | 66 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/999.out | 15 +++++++++++
 2 files changed, 81 insertions(+)
 create mode 100755 tests/xfs/999
 create mode 100644 tests/xfs/999.out
tests/xfs/999 new file +66 -0
new file mode 100755
index 00000000..9e799f66
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 521
+#
+# Test xfs_repair's progress reporting
+#
+. ./common/preamble
+_begin_fstest auto repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+	_cleanup_delay > /dev/null 2>&1
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_require_scratch
+_require_dm_target delay
+
+# Filter output specific to the formatters in xfs_repair/progress.c
+# Ideally we'd like to see hits on anything that matches
+# awk '/{FMT/' xfsprogs-dev/repair/progress.c
+filter_repair()
+{
+	sed -nre '
+	s/[0-9]+/#/g;
+	s/^\s+/ /g;
+	s/(# (week|day|hour|minute|second)s?(, )?)+/{progres}/g;
+	/#:#:#:/p
+	'
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+DELAY_MS=38
+
+# Introduce a read I/O delay
+# The default in common/dmdelay is a bit too agressive
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $DELAY_MS"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride=4 -t 1 2>&1 |
+        tee -a $seqres.full > $tmp.repair
+
+cat $tmp.repair | filter_repair | sort -u
+
+# success, all done
+status=0
+exit
tests/xfs/999.out new file +15 -0
new file mode 100644
index 00000000..e27534d8
@@ -0,0 +1,15 @@
+QA output created by 999
+Format and populate
+Introduce a dmdelay
+Run repair
+ - #:#:#: Phase #: #% done - estimated remaining time {progres}
+ - #:#:#: Phase #: elapsed time {progres} - processed # inodes per minute
+ - #:#:#: check for inodes claiming duplicate blocks - # of # inodes done
+ - #:#:#: process known inodes and inode discovery - # of # inodes done
+ - #:#:#: process newly discovered inodes - # of # allocation groups done
+ - #:#:#: rebuild AG headers and trees - # of # allocation groups done
+ - #:#:#: scanning agi unlinked lists - # of # allocation groups done
+ - #:#:#: scanning filesystem freespace - # of # allocation groups done
+ - #:#:#: setting up duplicate extent list - # of # allocation groups done
+ - #:#:#: verify and correct link counts - # of # allocation groups done
+ - #:#:#: zeroing log - # of # blocks done
Signature · 1 line
2.39.3
#2 lore raw

Re: [PATCH v4] xfstests: add test for xfs_repair progress reporting

Adding fstests

Quoted 5 lines · Donald Douwsma

Confirm that xfs_repair reports on its progress if -o ag_stride is enabled.

Ack.

Thanks,

Quoted 115 lines

---
Changes since v3
- Rebase after tests/xfs/groups removal (tools/convert-group), drop _supported_os
- Shorten the delay, remove superfluous dm-delay parameters
Changes since v2:
- Fix cleanup handling and function naming
- Added to auto group
Changes since v1:
- Use _scratch_xfs_repair
- Filter only repair output
- Make the filter more tolerant of whitespace and plurals
- Take golden output from 'xfs_repair: fix progress reporting'

 tests/xfs/999     | 66 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/999.out | 15 +++++++++++
 2 files changed, 81 insertions(+)
 create mode 100755 tests/xfs/999
 create mode 100644 tests/xfs/999.out
tests/xfs/999 new file +66 -0
new file mode 100755
index 00000000..9e799f66
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 521
+#
+# Test xfs_repair's progress reporting
+#
+. ./common/preamble
+_begin_fstest auto repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+       _cleanup_delay > /dev/null 2>&1
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_require_scratch
+_require_dm_target delay
+
+# Filter output specific to the formatters in xfs_repair/progress.c
+# Ideally we'd like to see hits on anything that matches
+# awk '/{FMT/' xfsprogs-dev/repair/progress.c
+filter_repair()
+{
+       sed -nre '
+       s/[0-9]+/#/g;
+       s/^\s+/ /g;
+       s/(# (week|day|hour|minute|second)s?(, )?)+/{progres}/g;
+       /#:#:#:/p
+       '
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+DELAY_MS=38
+
+# Introduce a read I/O delay
+# The default in common/dmdelay is a bit too agressive
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $DELAY_MS"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride=4 -t 1 2>&1 |
+        tee -a $seqres.full > $tmp.repair
+
+cat $tmp.repair | filter_repair | sort -u
+
+# success, all done
+status=0
+exit
tests/xfs/999.out new file +15 -1
new file mode 100644
index 00000000..e27534d8
@@ -0,0 +1,15 @@
+QA output created by 999
+Format and populate
+Introduce a dmdelay
+Run repair
+ - #:#:#: Phase #: #% done - estimated remaining time {progres}
+ - #:#:#: Phase #: elapsed time {progres} - processed # inodes per minute
+ - #:#:#: check for inodes claiming duplicate blocks - # of # inodes done
+ - #:#:#: process known inodes and inode discovery - # of # inodes done
+ - #:#:#: process newly discovered inodes - # of # allocation groups done
+ - #:#:#: rebuild AG headers and trees - # of # allocation groups done
+ - #:#:#: scanning agi unlinked lists - # of # allocation groups done
+ - #:#:#: scanning filesystem freespace - # of # allocation groups done
+ - #:#:#: setting up duplicate extent list - # of # allocation groups done
+ - #:#:#: verify and correct link counts - # of # allocation groups done
+ - #:#:#: zeroing log - # of # blocks done
--

2.39.3

#3 lore raw

Re: [PATCH v4] xfstests: add test for xfs_repair progress reporting

Quoted 10 lines · Murphy Zhou

Adding fstests

Quoted 5 lines · Donald Douwsma

Confirm that xfs_repair reports on its progress if -o ag_stride is enabled.

Ack.

Hi Donald,

That's weird, I never saw the original patch email, did I miss something? Please send the original patch to fstests@ if you hope to get reviewing and merging (if acked:)

Thanks,
Zorro

Quoted 118 lines

Thanks,

Quoted 115 lines

---
Changes since v3
- Rebase after tests/xfs/groups removal (tools/convert-group), drop _supported_os
- Shorten the delay, remove superfluous dm-delay parameters
Changes since v2:
- Fix cleanup handling and function naming
- Added to auto group
Changes since v1:
- Use _scratch_xfs_repair
- Filter only repair output
- Make the filter more tolerant of whitespace and plurals
- Take golden output from 'xfs_repair: fix progress reporting'

 tests/xfs/999     | 66 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/999.out | 15 +++++++++++
 2 files changed, 81 insertions(+)
 create mode 100755 tests/xfs/999
 create mode 100644 tests/xfs/999.out
tests/xfs/999 new file +66 -0
new file mode 100755
index 00000000..9e799f66
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 521
+#
+# Test xfs_repair's progress reporting
+#
+. ./common/preamble
+_begin_fstest auto repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+       _cleanup_delay > /dev/null 2>&1
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_require_scratch
+_require_dm_target delay
+
+# Filter output specific to the formatters in xfs_repair/progress.c
+# Ideally we'd like to see hits on anything that matches
+# awk '/{FMT/' xfsprogs-dev/repair/progress.c
+filter_repair()
+{
+       sed -nre '
+       s/[0-9]+/#/g;
+       s/^\s+/ /g;
+       s/(# (week|day|hour|minute|second)s?(, )?)+/{progres}/g;
+       /#:#:#:/p
+       '
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+DELAY_MS=38
+
+# Introduce a read I/O delay
+# The default in common/dmdelay is a bit too agressive
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $DELAY_MS"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride=4 -t 1 2>&1 |
+        tee -a $seqres.full > $tmp.repair
+
+cat $tmp.repair | filter_repair | sort -u
+
+# success, all done
+status=0
+exit
tests/xfs/999.out new file +15 -1
new file mode 100644
index 00000000..e27534d8
@@ -0,0 +1,15 @@
+QA output created by 999
+Format and populate
+Introduce a dmdelay
+Run repair
+ - #:#:#: Phase #: #% done - estimated remaining time {progres}
+ - #:#:#: Phase #: elapsed time {progres} - processed # inodes per minute
+ - #:#:#: check for inodes claiming duplicate blocks - # of # inodes done
+ - #:#:#: process known inodes and inode discovery - # of # inodes done
+ - #:#:#: process newly discovered inodes - # of # allocation groups done
+ - #:#:#: rebuild AG headers and trees - # of # allocation groups done
+ - #:#:#: scanning agi unlinked lists - # of # allocation groups done
+ - #:#:#: scanning filesystem freespace - # of # allocation groups done
+ - #:#:#: setting up duplicate extent list - # of # allocation groups done
+ - #:#:#: verify and correct link counts - # of # allocation groups done
+ - #:#:#: zeroing log - # of # blocks done
--

2.39.3

#4 lore raw

Re: [PATCH v4] xfstests: add test for xfs_repair progress reporting

In reply to Donald Douwsma

Tests ought to be cc'd to [email protected].

Quoted 69 lines · Donald Douwsma

Confirm that xfs_repair reports on its progress if -o ag_stride is enabled.

---
Changes since v3
- Rebase after tests/xfs/groups removal (tools/convert-group), drop _supported_os
- Shorten the delay, remove superfluous dm-delay parameters
Changes since v2:
- Fix cleanup handling and function naming
- Added to auto group
Changes since v1:
- Use _scratch_xfs_repair
- Filter only repair output
- Make the filter more tolerant of whitespace and plurals
- Take golden output from 'xfs_repair: fix progress reporting'

 tests/xfs/999     | 66 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/999.out | 15 +++++++++++
 2 files changed, 81 insertions(+)
 create mode 100755 tests/xfs/999
 create mode 100644 tests/xfs/999.out
tests/xfs/999 new file +40 -0
new file mode 100755
index 00000000..9e799f66
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 521
+#
+# Test xfs_repair's progress reporting
+#
+. ./common/preamble
+_begin_fstest auto repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+	_cleanup_delay > /dev/null 2>&1
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_require_scratch
+_require_dm_target delay
+
+# Filter output specific to the formatters in xfs_repair/progress.c
+# Ideally we'd like to see hits on anything that matches
+# awk '/{FMT/' xfsprogs-dev/repair/progress.c
+filter_repair()
+{
+	sed -nre '
+	s/[0-9]+/#/g;
+	s/^\s+/ /g;
+	s/(# (week|day|hour|minute|second)s?(, )?)+/{progres}/g;

tests/xfs/999 line 50

Quoted 10 lines
tests/xfs/999 new file +10 -0
+	/#:#:#:/p
+	'
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+DELAY_MS=38

I wonder if this is where _init_delay should gain a delay_ms argument?

_init_delay() {
	local delay_ms="${1:-10000}"

	...
	DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $delay_ms $SCRATCH_DEV 0 0"
}
Quoted 26 lines
tests/xfs/999 new file +15 -0
+# Introduce a read I/O delay
+# The default in common/dmdelay is a bit too agressive
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $DELAY_MS"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride=4 -t 1 2>&1 |
+        tee -a $seqres.full > $tmp.repair
+
+cat $tmp.repair | filter_repair | sort -u
+
+# success, all done
+status=0
+exit
tests/xfs/999.out new file +5 -0
new file mode 100644
index 00000000..e27534d8
@@ -0,0 +1,15 @@
+QA output created by 999
+Format and populate
+Introduce a dmdelay
+Run repair
+ - #:#:#: Phase #: #% done - estimated remaining time {progres}

tests/xfs/999.out line 15

Quoted 10 lines
tests/xfs/999.out new file +10 -0
+ - #:#:#: Phase #: elapsed time {progres} - processed # inodes per minute
+ - #:#:#: check for inodes claiming duplicate blocks - # of # inodes done
+ - #:#:#: process known inodes and inode discovery - # of # inodes done
+ - #:#:#: process newly discovered inodes - # of # allocation groups done
+ - #:#:#: rebuild AG headers and trees - # of # allocation groups done
+ - #:#:#: scanning agi unlinked lists - # of # allocation groups done
+ - #:#:#: scanning filesystem freespace - # of # allocation groups done
+ - #:#:#: setting up duplicate extent list - # of # allocation groups done
+ - #:#:#: verify and correct link counts - # of # allocation groups done
+ - #:#:#: zeroing log - # of # blocks done

Otherwise seems fine to me, assuming nothing goes nuts if rt devices or whatever happen to be configured. ;)

--D

Quoted 3 lines
Signature · 1 line
2.39.3
#5 lore raw

Re: [PATCH v4] xfstests: add test for xfs_repair progress reporting

Quoted 1 line · Darrick J. Wong

Tests ought to be cc'd to [email protected].

Thanks, I got this patch now :)

Quoted 51 lines · Donald Douwsma
Quoted 49 lines

Confirm that xfs_repair reports on its progress if -o ag_stride is enabled.

---
Changes since v3
- Rebase after tests/xfs/groups removal (tools/convert-group), drop _supported_os
- Shorten the delay, remove superfluous dm-delay parameters
Changes since v2:
- Fix cleanup handling and function naming
- Added to auto group
Changes since v1:
- Use _scratch_xfs_repair
- Filter only repair output
- Make the filter more tolerant of whitespace and plurals
- Take golden output from 'xfs_repair: fix progress reporting'

 tests/xfs/999     | 66 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/999.out | 15 +++++++++++
 2 files changed, 81 insertions(+)
 create mode 100755 tests/xfs/999
 create mode 100644 tests/xfs/999.out
tests/xfs/999 new file +20 -0
new file mode 100755
index 00000000..9e799f66
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 521
+#
+# Test xfs_repair's progress reporting
+#
+. ./common/preamble
+_begin_fstest auto repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+	_cleanup_delay > /dev/null 2>&1
+}
+
+# Import common functions.
Quoted 8 lines

tests/xfs/999 line 28

Quoted 8 lines
tests/xfs/999 new file +8 -0
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs

As a regression test case, we need to point out that it's:
_fixed_by_git_commit xfsprogs a4d94d6c30ac "xfs_repair: fix progress reporting"

Then due to it might fail without the other patch [1] (which has been reviewed), so we'd better to point out that:

_wants_git_commit xfsprogs xxxxxxxxxxxx \
"xfs_repair: always print an estimate when reporting progress"

[1]
https://lore.kernel.org/linux-xfs/ZIM%[email protected]/T/#u

Quoted 25 lines
Quoted 12 lines
tests/xfs/999 new file +12 -0
+_require_scratch
+_require_dm_target delay
+
+# Filter output specific to the formatters in xfs_repair/progress.c
+# Ideally we'd like to see hits on anything that matches
+# awk '/{FMT/' xfsprogs-dev/repair/progress.c
+filter_repair()
+{
+	sed -nre '
+	s/[0-9]+/#/g;
+	s/^\s+/ /g;
+	s/(# (week|day|hour|minute|second)s?(, )?)+/{progres}/g;

tests/xfs/999 line 50

Quoted 10 lines
tests/xfs/999 new file +10 -0
+	/#:#:#:/p
+	'
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+DELAY_MS=38

I wonder if this is where _init_delay should gain a delay_ms argument?

Quoted 2 lines
_init_delay() {
	local delay_ms="${1:-10000}"

Agree

Quoted 6 lines
	...
	DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $delay_ms $SCRATCH_DEV 0 0"
}
Quoted 11 lines

tests/xfs/999 line 62

Quoted 11 lines
tests/xfs/999 new file +11 -0
+# Introduce a read I/O delay
+# The default in common/dmdelay is a bit too agressive
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $DELAY_MS"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride=4 -t 1 2>&1 |
+        tee -a $seqres.full > $tmp.repair
+
+cat $tmp.repair | filter_repair | sort -u

If the sort -u is necessary, how about only print the lines we realy care, filter out all other lines?

Thanks,
Zorro

Quoted 35 lines
Quoted 15 lines
tests/xfs/999 new file +4 -0
+
+# success, all done
+status=0
+exit
tests/xfs/999.out new file +5 -0
new file mode 100644
index 00000000..e27534d8
@@ -0,0 +1,15 @@
+QA output created by 999
+Format and populate
+Introduce a dmdelay
+Run repair
+ - #:#:#: Phase #: #% done - estimated remaining time {progres}

tests/xfs/999.out line 15

Quoted 10 lines
tests/xfs/999.out new file +10 -0
+ - #:#:#: Phase #: elapsed time {progres} - processed # inodes per minute
+ - #:#:#: check for inodes claiming duplicate blocks - # of # inodes done
+ - #:#:#: process known inodes and inode discovery - # of # inodes done
+ - #:#:#: process newly discovered inodes - # of # allocation groups done
+ - #:#:#: rebuild AG headers and trees - # of # allocation groups done
+ - #:#:#: scanning agi unlinked lists - # of # allocation groups done
+ - #:#:#: scanning filesystem freespace - # of # allocation groups done
+ - #:#:#: setting up duplicate extent list - # of # allocation groups done
+ - #:#:#: verify and correct link counts - # of # allocation groups done
+ - #:#:#: zeroing log - # of # blocks done

Otherwise seems fine to me, assuming nothing goes nuts if rt devices or whatever happen to be configured. ;)

--D

Quoted 3 lines
Signature · 1 line
2.39.3
#6 lore raw

Re: [PATCH v4] xfstests: add test for xfs_repair progress reporting

Quoted 4 lines · Zorro Lang
Quoted 1 line · Darrick J. Wong

Tests ought to be cc'd to [email protected].

Thanks, I got this patch now :)

Sorry Zorro, I'd meant to CC the cover letter and test to fstests.

Quoted 55 lines
Quoted 55 lines · Donald Douwsma
Quoted 52 lines

Confirm that xfs_repair reports on its progress if -o ag_stride is enabled.

---
Changes since v3
- Rebase after tests/xfs/groups removal (tools/convert-group), drop _supported_os
- Shorten the delay, remove superfluous dm-delay parameters
Changes since v2:
- Fix cleanup handling and function naming
- Added to auto group
Changes since v1:
- Use _scratch_xfs_repair
- Filter only repair output
- Make the filter more tolerant of whitespace and plurals
- Take golden output from 'xfs_repair: fix progress reporting'

  tests/xfs/999     | 66 +++++++++++++++++++++++++++++++++++++++++++++++
  tests/xfs/999.out | 15 +++++++++++
  2 files changed, 81 insertions(+)

create mode 100755 tests/xfs/999
create mode 100644 tests/xfs/999.out

tests/xfs/999 new file +23 -0
new file mode 100755
index 00000000..9e799f66
@@ -0,0 +1,66 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 521
+#
+# Test xfs_repair's progress reporting
+#
+. ./common/preamble
+_begin_fstest auto repair
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+	_cleanup_delay > /dev/null 2>&1
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
Quoted 9 lines
Quoted 5 lines

tests/xfs/999 line 28

Quoted 5 lines
tests/xfs/999 new file +5 -0
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs

As a regression test case, we need to point out that it's:
_fixed_by_git_commit xfsprogs a4d94d6c30ac "xfs_repair: fix progress reporting"

Will do.

Quoted 8 lines

Then due to it might fail without the other patch [1] (which has been reviewed), so we'd better to point out that:

_wants_git_commit xfsprogs xxxxxxxxxxxx \
"xfs_repair: always print an estimate when reporting progress"

[1]
https://lore.kernel.org/linux-xfs/ZIM%[email protected]/T/#u

I'll send a v5 to fstests and linux-xfs once the above is merged and I can add the commit.

- Don

Quoted 92 lines
Quoted 27 lines
Quoted 14 lines
tests/xfs/999 new file +12 -0
+_require_scratch
+_require_dm_target delay
+
+# Filter output specific to the formatters in xfs_repair/progress.c
+# Ideally we'd like to see hits on anything that matches
+# awk '/{FMT/' xfsprogs-dev/repair/progress.c
+filter_repair()
+{
+	sed -nre '
+	s/[0-9]+/#/g;
+	s/^\s+/ /g;
+	s/(# (week|day|hour|minute|second)s?(, )?)+/{progres}/g;

tests/xfs/999 line 50

Quoted 10 lines
tests/xfs/999 new file +10 -0
+	/#:#:#:/p
+	'
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+DELAY_MS=38

I wonder if this is where _init_delay should gain a delay_ms argument?

Quoted 2 lines
_init_delay() {
	local delay_ms="${1:-10000}"

Agree

Quoted 6 lines
	...
	DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $delay_ms $SCRATCH_DEV 0 0"
}
Quoted 11 lines

tests/xfs/999 line 62

Quoted 11 lines
tests/xfs/999 new file +11 -0
+# Introduce a read I/O delay
+# The default in common/dmdelay is a bit too agressive
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 $DELAY_MS"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride=4 -t 1 2>&1 |
+        tee -a $seqres.full > $tmp.repair
+
+cat $tmp.repair | filter_repair | sort -u

If the sort -u is necessary, how about only print the lines we realy care, filter out all other lines?

Thanks,
Zorro

Quoted 35 lines
Quoted 15 lines
tests/xfs/999 new file +4 -0
+
+# success, all done
+status=0
+exit
tests/xfs/999.out new file +5 -0
new file mode 100644
index 00000000..e27534d8
@@ -0,0 +1,15 @@
+QA output created by 999
+Format and populate
+Introduce a dmdelay
+Run repair
+ - #:#:#: Phase #: #% done - estimated remaining time {progres}

tests/xfs/999.out line 15

Quoted 10 lines
tests/xfs/999.out new file +10 -0
+ - #:#:#: Phase #: elapsed time {progres} - processed # inodes per minute
+ - #:#:#: check for inodes claiming duplicate blocks - # of # inodes done
+ - #:#:#: process known inodes and inode discovery - # of # inodes done
+ - #:#:#: process newly discovered inodes - # of # allocation groups done
+ - #:#:#: rebuild AG headers and trees - # of # allocation groups done
+ - #:#:#: scanning agi unlinked lists - # of # allocation groups done
+ - #:#:#: scanning filesystem freespace - # of # allocation groups done
+ - #:#:#: setting up duplicate extent list - # of # allocation groups done
+ - #:#:#: verify and correct link counts - # of # allocation groups done
+ - #:#:#: zeroing log - # of # blocks done

Otherwise seems fine to me, assuming nothing goes nuts if rt devices or whatever happen to be configured. ;)

--D

Quoted 3 lines
Signature · 1 line
2.39.3
#7 lore raw

PATCH 1/1 xfs_repair: always print an estimate when reporting progress

In reply to Donald Douwsma

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.

---
 repair/progress.c | 2 ++
 1 file changed, 2 insertions(+)
repair/progress.c +2 -0
index f6c4d988..9fb6e3eb 100644
@@ -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);
 }
Signature · 1 line
2.39.3
Reviewed-by on v1 1/1
#8 lore raw

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

Quoted 33 lines · Donald Douwsma

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
 	...
Quoted 4 lines

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

--D

Quoted 20 lines
---
 repair/progress.c | 2 ++
 1 file changed, 2 insertions(+)
repair/progress.c +2 -0
index f6c4d988..9fb6e3eb 100644
@@ -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);
 }
Signature · 1 line
2.39.3
Reviewed-by on v1 1/1
#9 lore raw

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

In reply to Donald Douwsma
Quoted 33 lines · Donald Douwsma

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
 	...
Quoted 4 lines

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

Looks fine.

Quoted 20 lines
---
 repair/progress.c | 2 ++
 1 file changed, 2 insertions(+)
repair/progress.c +2 -0
index f6c4d988..9fb6e3eb 100644
@@ -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);
 }
Signature · 1 line
2.39.3