From: Dmitry Monakhov Date: Wed, 20 Feb 2013 10:42:14 +0000 (+0000) Subject: xfstest: add defragmentation stress tests for ext4 X-Git-Tag: v2022.05.01~3533 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a3d92a6cbdf9e98d8e256974b50b025d1d4575ec;p=xfstests-dev.git xfstest: add defragmentation stress tests for ext4 Perform various regression tests for ext4defrag subsystem 301'th Test1: Defragment file while other task does direct AIO 302'th Test2: Perform defragmentation on file under buffered AIO while third task does direct AIO to donor file 303'th Test3: Two defrag tasks use common donor file. 304'th Test4: Stress defragmentation. Several threads perform fragmentation at random position use inplace=1 will allocate and free blocks inside defrag event improve load pressure. This tests are considered dangerous because 302'th and 303'th are known to trigger OOPS on recent kernels see:https://gist.github.com/dmonakhov/4770294 Signed-off-by: Dmitry Monakhov Reviewed-by: Rich Johnston Signed-off-by: Rich Johnston --- diff --git a/301 b/301 new file mode 100644 index 00000000..fe2e59f3 --- /dev/null +++ b/301 @@ -0,0 +1,126 @@ +#! /bin/bash +# FSQA Test No. 301 +# +# Ext4 defragmentation stress test +# Defragment file while other task does direct io +#----------------------------------------------------------------------- +# (c) 2013 Dmitry Monakhov +# +# 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 +# +#----------------------------------------------------------------------- +# +# creator +owner=dmonakhov@openvz.org + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.defrag + +# real QA test starts here +_supported_os Linux +_supported_fs ext4 +_need_to_be_root +_require_scratch +_require_defrag + +NUM_JOBS=$((4*LOAD_FACTOR)) +BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` +# We need space for 2 files (test file, and donor one) +# reserve 30% in order to avoid ENOSPC +FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1)))) + +cat >$tmp-$seq.fio <> $seq.full + run_check $FIO_PROG $tmp-$seq.fio +} + +_require_fio $tmp-$seq.fio + +_scratch_mkfs >> $seq.full 2>&1 +_scratch_mount + +if ! _workout; then + umount $SCRATCH_DEV 2>/dev/null + exit +fi + +if ! _scratch_unmount; then + echo "failed to umount" + status=1 + exit +fi +_check_scratch_fs +status=$? diff --git a/301.out b/301.out new file mode 100644 index 00000000..044a6852 --- /dev/null +++ b/301.out @@ -0,0 +1,4 @@ +QA output created by 301 + + Start defragment activity + diff --git a/302 b/302 new file mode 100644 index 00000000..e3dceb8d --- /dev/null +++ b/302 @@ -0,0 +1,143 @@ +#! /bin/bash +# FSQA Test No. 302 +# +# Ext4 defragmentation stress test +# Perform defragmentation on file under buffered io +# while third task does direct io to donor file +#----------------------------------------------------------------------- +# (c) 2013 Dmitry Monakhov +# +# 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 +# +#----------------------------------------------------------------------- +# +# creator +owner=dmonakhov@openvz.org + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.defrag + +# real QA test starts here +_supported_os Linux +_supported_fs ext4 +_need_to_be_root +_require_scratch +_require_defrag + +BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` +# We need space for 2 files (test file, and donor one) +# reserve 30% in order to avoid ENOSPC +FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1)))) + +cat >$tmp-$seq.fio <> $seq.full + run_check $FIO_PROG $tmp-$seq.fio +} + +_require_fio $tmp-$seq.fio + +_scratch_mkfs >> $seq.full 2>&1 +_scratch_mount + +if ! _workout; then + umount $SCRATCH_DEV 2>/dev/null + exit +fi + +if ! _scratch_unmount; then + echo "failed to umount" + status=1 + exit +fi +_check_scratch_fs +status=$? +exit diff --git a/302.out b/302.out new file mode 100644 index 00000000..5491feda --- /dev/null +++ b/302.out @@ -0,0 +1,4 @@ +QA output created by 302 + + Start defragment activity + diff --git a/303 b/303 new file mode 100644 index 00000000..41414425 --- /dev/null +++ b/303 @@ -0,0 +1,153 @@ +#! /bin/bash +# FSQA Test No. 303 +# +# Ext4 defragmentation stress test +# Two defrag tasks use common donor file +# +#----------------------------------------------------------------------- +# (c) 2013 Dmitry Monakhov +# +# 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 +# +#----------------------------------------------------------------------- +# +# creator +owner=dmonakhov@openvz.org + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.defrag + +# real QA test starts here +_supported_os Linux +_supported_fs ext4 +_need_to_be_root +_require_scratch +_require_defrag + +BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` +# We need space for 3 files (one donor file and two test files) +# Reserve space for 4 files in order to avoid ENOSPC +FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1)))) + +cat >$tmp-$seq.fio <> $seq.full + run_check $FIO_PROG $tmp-$seq.fio +} + +_require_fio $tmp-$seq.fio + +_scratch_mkfs >> $seq.full 2>&1 +_scratch_mount + +if ! _workout; then + umount $SCRATCH_DEV 2>/dev/null + exit +fi + +if ! _scratch_unmount; then + echo "failed to umount" + status=1 + exit +fi +_check_scratch_fs +status=$? +exit diff --git a/303.out b/303.out new file mode 100644 index 00000000..a7a2e672 --- /dev/null +++ b/303.out @@ -0,0 +1,4 @@ +QA output created by 303 + + Start defragment activity + diff --git a/304 b/304 new file mode 100644 index 00000000..5c414bd9 --- /dev/null +++ b/304 @@ -0,0 +1,130 @@ +#! /bin/bash +# FSQA Test No. 304 +# +# Ext4 defragmentation stress test +# Several threads perform defragmentation at random position +# using 'inplace' mode (allocate and free blocks inside defrag event) +# which significantly improve load pressure on block allocator. +#----------------------------------------------------------------------- +# (c) 2013 Dmitry Monakhov +# +# 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 +# +#----------------------------------------------------------------------- +# +# creator +owner=dmonakhov@openvz.org + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.defrag + +# real QA test starts here +_supported_os Linux +_supported_fs ext4 +_need_to_be_root +_require_scratch +_require_defrag + +BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` +# We need space for 2 files (test file, and donor one) +# reserve 30% in order to avoid ENOSPC +FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1)))) + +cat >$tmp-$seq.fio <> $seq.full + run_check $FIO_PROG $tmp-$seq.fio +} + +_require_fio $tmp-$seq.fio + +_scratch_mkfs >> $seq.full 2>&1 +_scratch_mount + +if ! _workout; then + umount $SCRATCH_DEV 2>/dev/null + exit +fi + +if ! _scratch_unmount; then + echo "failed to umount" + status=1 + exit +fi +_check_scratch_fs +status=$? +exit diff --git a/304.out b/304.out new file mode 100644 index 00000000..c8615d6c --- /dev/null +++ b/304.out @@ -0,0 +1,4 @@ +QA output created by 304 + + Start defragment activity + diff --git a/common.defrag b/common.defrag index ea6c14ce..84b1e65b 100644 --- a/common.defrag +++ b/common.defrag @@ -24,10 +24,10 @@ _require_defrag() { case "$FSTYP" in xfs) - DEFRAG_PROG=/usr/sbin/xfs_fsr + DEFRAG_PROG="`set_prog_path xfs_fsr`" ;; ext4|ext4dev) - DEFRAG_PROG=/usr/bin/e4defrag + DEFRAG_PROG="`set_prog_path e4defrag`" ;; btrfs) DEFRAG_PROG="$BTRFS_UTIL_PROG filesystem defragment" diff --git a/group b/group index 33898b76..da975d3e 100644 --- a/group +++ b/group @@ -424,3 +424,7 @@ stress 298 auto trim 299 auto aio enospc rw stress 300 auto aio enospc preallocrw stress +301 aio dangerous ioctl rw stress +302 aio dangerous ioctl rw stress +303 aio dangerous ioctl rw stress +304 aio dangerous ioctl rw stress