diff mbox series

xfstests: add test for xfs_repair progress reporting

Message ID 20200519065512.232760-1-ddouwsma@redhat.com (mailing list archive)
State Superseded, archived
Headers show
Series xfstests: add test for xfs_repair progress reporting | expand

Commit Message

Donald Douwsma May 19, 2020, 6:55 a.m. UTC
xfs_repair's interval based progress has been broken for
some time, create a test based on dmdelay to stretch out
the time and use ag_stride to force parallelism.

Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
---
 tests/xfs/516     | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/516.out | 15 ++++++++++
 tests/xfs/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/xfs/516
 create mode 100644 tests/xfs/516.out

Comments

Darrick J. Wong May 19, 2020, 4:01 p.m. UTC | #1
On Tue, May 19, 2020 at 04:55:12PM +1000, Donald Douwsma wrote:
> xfs_repair's interval based progress has been broken for
> some time, create a test based on dmdelay to stretch out
> the time and use ag_stride to force parallelism.
> 
> Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
> ---
>  tests/xfs/516     | 72 +++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/516.out | 15 ++++++++++
>  tests/xfs/group   |  1 +
>  3 files changed, 88 insertions(+)
>  create mode 100755 tests/xfs/516
>  create mode 100644 tests/xfs/516.out
> 
> diff --git a/tests/xfs/516 b/tests/xfs/516
> new file mode 100755
> index 00000000..5ad57fbc
> --- /dev/null
> +++ b/tests/xfs/516
> @@ -0,0 +1,72 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
> +#
> +# FS QA Test 516
> +#
> +# Test xfs_repair's progress reporting
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	_dmsetup_remove delay-test > /dev/null 2>&1
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/dmdelay
> +. ./common/populate
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs xfs
> +_supported_os Linux
> +_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/' repair/progress.c
> +_filter_repair()
> +{
> +	sed -ne '
> +	s/[0-9]\+/#/g;
> +	/#:#:#:/p
> +	'
> +}
> +
> +echo "Format and populate"
> +_scratch_populate_cached nofill > $seqres.full 2>&1
> +
> +echo "Introduce a dmdelay"
> +_init_delay
> +
> +# 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 100 $SCRATCH_DEV 0 0"
> +_load_delay_table $DELAY_READ
> +
> +echo "Run repair"
> +$XFS_REPAIR_PROG -o ag_stride=4 -t 1 $DELAY_DEV >> $seqres.full 2>&1

Hmm... if the scratch device had an external log device, this raw
invocation of repair won't run because it won't have the log parameter.
Normally I'd say just use _scratch_xfs_repair here, but since there's a
delay device involved, things get trickier...

...or maybe they don't?

	SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride...

might work, seeing as we do that in a few places...

> +cat $seqres.full | _filter_repair | sort -u

You also might want to redirect the repair output to a separate file so
that you can filter and sort /only/ the repair output in the process of
logging the repair results to stdout and $seqres.full.

--D

> +
> +_cleanup_delay
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/516.out b/tests/xfs/516.out
> new file mode 100644
> index 00000000..bc824d7f
> --- /dev/null
> +++ b/tests/xfs/516.out
> @@ -0,0 +1,15 @@
> +QA output created by 516
> +Format and populate
> +Introduce a dmdelay
> +Run repair
> +	- #:#:#: Phase #: #% done - estimated remaining time # minutes, # seconds
> +	- #:#:#: Phase #: elapsed time # second - processed # inodes per minute
> +	- #:#:#: Phase #: elapsed time # seconds - 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
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 12eb55c9..aeeca23f 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -513,3 +513,4 @@
>  513 auto mount
>  514 auto quick db
>  515 auto quick quota
> +516 repair
> -- 
> 2.18.4
>
Donald Douwsma May 20, 2020, 1:11 a.m. UTC | #2
On 20/05/2020 02:01, Darrick J. Wong wrote:
> On Tue, May 19, 2020 at 04:55:12PM +1000, Donald Douwsma wrote:
>> xfs_repair's interval based progress has been broken for
>> some time, create a test based on dmdelay to stretch out
>> the time and use ag_stride to force parallelism.
>>
>> Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
>> ---
>>  tests/xfs/516     | 72 +++++++++++++++++++++++++++++++++++++++++++++++
>>  tests/xfs/516.out | 15 ++++++++++
>>  tests/xfs/group   |  1 +
>>  3 files changed, 88 insertions(+)
>>  create mode 100755 tests/xfs/516
>>  create mode 100644 tests/xfs/516.out
>>
>> diff --git a/tests/xfs/516 b/tests/xfs/516
>> new file mode 100755
>> index 00000000..5ad57fbc
>> --- /dev/null
>> +++ b/tests/xfs/516
>> @@ -0,0 +1,72 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
>> +#
>> +# FS QA Test 516
>> +#
>> +# Test xfs_repair's progress reporting
>> +#
>> +seq=`basename $0`
>> +seqres=$RESULT_DIR/$seq
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=1	# failure is the default!
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +	cd /
>> +	_dmsetup_remove delay-test > /dev/null 2>&1
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +. ./common/dmdelay
>> +. ./common/populate
>> +
>> +# remove previous $seqres.full before test
>> +rm -f $seqres.full
>> +
>> +# real QA test starts here
>> +
>> +# Modify as appropriate.
>> +_supported_fs xfs
>> +_supported_os Linux
>> +_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/' repair/progress.c
>> +_filter_repair()
>> +{
>> +	sed -ne '
>> +	s/[0-9]\+/#/g;
>> +	/#:#:#:/p
>> +	'
>> +}
>> +
>> +echo "Format and populate"
>> +_scratch_populate_cached nofill > $seqres.full 2>&1
>> +
>> +echo "Introduce a dmdelay"
>> +_init_delay
>> +
>> +# 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 100 $SCRATCH_DEV 0 0"
>> +_load_delay_table $DELAY_READ
>> +
>> +echo "Run repair"
>> +$XFS_REPAIR_PROG -o ag_stride=4 -t 1 $DELAY_DEV >> $seqres.full 2>&1
> 
> Hmm... if the scratch device had an external log device, this raw
> invocation of repair won't run because it won't have the log parameter.
> Normally I'd say just use _scratch_xfs_repair here, but since there's a
> delay device involved, things get trickier...
> 
> ...or maybe they don't?
> 
> 	SCRATCH_DEV=$DELAY_DEV _scratch_xfs_repair -o ag_stride...
> 
> might work, seeing as we do that in a few places...
> 

Thanks, that works a treat!

>> +cat $seqres.full | _filter_repair | sort -u
> 
> You also might want to redirect the repair output to a separate file so
> that you can filter and sort /only/ the repair output in the process of
> logging the repair results to stdout and $seqres.full.

*nod*, that would be much clearer. 

Cheers, 
Don

> --D
> 
>> +
>> +_cleanup_delay
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/xfs/516.out b/tests/xfs/516.out
>> new file mode 100644
>> index 00000000..bc824d7f
>> --- /dev/null
>> +++ b/tests/xfs/516.out
>> @@ -0,0 +1,15 @@
>> +QA output created by 516
>> +Format and populate
>> +Introduce a dmdelay
>> +Run repair
>> +	- #:#:#: Phase #: #% done - estimated remaining time # minutes, # seconds
>> +	- #:#:#: Phase #: elapsed time # second - processed # inodes per minute
>> +	- #:#:#: Phase #: elapsed time # seconds - 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
>> diff --git a/tests/xfs/group b/tests/xfs/group
>> index 12eb55c9..aeeca23f 100644
>> --- a/tests/xfs/group
>> +++ b/tests/xfs/group
>> @@ -513,3 +513,4 @@
>>  513 auto mount
>>  514 auto quick db
>>  515 auto quick quota
>> +516 repair
>> -- 
>> 2.18.4
>>
>
diff mbox series

Patch

diff --git a/tests/xfs/516 b/tests/xfs/516
new file mode 100755
index 00000000..5ad57fbc
--- /dev/null
+++ b/tests/xfs/516
@@ -0,0 +1,72 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 516
+#
+# Test xfs_repair's progress reporting
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	_dmsetup_remove delay-test > /dev/null 2>&1
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/dmdelay
+. ./common/populate
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_supported_os Linux
+_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/' repair/progress.c
+_filter_repair()
+{
+	sed -ne '
+	s/[0-9]\+/#/g;
+	/#:#:#:/p
+	'
+}
+
+echo "Format and populate"
+_scratch_populate_cached nofill > $seqres.full 2>&1
+
+echo "Introduce a dmdelay"
+_init_delay
+
+# 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 100 $SCRATCH_DEV 0 0"
+_load_delay_table $DELAY_READ
+
+echo "Run repair"
+$XFS_REPAIR_PROG -o ag_stride=4 -t 1 $DELAY_DEV >> $seqres.full 2>&1
+cat $seqres.full | _filter_repair | sort -u
+
+_cleanup_delay
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/516.out b/tests/xfs/516.out
new file mode 100644
index 00000000..bc824d7f
--- /dev/null
+++ b/tests/xfs/516.out
@@ -0,0 +1,15 @@ 
+QA output created by 516
+Format and populate
+Introduce a dmdelay
+Run repair
+	- #:#:#: Phase #: #% done - estimated remaining time # minutes, # seconds
+	- #:#:#: Phase #: elapsed time # second - processed # inodes per minute
+	- #:#:#: Phase #: elapsed time # seconds - 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
diff --git a/tests/xfs/group b/tests/xfs/group
index 12eb55c9..aeeca23f 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -513,3 +513,4 @@ 
 513 auto mount
 514 auto quick db
 515 auto quick quota
+516 repair