linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ext4/004: Add new resize2fs functional test
@ 2014-12-09 19:27 Dmitry Monakhov
  2014-12-09 19:27 ` [PATCH 2/2] ext4/005: Add new resize2fs stress test Dmitry Monakhov
  2014-12-12  0:21 ` [PATCH 1/2] ext4/004: Add new resize2fs functional test Dave Chinner
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Monakhov @ 2014-12-09 19:27 UTC (permalink / raw)
  To: fstests; +Cc: linux-ext4, Dmitry Monakhov

Perform online fs-resize(from 1T to 15T) and check that fs is usable

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 tests/ext4/004     | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/004.out |  16 +++++++++
 tests/ext4/group   |   1 +
 3 files changed, 117 insertions(+)
 create mode 100755 tests/ext4/004
 create mode 100644 tests/ext4/004.out

diff --git a/tests/ext4/004 b/tests/ext4/004
new file mode 100755
index 0000000..0c54ade
--- /dev/null
+++ b/tests/ext4/004
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test No. 004
+#
+# Online resize2fs functional test
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Dmitry Monakhov.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+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()
+{
+    _scratch_unmount
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+E2FSCK_PROG="`set_prog_path e2fsck`"
+RESIZE2FS_PROG="`set_prog_path resize2fs`"
+_supported_fs ext4
+_supported_os Linux
+_require_command $MKFS_EXT4_PROG mkfs.ext4
+_require_command $E2FSCK_PROG e2fsck
+_require_command $RESIZE2FS_PROG resize2fs
+_require_scratch
+
+# real QA test starts here
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+mkdir $SCRATCH_MNT/mnt
+touch $SCRATCH_MNT/img
+truncate --size 1G $SCRATCH_MNT/img || _fail "Can not grow $SCRATCH_MNT/img"
+$MKFS_EXT4_PROG -F -b 4096 -i $((1024*1024*64)) $MKFS_OPTIONS -O 64bit $SCRATCH_MNT/img \
+    >> $seqres.full 2>&1 || _fail "$MKFS_EXT4_PROG failed see $seqres.full"
+
+for ((size = 1; size < 16; size++))
+do
+    truncate --size ${size}T $SCRATCH_MNT/img || _fail "Can not grow $SCRATCH_MNT/img file"
+    loop=`_create_loop_device $SCRATCH_MNT/img`
+    _mount -t $FSTYP $MOUNT_OPTIONS $loop $SCRATCH_MNT/mnt
+
+    echo "Resize to ${size}T"
+    $RESIZE2FS_PROG $loop  >> $seqres.full 2>&1 || \
+	_fail "Could not resize FS to $size Tb"
+
+    du -sch $SCRATCH_MNT/img >> $seqres.full
+    # Create space-holders
+    for ((i=0 ; i < 1000;i++))
+    do
+	fallocate -l 1001M $SCRATCH_MNT/mnt/space-$size-$i
+    done
+
+    # Consume all space remaining
+    fallocate -l 1T $SCRATCH_MNT/mnt/space-$size-last 2> /dev/null && \
+	_fail "Too may space consumed"
+
+    # Cut 1Mb for eash space-holders in order to create very fragmented fs
+    for ((i=0 ; i < 1000;i++))
+    do
+	truncate --size 1000M $SCRATCH_MNT/mnt/space-$size-$i
+    done
+
+    out=$SCRATCH_MNT/mnt/fsstress-$size
+    args=`_scale_fsstress_args -p8 -n200 -f setattr=1 $FSSTRESS_AVOID -d $out`
+    echo "Run fsstress $args" >> $seqres.full
+    $FSSTRESS_PROG $args -d $out > /dev/null 2>&1
+
+    du -sch $SCRATCH_MNT/img >> $seqres.full
+    umount $SCRATCH_MNT/mnt || _fail " umount fail"
+    _destroy_loop_device $loop
+    _check_generic_filesystem $SCRATCH_MNT/img
+done
+
+status=0
+exit
diff --git a/tests/ext4/004.out b/tests/ext4/004.out
new file mode 100644
index 0000000..ff2efcf
--- /dev/null
+++ b/tests/ext4/004.out
@@ -0,0 +1,16 @@
+QA output created by 004
+Resize to 1T
+Resize to 2T
+Resize to 3T
+Resize to 4T
+Resize to 5T
+Resize to 6T
+Resize to 7T
+Resize to 8T
+Resize to 9T
+Resize to 10T
+Resize to 11T
+Resize to 12T
+Resize to 13T
+Resize to 14T
+Resize to 15T
diff --git a/tests/ext4/group b/tests/ext4/group
index aa6a53b..e60d8fb 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -6,6 +6,7 @@
 001 auto prealloc quick
 002 auto quick prealloc
 003 auto quick
+004 auto ioctl resize
 271 auto rw quick
 301 aio dangerous ioctl rw stress
 302 aio dangerous ioctl rw stress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ext4/005: Add new resize2fs stress test
  2014-12-09 19:27 [PATCH 1/2] ext4/004: Add new resize2fs functional test Dmitry Monakhov
@ 2014-12-09 19:27 ` Dmitry Monakhov
  2014-12-12  0:21 ` [PATCH 1/2] ext4/004: Add new resize2fs functional test Dave Chinner
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Monakhov @ 2014-12-09 19:27 UTC (permalink / raw)
  To: fstests; +Cc: linux-ext4, Dmitry Monakhov

Run several rounds of resize2fs. Increment fs-size on random amount bytes on each
iteration while fsstress is in progress.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 tests/ext4/005     | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/005.out |  36 ++++++++++++++++++
 tests/ext4/group   |   1 +
 3 files changed, 143 insertions(+)
 create mode 100755 tests/ext4/005
 create mode 100644 tests/ext4/005.out

diff --git a/tests/ext4/005 b/tests/ext4/005
new file mode 100755
index 0000000..3b81aab
--- /dev/null
+++ b/tests/ext4/005
@@ -0,0 +1,106 @@
+#! /bin/bash
+# FS QA Test No. 004
+#
+# Online resize2fs stress test
+# Run resize2fs and fsstress concurently
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Dmitry Monakhov.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+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 /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs ext4
+_supported_os Linux
+E2FSCK_PROG="`set_prog_path e2fsck`"
+RESIZE2FS_PROG="`set_prog_path resize2fs`"
+
+_require_command $MKFS_EXT4_PROG mkfs.ext4
+_require_command $E2FSCK_PROG e2fsck
+_require_command $RESIZE2FS_PROG resize2fs
+_require_scratch
+
+#Real testing starts here
+_scratch_mkfs  >> $seqres.full 2>&1
+_scratch_mount
+mkdir $SCRATCH_MNT/mnt
+touch $SCRATCH_MNT/img
+
+size=$((1024*1024))
+truncate --size ${size}k $SCRATCH_MNT/img || _fail "Can not grow $SCRATCH_MNT/img"
+$MKFS_EXT4_PROG -F -b 4096 -i $((1024*1024*64)) $MKFS_OPTIONS -O 64bit $SCRATCH_MNT/img \
+    >> $seqres.full 2>&1 || _fail "$MKFS_EXT4_PROG failed see $seqres.full"
+truncate --size 15T $SCRATCH_MNT/img || _fail "Can not grow $SCRATCH_MNT/img file"
+loop=`_create_loop_device $SCRATCH_MNT/img`
+
+_workout ()
+{
+    tst_nr=$1
+    _mount -t $FSTYP $MOUNT_OPTIONS $loop $SCRATCH_MNT/mnt
+    for ((it = 0; it <= tst_nr/2; it++))
+    do
+	echo "Start Round:$tst_nr iteration:$it"
+	size=$(($size + $RANDOM * 503 * ($tst_nr+1)));
+	out=$SCRATCH_MNT/mnt/fsstress-$size
+	args=`_scale_fsstress_args -p16 -n200 -f setattr=1 $FSSTRESS_AVOID -d $out`
+	
+	echo "Run fsstress $args" >> $seqres.full
+	$FSSTRESS_PROG $args -d $out > /dev/null 2>&1 &
+	fsstress_pid=$!
+	echo "Resize to ${size}k" >> $seqres.full
+	$RESIZE2FS_PROG $loop  >> $seqres.full ${size}k 2>&1 || \
+	    _fail "Could not resize FS to $size kb"
+	wait $fsstress_pid
+	fallocate -l 32M $SCRATCH_MNT/mnt/rsv-$tst_nr-$it
+	# Consume all space available
+	fallocate -l 1T $SCRATCH_MNT/mnt/space-$tst_nr-$it 2> /dev/null && \
+	    _fail "Too may space consumed"
+	unlink $SCRATCH_MNT/mnt/rsv-$tst_nr-$it
+	du -sch $SCRATCH_MNT/img >> $seqres.full
+	
+    done
+    umount $SCRATCH_MNT/mnt || _fail " umount fail"
+    _check_generic_filesystem $loop
+}
+
+for ((i=1; i <= 10; i++))
+do
+    _workout $i
+done
+
+_destroy_loop_device $loop
+
+status=0
+exit
diff --git a/tests/ext4/005.out b/tests/ext4/005.out
new file mode 100644
index 0000000..662c272
--- /dev/null
+++ b/tests/ext4/005.out
@@ -0,0 +1,36 @@
+QA output created by 005
+Start Round:1 iteration:0
+Start Round:2 iteration:0
+Start Round:2 iteration:1
+Start Round:3 iteration:0
+Start Round:3 iteration:1
+Start Round:4 iteration:0
+Start Round:4 iteration:1
+Start Round:4 iteration:2
+Start Round:5 iteration:0
+Start Round:5 iteration:1
+Start Round:5 iteration:2
+Start Round:6 iteration:0
+Start Round:6 iteration:1
+Start Round:6 iteration:2
+Start Round:6 iteration:3
+Start Round:7 iteration:0
+Start Round:7 iteration:1
+Start Round:7 iteration:2
+Start Round:7 iteration:3
+Start Round:8 iteration:0
+Start Round:8 iteration:1
+Start Round:8 iteration:2
+Start Round:8 iteration:3
+Start Round:8 iteration:4
+Start Round:9 iteration:0
+Start Round:9 iteration:1
+Start Round:9 iteration:2
+Start Round:9 iteration:3
+Start Round:9 iteration:4
+Start Round:10 iteration:0
+Start Round:10 iteration:1
+Start Round:10 iteration:2
+Start Round:10 iteration:3
+Start Round:10 iteration:4
+Start Round:10 iteration:5
diff --git a/tests/ext4/group b/tests/ext4/group
index e60d8fb..833c5c7 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -7,6 +7,7 @@
 002 auto quick prealloc
 003 auto quick
 004 auto ioctl resize
+005 auto ioctl resize
 271 auto rw quick
 301 aio dangerous ioctl rw stress
 302 aio dangerous ioctl rw stress
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ext4/004: Add new resize2fs functional test
  2014-12-09 19:27 [PATCH 1/2] ext4/004: Add new resize2fs functional test Dmitry Monakhov
  2014-12-09 19:27 ` [PATCH 2/2] ext4/005: Add new resize2fs stress test Dmitry Monakhov
@ 2014-12-12  0:21 ` Dave Chinner
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2014-12-12  0:21 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: fstests, linux-ext4

On Tue, Dec 09, 2014 at 11:27:26PM +0400, Dmitry Monakhov wrote:
> Perform online fs-resize(from 1T to 15T) and check that fs is usable
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  tests/ext4/004     | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/004.out |  16 +++++++++
>  tests/ext4/group   |   1 +
>  3 files changed, 117 insertions(+)
>  create mode 100755 tests/ext4/004
>  create mode 100644 tests/ext4/004.out
> 
> diff --git a/tests/ext4/004 b/tests/ext4/004
> new file mode 100755
> index 0000000..0c54ade
> --- /dev/null
> +++ b/tests/ext4/004
> @@ -0,0 +1,100 @@
> +#! /bin/bash
> +# FS QA Test No. 004
> +#
> +# Online resize2fs functional test
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2014 Dmitry Monakhov.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +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()
> +{
> +    _scratch_unmount
> +}

Why the custom cleanup function? It needs to cleanup $tmp, the test
harness will unmount the scratch device.


> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +E2FSCK_PROG="`set_prog_path e2fsck`"
> +RESIZE2FS_PROG="`set_prog_path resize2fs`"
> +_supported_fs ext4
> +_supported_os Linux
> +_require_command $MKFS_EXT4_PROG mkfs.ext4
> +_require_command $E2FSCK_PROG e2fsck
> +_require_command $RESIZE2FS_PROG resize2fs
> +_require_scratch
> +
> +# real QA test starts here
> +_scratch_mkfs  >> $seqres.full 2>&1
> +_scratch_mount
> +mkdir $SCRATCH_MNT/mnt
> +touch $SCRATCH_MNT/img

LOOP_DEV=$SCRATCH_MNT/img
LOOP_MNT=$SCRATCH_MNT/mnt

and use those everywhere.

> +truncate --size 1G $SCRATCH_MNT/img || _fail "Can not grow $SCRATCH_MNT/img"

$XFS_IO_PROG -c "truncate 1g" ....

> +$MKFS_EXT4_PROG -F -b 4096 -i $((1024*1024*64)) $MKFS_OPTIONS -O 64bit $SCRATCH_MNT/img \
> +    >> $seqres.full 2>&1 || _fail "$MKFS_EXT4_PROG failed see $seqres.full"

Indents are 8 space tabs. i.e.

$MKFS_EXT4_PROG -F -b 4096 -i $((1024*1024*64)) \
	$MKFS_OPTIONS -O 64bit $SCRATCH_MNT/img >> $seqres.full 2>&1 || \
	 _fail "$MKFS_EXT4_PROG failed see $seqres.full"

> +
> +for ((size = 1; size < 16; size++))
> +do
> +    truncate --size ${size}T $SCRATCH_MNT/img || _fail "Can not grow $SCRATCH_MNT/img file"
> +    loop=`_create_loop_device $SCRATCH_MNT/img`
> +    _mount -t $FSTYP $MOUNT_OPTIONS $loop $SCRATCH_MNT/mnt
> +
> +    echo "Resize to ${size}T"
> +    $RESIZE2FS_PROG $loop  >> $seqres.full 2>&1 || \
> +	_fail "Could not resize FS to $size Tb"

8 space tabs.

> +    du -sch $SCRATCH_MNT/img >> $seqres.full
> +    # Create space-holders
> +    for ((i=0 ; i < 1000;i++))
> +    do
> +	fallocate -l 1001M $SCRATCH_MNT/mnt/space-$size-$i

$XFS_IO_PROG -c "falloc ...

Also 8 space tabs...

> +    done
> +
> +    # Consume all space remaining
> +    fallocate -l 1T $SCRATCH_MNT/mnt/space-$size-last 2> /dev/null && \
> +	_fail "Too may space consumed"

Same.

> +    # Cut 1Mb for eash space-holders in order to create very fragmented fs
> +    for ((i=0 ; i < 1000;i++))
> +    do
> +	truncate --size 1000M $SCRATCH_MNT/mnt/space-$size-$i

$XFS_IO_PROG -c "truncate 1000m" ....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-12  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09 19:27 [PATCH 1/2] ext4/004: Add new resize2fs functional test Dmitry Monakhov
2014-12-09 19:27 ` [PATCH 2/2] ext4/005: Add new resize2fs stress test Dmitry Monakhov
2014-12-12  0:21 ` [PATCH 1/2] ext4/004: Add new resize2fs functional test Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).