diff mbox

[2/2] dm-thinp demo test

Message ID 5627FBE8.3030408@sandeen.net (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Sandeen Oct. 21, 2015, 8:56 p.m. UTC
Fairly trivial test to use the dm-thin infrastructure.

Right now it exhausts space in queue-on-error mode,
adds more space, does a bit more IO, then unmounts &
checks the fs.

Not sure if that's valid to test, but it works here and
demonstrates the common/dmthin helpers.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---





--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eryu Guan Oct. 22, 2015, 9:47 a.m. UTC | #1
On Wed, Oct 21, 2015 at 03:56:08PM -0500, Eric Sandeen wrote:
> Fairly trivial test to use the dm-thin infrastructure.
> 
> Right now it exhausts space in queue-on-error mode,
> adds more space, does a bit more IO, then unmounts &
> checks the fs.
> 
> Not sure if that's valid to test, but it works here and
> demonstrates the common/dmthin helpers.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> 
> 
> diff --git a/tests/generic/115 b/tests/generic/115
> new file mode 100755
> index 0000000..ef9d881
> --- /dev/null
> +++ b/tests/generic/115
> @@ -0,0 +1,85 @@
> +#! /bin/bash
> +# FS QA Test No. generic/115
> +#
> +# Test very basic thin device usage, exhaustion, and growth
> +#
> +# Copyright (c) 2015 Red Hat, Inc.  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
> +
> +BACKING_SIZE=$((500 * 1024 * 1024 / 512))	# 500M
> +VIRTUAL_SIZE=$((10 * $BACKING_SIZE))		# 5000M
> +GROW_SIZE=$((100 * 1024 * 1024 / 512))		# 100M
> +
> +_cleanup()
> +{
> +	_dmthin_cleanup
> +	rm -f $tmp.*
> +}
> +
> +_setup_thin()
> +{
> +	_dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
> +	_dmthin_set_queue
> +	_mkfs_dev $DMTHIN_VOL_DEV
> +	_dmthin_mount
> +}
> +
> +_workout()
> +{
> +	# Overfill it by a bit
> +	for I in `seq 1 500`; do
> +		$XFS_IO_PROG -f -c "pwrite -W 0 1M" $SCRATCH_MNT/file$I &>/dev/null
> +	done
> +
> +	sync
> +
> +	_dmthin_grow  $GROW_SIZE
> +
> +	# Write a little more, but don't fill
> +	for I in `seq 501 510`; do
> +		$XFS_IO_PROG -f -c "pwrite 0 1M" $SCRATCH_MNT/file$I &>/dev/null
> +	done
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/dmthin
> +
> +_supported_fs generic
> +_supported_os Linux
> +_need_to_be_root
> +_require_dm_target thin

This doesn't work for me with 4.3-rc4 kernel. I have to
"_require_dm_target thin-pool", modprobe dm-thin reports no module
found.

> +
> +_setup_thin
> +_dmthin_set_queue

This one or the one in _setup_thin can be removed?

> +_workout
> +_dmthin_check_fs

btrfs fails the fs check, because btrfs changes lv device name in df
output, from /dev/mapper/xxx to /dev/dm-x, so _check_scratch_fs couldn't
umount it and btrfsck runs on mounted btrfs.

Adding "$UMOUNT_PROG $SCRATCH_MNT" before _dmthin_check_fs is a
workaround, though I think it's a btrfs issue.

Thanks,
Eryu

> +_dmthin_cleanup
> +
> +echo "=== completed"
> +
> +status=0
> +exit
> diff --git a/tests/generic/115.out b/tests/generic/115.out
> new file mode 100644
> index 0000000..39ebd87
> --- /dev/null
> +++ b/tests/generic/115.out
> @@ -0,0 +1,2 @@
> +QA output created by 115
> +=== completed
> diff --git a/tests/generic/group b/tests/generic/group
> index 1dd4269..729578d 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -115,6 +115,7 @@
>  112 rw aio auto quick
>  113 rw aio auto quick
>  114 rw aio auto quick
> +115 rw thin auto quick
>  117 attr auto quick
>  120 other auto quick
>  123 perms auto quick
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen Oct. 22, 2015, 2:14 p.m. UTC | #2
On 10/22/15 4:47 AM, Eryu Guan wrote:
> On Wed, Oct 21, 2015 at 03:56:08PM -0500, Eric Sandeen wrote:
>> Fairly trivial test to use the dm-thin infrastructure.
>>
>> Right now it exhausts space in queue-on-error mode,
>> adds more space, does a bit more IO, then unmounts &
>> checks the fs.
>>
>> Not sure if that's valid to test, but it works here and
>> demonstrates the common/dmthin helpers.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>>
>>
>> diff --git a/tests/generic/115 b/tests/generic/115
>> new file mode 100755
>> index 0000000..ef9d881
>> --- /dev/null
>> +++ b/tests/generic/115
>> @@ -0,0 +1,85 @@
>> +#! /bin/bash
>> +# FS QA Test No. generic/115
>> +#
>> +# Test very basic thin device usage, exhaustion, and growth
>> +#
>> +# Copyright (c) 2015 Red Hat, Inc.  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
>> +
>> +BACKING_SIZE=$((500 * 1024 * 1024 / 512))	# 500M
>> +VIRTUAL_SIZE=$((10 * $BACKING_SIZE))		# 5000M
>> +GROW_SIZE=$((100 * 1024 * 1024 / 512))		# 100M
>> +
>> +_cleanup()
>> +{
>> +	_dmthin_cleanup
>> +	rm -f $tmp.*
>> +}
>> +
>> +_setup_thin()
>> +{
>> +	_dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
>> +	_dmthin_set_queue
>> +	_mkfs_dev $DMTHIN_VOL_DEV
>> +	_dmthin_mount
>> +}
>> +
>> +_workout()
>> +{
>> +	# Overfill it by a bit
>> +	for I in `seq 1 500`; do
>> +		$XFS_IO_PROG -f -c "pwrite -W 0 1M" $SCRATCH_MNT/file$I &>/dev/null
>> +	done
>> +
>> +	sync
>> +
>> +	_dmthin_grow  $GROW_SIZE
>> +
>> +	# Write a little more, but don't fill
>> +	for I in `seq 501 510`; do
>> +		$XFS_IO_PROG -f -c "pwrite 0 1M" $SCRATCH_MNT/file$I &>/dev/null
>> +	done
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/dmthin
>> +
>> +_supported_fs generic
>> +_supported_os Linux
>> +_need_to_be_root
>> +_require_dm_target thin
> 
> This doesn't work for me with 4.3-rc4 kernel. I have to
> "_require_dm_target thin-pool", modprobe dm-thin reports no module
> found.

whoops, yep, sorry - i already had it loaded, and the modprobe
failure isn't fatal.  Should be thin-pool - thanks.

>> +
>> +_setup_thin
>> +_dmthin_set_queue
> 
> This one or the one in _setup_thin can be removed?

Yep, will do.

>> +_workout
>> +_dmthin_check_fs
> 
> btrfs fails the fs check, because btrfs changes lv device name in df
> output, from /dev/mapper/xxx to /dev/dm-x, so _check_scratch_fs couldn't
> umount it and btrfsck runs on mounted btrfs.

Huh, weird.  I'll admit that I did not test btrfs.  Other filesystems
worked for you?  I'm not sure how btrfs can change df output...

mapper symlinks have been a constant source of pain for fstests.  :(

> Adding "$UMOUNT_PROG $SCRATCH_MNT" before _dmthin_check_fs is a
> workaround, though I think it's a btrfs issue.

Hm, ok, thanks; easy enough to do that I guess.

-Eric
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen Oct. 22, 2015, 2:36 p.m. UTC | #3
On 10/22/15 9:14 AM, Eric Sandeen wrote:
>>> +_workout
>>> >> +_dmthin_check_fs
>> > 
>> > btrfs fails the fs check, because btrfs changes lv device name in df
>> > output, from /dev/mapper/xxx to /dev/dm-x, so _check_scratch_fs couldn't
>> > umount it and btrfsck runs on mounted btrfs.
> Huh, weird.  I'll admit that I did not test btrfs.  Other filesystems
> worked for you?  I'm not sure how btrfs can change df output...
> 
> mapper symlinks have been a constant source of pain for fstests.  :(
> 
>> > Adding "$UMOUNT_PROG $SCRATCH_MNT" before _dmthin_check_fs is a
>> > workaround, though I think it's a btrfs issue.
> Hm, ok, thanks; easy enough to do that I guess.

ALthough, it seems to be working for me here; I do fail because btrfs
emits a warning in dmesg:

[215098.204612] BTRFS warning (device dm-6): Skipping commit of aborted transaction.
[215098.212074] ------------[ cut here ]------------
[215098.216794] WARNING: CPU: 3 PID: 19408 at fs/btrfs/transaction.c:1708 cleanup_transaction+0x86/0x2c0 [btrfs]()

which leads to:

_check_dmesg: something found in dmesg (see /mnt/test2/git/xfstests/results//generic/115.dmesg)
Ran: generic/115
Failures: generic/115

It's "just" a warning, though, so I'm not really sure this should be failing the test.

-Eric
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan Feb. 5, 2016, 3:58 a.m. UTC | #4
On Thu, Feb 04, 2016 at 06:04:21PM +0800, Xiong Zhou wrote:
> From: Eric Sandeen <sandeen@redhat.com>
> 
> Fairly trivial test to use the dm-thin infrastructure.
> 
> Right now it exhausts space in queue-on-error mode,
> adds more space, does a bit more IO, then unmounts &
> checks the fs.
> 
> Not sure if that's valid to test, but it works here and
> demonstrates the common/dmthin helpers.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>

Looks good to me. Thanks!

Reviewed-by: Eryu Guan <eguan@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/generic/115 b/tests/generic/115
new file mode 100755
index 0000000..ef9d881
--- /dev/null
+++ b/tests/generic/115
@@ -0,0 +1,85 @@ 
+#! /bin/bash
+# FS QA Test No. generic/115
+#
+# Test very basic thin device usage, exhaustion, and growth
+#
+# Copyright (c) 2015 Red Hat, Inc.  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
+
+BACKING_SIZE=$((500 * 1024 * 1024 / 512))	# 500M
+VIRTUAL_SIZE=$((10 * $BACKING_SIZE))		# 5000M
+GROW_SIZE=$((100 * 1024 * 1024 / 512))		# 100M
+
+_cleanup()
+{
+	_dmthin_cleanup
+	rm -f $tmp.*
+}
+
+_setup_thin()
+{
+	_dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
+	_dmthin_set_queue
+	_mkfs_dev $DMTHIN_VOL_DEV
+	_dmthin_mount
+}
+
+_workout()
+{
+	# Overfill it by a bit
+	for I in `seq 1 500`; do
+		$XFS_IO_PROG -f -c "pwrite -W 0 1M" $SCRATCH_MNT/file$I &>/dev/null
+	done
+
+	sync
+
+	_dmthin_grow  $GROW_SIZE
+
+	# Write a little more, but don't fill
+	for I in `seq 501 510`; do
+		$XFS_IO_PROG -f -c "pwrite 0 1M" $SCRATCH_MNT/file$I &>/dev/null
+	done
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/dmthin
+
+_supported_fs generic
+_supported_os Linux
+_need_to_be_root
+_require_dm_target thin
+
+_setup_thin
+_dmthin_set_queue
+_workout
+_dmthin_check_fs
+_dmthin_cleanup
+
+echo "=== completed"
+
+status=0
+exit
diff --git a/tests/generic/115.out b/tests/generic/115.out
new file mode 100644
index 0000000..39ebd87
--- /dev/null
+++ b/tests/generic/115.out
@@ -0,0 +1,2 @@ 
+QA output created by 115
+=== completed
diff --git a/tests/generic/group b/tests/generic/group
index 1dd4269..729578d 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -115,6 +115,7 @@ 
 112 rw aio auto quick
 113 rw aio auto quick
 114 rw aio auto quick
+115 rw thin auto quick
 117 attr auto quick
 120 other auto quick
 123 perms auto quick