diff mbox series

[3/9] xfs: test mkfs.xfs sizing of internal logs that

Message ID 165644769450.1045534.8663346508633304230.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong June 28, 2022, 8:21 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

This is a regression test that exercises the mkfs.xfs code that creates
log sizes that are very close to the AG size when stripe units are in
play and/or when the log is forced to be in AG 0.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/843     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/843.out |    2 ++
 2 files changed, 53 insertions(+)
 create mode 100755 tests/xfs/843
 create mode 100644 tests/xfs/843.out

Comments

Dave Chinner June 29, 2022, 4:18 a.m. UTC | #1
On Tue, Jun 28, 2022 at 01:21:34PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> This is a regression test that exercises the mkfs.xfs code that creates
> log sizes that are very close to the AG size when stripe units are in
> play and/or when the log is forced to be in AG 0.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/843     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/843.out |    2 ++
>  2 files changed, 53 insertions(+)
>  create mode 100755 tests/xfs/843
>  create mode 100644 tests/xfs/843.out
> 
> 
> diff --git a/tests/xfs/843 b/tests/xfs/843
> new file mode 100755
> index 00000000..5bb4bfb4
> --- /dev/null
> +++ b/tests/xfs/843
> @@ -0,0 +1,51 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 843
> +#
> +# Now that we've increased the default log size calculation, test mkfs with
> +# various stripe units and filesystem sizes to see if we can provoke mkfs into
> +# breaking.
> +#
> +. ./common/preamble
> +_begin_fstest auto mkfs
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs xfs
> +_require_test
> +echo Silence is golden
> +
> +testfile=$TEST_DIR/a
> +rm -f $testfile
> +
> +test_format() {
> +	local tag="$1"
> +	shift
> +
> +	echo "$tag" >> $seqres.full
> +	$MKFS_XFS_PROG $@ -d file,name=$testfile &>> $seqres.full
> +	local res=$?
> +	test $res -eq 0 || echo "$tag FAIL $res" | tee -a $seqres.full
> +}
> +
> +# First we try various small filesystems and stripe sizes.
> +for M in `seq 298 302` `seq 490 520`; do
> +	for S in `seq 32 4 64`; do
> +		test_format "M=$M S=$S" -dsu=${S}k,sw=1,size=${M}m -N
> +	done
> +done
> +
> +# Log so large it pushes the root dir into AG 1.  We can't use -N for the mkfs
> +# because this check only occurs after the root directory has been allocated,
> +# which mkfs -N doesn't do.
> +test_format "log pushes rootdir into AG 1" -d agcount=3200,size=6366g -lagnum=0 -N

Why are you passing "-N" to the test if it can't be used to test
this?

Cheers,

Dave.
Darrick J. Wong June 29, 2022, 10:43 p.m. UTC | #2
On Wed, Jun 29, 2022 at 02:18:07PM +1000, Dave Chinner wrote:
> On Tue, Jun 28, 2022 at 01:21:34PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > This is a regression test that exercises the mkfs.xfs code that creates
> > log sizes that are very close to the AG size when stripe units are in
> > play and/or when the log is forced to be in AG 0.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/843     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/843.out |    2 ++
> >  2 files changed, 53 insertions(+)
> >  create mode 100755 tests/xfs/843
> >  create mode 100644 tests/xfs/843.out
> > 
> > 
> > diff --git a/tests/xfs/843 b/tests/xfs/843
> > new file mode 100755
> > index 00000000..5bb4bfb4
> > --- /dev/null
> > +++ b/tests/xfs/843
> > @@ -0,0 +1,51 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 843
> > +#
> > +# Now that we've increased the default log size calculation, test mkfs with
> > +# various stripe units and filesystem sizes to see if we can provoke mkfs into
> > +# breaking.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto mkfs
> > +
> > +# real QA test starts here
> > +
> > +# Modify as appropriate.
> > +_supported_fs xfs
> > +_require_test
> > +echo Silence is golden
> > +
> > +testfile=$TEST_DIR/a
> > +rm -f $testfile
> > +
> > +test_format() {
> > +	local tag="$1"
> > +	shift
> > +
> > +	echo "$tag" >> $seqres.full
> > +	$MKFS_XFS_PROG $@ -d file,name=$testfile &>> $seqres.full
> > +	local res=$?
> > +	test $res -eq 0 || echo "$tag FAIL $res" | tee -a $seqres.full
> > +}
> > +
> > +# First we try various small filesystems and stripe sizes.
> > +for M in `seq 298 302` `seq 490 520`; do
> > +	for S in `seq 32 4 64`; do
> > +		test_format "M=$M S=$S" -dsu=${S}k,sw=1,size=${M}m -N
> > +	done
> > +done
> > +
> > +# Log so large it pushes the root dir into AG 1.  We can't use -N for the mkfs
> > +# because this check only occurs after the root directory has been allocated,
> > +# which mkfs -N doesn't do.
> > +test_format "log pushes rootdir into AG 1" -d agcount=3200,size=6366g -lagnum=0 -N
> 
> Why are you passing "-N" to the test if it can't be used to test
> this?

I guess I went a little overboard after you asked for more -N and less
test runtime last time.

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
Zorro Lang June 30, 2022, 6:37 a.m. UTC | #3
On Wed, Jun 29, 2022 at 03:43:36PM -0700, Darrick J. Wong wrote:
> On Wed, Jun 29, 2022 at 02:18:07PM +1000, Dave Chinner wrote:
> > On Tue, Jun 28, 2022 at 01:21:34PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > This is a regression test that exercises the mkfs.xfs code that creates
> > > log sizes that are very close to the AG size when stripe units are in
> > > play and/or when the log is forced to be in AG 0.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > >  tests/xfs/843     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  tests/xfs/843.out |    2 ++
> > >  2 files changed, 53 insertions(+)
> > >  create mode 100755 tests/xfs/843
> > >  create mode 100644 tests/xfs/843.out
> > > 
> > > 
> > > diff --git a/tests/xfs/843 b/tests/xfs/843
> > > new file mode 100755
> > > index 00000000..5bb4bfb4
> > > --- /dev/null
> > > +++ b/tests/xfs/843
> > > @@ -0,0 +1,51 @@
> > > +#! /bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> > > +#
> > > +# FS QA Test 843
> > > +#
> > > +# Now that we've increased the default log size calculation, test mkfs with
> > > +# various stripe units and filesystem sizes to see if we can provoke mkfs into
> > > +# breaking.
> > > +#
> > > +. ./common/preamble
> > > +_begin_fstest auto mkfs
> > > +
> > > +# real QA test starts here
> > > +
> > > +# Modify as appropriate.
> > > +_supported_fs xfs
> > > +_require_test
> > > +echo Silence is golden
> > > +
> > > +testfile=$TEST_DIR/a
> > > +rm -f $testfile
> > > +
> > > +test_format() {
> > > +	local tag="$1"
> > > +	shift
> > > +
> > > +	echo "$tag" >> $seqres.full
> > > +	$MKFS_XFS_PROG $@ -d file,name=$testfile &>> $seqres.full
> > > +	local res=$?
> > > +	test $res -eq 0 || echo "$tag FAIL $res" | tee -a $seqres.full
> > > +}
> > > +
> > > +# First we try various small filesystems and stripe sizes.
> > > +for M in `seq 298 302` `seq 490 520`; do
> > > +	for S in `seq 32 4 64`; do
> > > +		test_format "M=$M S=$S" -dsu=${S}k,sw=1,size=${M}m -N
> > > +	done
> > > +done
> > > +
> > > +# Log so large it pushes the root dir into AG 1.  We can't use -N for the mkfs
> > > +# because this check only occurs after the root directory has been allocated,
> > > +# which mkfs -N doesn't do.
> > > +test_format "log pushes rootdir into AG 1" -d agcount=3200,size=6366g -lagnum=0 -N
> > 
> > Why are you passing "-N" to the test if it can't be used to test
> > this?
> 
> I guess I went a little overboard after you asked for more -N and less
> test runtime last time.

Is there anything different coverage if mkfs.xfs with or without "-N" (except
really writing on disk) ? If no difference, I'm fine with that, or I think
without "-N" might be good, especially this case only makes fs with small size,
it's fast enough.

Thanks,
Zorro

> 
> --D
> 
> > Cheers,
> > 
> > Dave.
> > -- 
> > Dave Chinner
> > david@fromorbit.com
>
Darrick J. Wong June 30, 2022, 7:32 p.m. UTC | #4
On Thu, Jun 30, 2022 at 02:37:14PM +0800, Zorro Lang wrote:
> On Wed, Jun 29, 2022 at 03:43:36PM -0700, Darrick J. Wong wrote:
> > On Wed, Jun 29, 2022 at 02:18:07PM +1000, Dave Chinner wrote:
> > > On Tue, Jun 28, 2022 at 01:21:34PM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > This is a regression test that exercises the mkfs.xfs code that creates
> > > > log sizes that are very close to the AG size when stripe units are in
> > > > play and/or when the log is forced to be in AG 0.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > ---
> > > >  tests/xfs/843     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > > >  tests/xfs/843.out |    2 ++
> > > >  2 files changed, 53 insertions(+)
> > > >  create mode 100755 tests/xfs/843
> > > >  create mode 100644 tests/xfs/843.out
> > > > 
> > > > 
> > > > diff --git a/tests/xfs/843 b/tests/xfs/843
> > > > new file mode 100755
> > > > index 00000000..5bb4bfb4
> > > > --- /dev/null
> > > > +++ b/tests/xfs/843
> > > > @@ -0,0 +1,51 @@
> > > > +#! /bin/bash
> > > > +# SPDX-License-Identifier: GPL-2.0
> > > > +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> > > > +#
> > > > +# FS QA Test 843
> > > > +#
> > > > +# Now that we've increased the default log size calculation, test mkfs with
> > > > +# various stripe units and filesystem sizes to see if we can provoke mkfs into
> > > > +# breaking.
> > > > +#
> > > > +. ./common/preamble
> > > > +_begin_fstest auto mkfs
> > > > +
> > > > +# real QA test starts here
> > > > +
> > > > +# Modify as appropriate.
> > > > +_supported_fs xfs
> > > > +_require_test
> > > > +echo Silence is golden
> > > > +
> > > > +testfile=$TEST_DIR/a
> > > > +rm -f $testfile
> > > > +
> > > > +test_format() {
> > > > +	local tag="$1"
> > > > +	shift
> > > > +
> > > > +	echo "$tag" >> $seqres.full
> > > > +	$MKFS_XFS_PROG $@ -d file,name=$testfile &>> $seqres.full
> > > > +	local res=$?
> > > > +	test $res -eq 0 || echo "$tag FAIL $res" | tee -a $seqres.full
> > > > +}
> > > > +
> > > > +# First we try various small filesystems and stripe sizes.
> > > > +for M in `seq 298 302` `seq 490 520`; do
> > > > +	for S in `seq 32 4 64`; do
> > > > +		test_format "M=$M S=$S" -dsu=${S}k,sw=1,size=${M}m -N
> > > > +	done
> > > > +done
> > > > +
> > > > +# Log so large it pushes the root dir into AG 1.  We can't use -N for the mkfs
> > > > +# because this check only occurs after the root directory has been allocated,
> > > > +# which mkfs -N doesn't do.
> > > > +test_format "log pushes rootdir into AG 1" -d agcount=3200,size=6366g -lagnum=0 -N
> > > 
> > > Why are you passing "-N" to the test if it can't be used to test
> > > this?
> > 
> > I guess I went a little overboard after you asked for more -N and less
> > test runtime last time.
> 
> Is there anything different coverage if mkfs.xfs with or without "-N" (except
> really writing on disk) ? If no difference, I'm fine with that, or I think
> without "-N" might be good, especially this case only makes fs with small size,
> it's fast enough.

Yes -- with that one exception, the mkfs geometry validation examined by
this test are all performed before mkfs writes anything to disk.  The
root inode location check is performed /after/ allocating it, which
means that we actually have to let it write the new filesystem to disk.

That's why *most* of the tests can use -N to reduce runtime.

Come to think of it, this really ought to have a _require_fs_space call
to make sure that fallocating the log space succeeds.

--D

> Thanks,
> Zorro
> 
> > 
> > --D
> > 
> > > Cheers,
> > > 
> > > Dave.
> > > -- 
> > > Dave Chinner
> > > david@fromorbit.com
> > 
>
diff mbox series

Patch

diff --git a/tests/xfs/843 b/tests/xfs/843
new file mode 100755
index 00000000..5bb4bfb4
--- /dev/null
+++ b/tests/xfs/843
@@ -0,0 +1,51 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 843
+#
+# Now that we've increased the default log size calculation, test mkfs with
+# various stripe units and filesystem sizes to see if we can provoke mkfs into
+# breaking.
+#
+. ./common/preamble
+_begin_fstest auto mkfs
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs xfs
+_require_test
+echo Silence is golden
+
+testfile=$TEST_DIR/a
+rm -f $testfile
+
+test_format() {
+	local tag="$1"
+	shift
+
+	echo "$tag" >> $seqres.full
+	$MKFS_XFS_PROG $@ -d file,name=$testfile &>> $seqres.full
+	local res=$?
+	test $res -eq 0 || echo "$tag FAIL $res" | tee -a $seqres.full
+}
+
+# First we try various small filesystems and stripe sizes.
+for M in `seq 298 302` `seq 490 520`; do
+	for S in `seq 32 4 64`; do
+		test_format "M=$M S=$S" -dsu=${S}k,sw=1,size=${M}m -N
+	done
+done
+
+# Log so large it pushes the root dir into AG 1.  We can't use -N for the mkfs
+# because this check only occurs after the root directory has been allocated,
+# which mkfs -N doesn't do.
+test_format "log pushes rootdir into AG 1" -d agcount=3200,size=6366g -lagnum=0 -N
+
+# log end rounded beyond EOAG due to stripe unit
+test_format "log end beyond eoag" -d agcount=3200,size=6366g -d su=256k,sw=4 -N
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/843.out b/tests/xfs/843.out
new file mode 100644
index 00000000..87c13504
--- /dev/null
+++ b/tests/xfs/843.out
@@ -0,0 +1,2 @@ 
+QA output created by 843
+Silence is golden