--- /dev/null
+#! /bin/bash
+# FS QA Test No. generic/012
+#
+# Multi collapse range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for fcollapse range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Samsung Electronics. 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!
+
+_cleanup()
+{
+ rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_falloc_punch
+_require_xfs_io_falloc
+_require_xfs_io_fiemap
+_require_xfs_io_falloc_collapse
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch -k falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
+_check_test_fs
+
+status=0
+exit
--- /dev/null
+QA output created by 012
+ 1. into a hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 2. into allocated space
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
+ 3. into unwritten space
+0: [0..95]: extent
+f07217d5ac7ffa15dd8910c4aa912674
+ 4. hole -> data
+0: [0..63]: extent
+1: [64..95]: hole
+e5c94f6299822646f9f57aeacd8bdc01
+ 5. hole -> unwritten
+0: [0..63]: extent
+1: [64..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 6. data -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 7. data -> unwritten
+0: [0..63]: extent
+1: [64..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 8. unwritten -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 9. unwritten -> data
+0: [0..63]: extent
+1: [64..95]: hole
+e5c94f6299822646f9f57aeacd8bdc01
+ 10. hole -> data -> hole
+0: [0..31]: extent
+1: [32..63]: hole
+76cc863b386460b228a493933813a6a0
+ 11. data -> hole -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 12. unwritten -> data -> unwritten
+0: [0..63]: extent
+76cc863b386460b228a493933813a6a0
+ 13. data -> unwritten -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 14. data -> hole @ 0
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
--- /dev/null
+#! /bin/bash
+# FS QA Test No. generic/016
+#
+# Delayed allocation multi collapse range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for fcollapse range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Samsung Electronics. 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!
+
+_cleanup()
+{
+ rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_falloc_punch
+_require_xfs_io_falloc
+_require_xfs_io_fiemap
+_require_xfs_io_falloc_collapse
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch -d -k falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
+_check_test_fs
+
+status=0
+exit
--- /dev/null
+QA output created by 016
+ 1. into a hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 2. into allocated space
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
+ 3. into unwritten space
+0: [0..95]: extent
+f07217d5ac7ffa15dd8910c4aa912674
+ 4. hole -> data
+0: [0..63]: extent
+1: [64..95]: hole
+e5c94f6299822646f9f57aeacd8bdc01
+ 5. hole -> unwritten
+0: [0..63]: extent
+1: [64..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 6. data -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 7. data -> unwritten
+0: [0..63]: extent
+1: [64..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 8. unwritten -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 9. unwritten -> data
+0: [0..63]: extent
+1: [64..95]: hole
+e5c94f6299822646f9f57aeacd8bdc01
+ 10. hole -> data -> hole
+0: [0..31]: extent
+1: [32..63]: hole
+76cc863b386460b228a493933813a6a0
+ 11. data -> hole -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 12. unwritten -> data -> unwritten
+0: [0..63]: extent
+76cc863b386460b228a493933813a6a0
+ 13. data -> unwritten -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 14. data -> hole @ 0
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
--- /dev/null
+#! /bin/bash
+# FS QA Test No. generci/017
+#
+# Test multiple fallocate collapse range calls on same file.
+# For different blocksizes, collapse a single alternate block multiple times
+# until the file is left with 80 blocks and as much number of extents.
+# Also check for file system consistency after completing this operation
+# for each blocksize.
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Samsung Electronics. 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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_scratch
+_require_xfs_io_fiemap
+_require_xfs_io_falloc_collapse
+_do_die_on_error=y
+testfile=$SCRATCH_MNT/$seq.$$
+BLOCKS=10240
+
+for (( BSIZE = 1024; BSIZE <= 4096; BSIZE *= 2 )); do
+
+ length=$(($BLOCKS * $BSIZE))
+ case $FSTYP in
+ xfs)
+ _scratch_mkfs -b size=$BSIZE >> $seqres.full 2>&1
+ ;;
+ ext4)
+ _scratch_mkfs -b $BSIZE >> $seqres.full 2>&1
+ ;;
+ esac
+ _scratch_mount >> $seqres.full 2>&1
+
+ # Write file
+ $XFS_IO_PROG -f -c "pwrite 0 $length" -c fsync $testfile > /dev/null
+
+ # Collapse alternate blocks
+ for (( i = 1; i <= 7; i++ )); do
+ for (( j=0; j < $(($BLOCKS/(2**$i))); j++ )); do
+ offset=$(($j*$BSIZE))
+ $XFS_IO_PROG -c "fcollapse $offset $BSIZE" $testfile > /dev/null
+ done
+ done
+
+ # Check if 80 extents are present
+ $XFS_IO_PROG -c "fiemap -v" $testfile | grep "^ *[0-9]*:" |wc -l
+
+ _check_scratch_fs
+ if [ $? -ne 0 ]; then
+ status=1
+ exit
+ fi
+
+ umount $SCRATCH_MNT
+done
+
+# success, all done
+status=0
+exit
--- /dev/null
+QA output created by 017
+80
+80
+80
--- /dev/null
+#! /bin/bash
+# FS QA Test No. generic/018
+#
+# Basic defragmentation sanity tests
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2009 Eric Sandeen. 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
+. ./common/defrag
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+# We require scratch so that we'll have free contiguous space
+_require_scratch
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
+_require_defrag
+
+fragfile=$SCRATCH_MNT/fragfile.$$
+
+rm -f $fragfile
+
+# Craft some fragmented files, defrag them, check the result.
+
+echo "zero-length file:" | tee -a $seqres.full
+touch $fragfile
+_defrag $fragfile
+
+echo "Sparse file (no blocks):" | tee -a $seqres.full
+$XFS_IO_PROG -f -c "truncate 1m" $fragfile
+_defrag $fragfile
+
+echo "Contiguous file:" | tee -a $seqres.full
+dd if=/dev/zero of=$fragfile bs=4k count=4 &>/dev/null
+_defrag $fragfile
+
+echo "Write backwards sync, but contiguous - should defrag to 1 extent" | tee -a $seqres.full
+for I in `seq 9 -1 0`; do
+ dd if=/dev/zero of=$fragfile bs=4k count=1 conv=notrunc seek=$I oflag=sync &>/dev/null
+done
+_defrag $fragfile
+
+echo "Write backwards sync leaving holes - defrag should do nothing" | tee -a $seqres.full
+for I in `seq 31 -2 0`; do
+ dd if=/dev/zero of=$fragfile bs=4k count=1 conv=notrunc seek=$I oflag=sync &>/dev/null
+done
+_defrag $fragfile
+
+echo "Write forwards sync leaving holes - defrag should do nothing" | tee -a $seqres.full
+for I in `seq 0 2 31`; do
+ dd if=/dev/zero of=$fragfile bs=4k count=1 conv=notrunc seek=$I oflag=sync &>/dev/null
+done
+_defrag $fragfile
+
+rm -f $seqres.full
+status=0
+exit
--- /dev/null
+QA output created by 018
+zero-length file:
+Before: 0
+After: 0
+Sparse file (no blocks):
+Before: 0
+After: 0
+Contiguous file:
+Before: 1
+After: 1
+Write backwards sync, but contiguous - should defrag to 1 extent
+Before: 10
+After: 1
+Write backwards sync leaving holes - defrag should do nothing
+Before: 16
+After: 16
+Write forwards sync leaving holes - defrag should do nothing
+Before: 16
+After: 16
--- /dev/null
+#! /bin/bash
+# FSQA Test No. generic/019
+#
+# Run fsstress and fio(dio/aio and mmap) and simulate disk failure
+# check filesystem consistency at the end.
+#
+#-----------------------------------------------------------------------
+# (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
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+fio_config=$tmp.fio
+status=1 # failure is the default!
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+_supported_fs generic
+_supported_os Linux
+_need_to_be_root
+_require_scratch
+_require_fail_make_request
+
+# TODO: Function are common enough to be moved to common/blkdev
+SCRATCH_REAL_DEV=`readlink -f $SCRATCH_DEV`
+SCRATCH_BDEV=`basename $SCRATCH_REAL_DEV`
+
+allow_fail_make_request()
+{
+ echo "Allow global fail_make_request feature"
+ echo 100 > $DEBUGFS_MNT/fail_make_request/probability
+ echo 9999999 > $DEBUGFS_MNT/fail_make_request/times
+ echo 0 > /sys/kernel/debug/fail_make_request/verbose
+}
+
+disallow_fail_make_request()
+{
+ echo "Disallow global fail_make_request feature"
+ echo 0 > $DEBUGFS_MNT/fail_make_request/probability
+ echo 0 > $DEBUGFS_MNT/fail_make_request/times
+}
+
+start_fail_scratch_dev()
+{
+ echo "Force SCRATCH_DEV device failure"
+ echo " echo 1 > /sys/block/$SCRATCH_BDEV/make-it-fail" >> $seqres.full
+ echo 1 > /sys/block/$SCRATCH_BDEV/make-it-fail
+
+}
+
+stop_fail_scratch_dev()
+{
+ echo "Make SCRATCH_DEV device operable again"
+ echo " echo 0 > /sys/block/$SCRATCH_BDEV/make-it-fail" >> $seqres.full
+ echo 0 > /sys/block/$SCRATCH_BDEV/make-it-fail
+
+}
+
+_cleanup()
+{
+ poweron_scratch_dev
+ disallow_fail_make_request
+ rm -f $tmp.*
+}
+trap "_cleanup; exit \$status" 1 2 3 15
+
+RUN_TIME=$((20+10*$TIME_FACTOR))
+NUM_JOBS=$((4*LOAD_FACTOR))
+BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
+FILE_SIZE=$((BLK_DEV_SIZE * 512))
+
+cat >$fio_config <<EOF
+###########
+# $seq test's fio activity
+# Filenames derived from jobsname and jobid like follows:
+# ${JOB_NAME}.${JOB_ID}.${ITERATION_ID}
+[global]
+ioengine=libaio
+bs=4k
+directory=${SCRATCH_MNT}
+filesize=${FILE_SIZE}
+size=9999T
+continue_on_error=write
+ignore_error=EIO,ENOSPC:EIO
+error_dump=0
+
+[stress_dio_aio_activity]
+create_on_open=1
+fallocate=none
+iodepth=128*${LOAD_FACTOR}
+direct=1
+buffered=0
+numjobs=${NUM_JOBS}
+rw=randwrite
+runtime=40+${RUN_TIME}
+time_based
+
+[stress_mmap_activity]
+ioengine=mmap
+create_on_open=0
+fallocate=1
+fdatasync=40960
+filesize=8M
+size=9999T
+numjobs=${NUM_JOBS}
+rw=randwrite
+runtime=40+${RUN_TIME}
+time_based
+
+EOF
+
+_require_fio $fio_config
+
+# Disable all sync operations to get higher load
+FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0 -f setattr=1"
+
+_workout()
+{
+ out=$SCRATCH_MNT/fsstress.$$
+ args=`_scale_fsstress_args -p 1 -n999999999 -f setattr=0 $FSSTRESS_AVOID -d $out`
+ echo ""
+ echo "Start fsstress.."
+ echo ""
+ echo "fsstress $args" >> $seqres.full
+ $FSSTRESS_PROG $args > /dev/null 2>&1 &
+ fs_pid=$!
+ echo "Start fio.."
+ cat $fio_config >> $seqres.full
+ $FIO_PROG $fio_config >> $seqres.full 2>&1 &
+ fio_pid=$!
+
+ # Let's it work for awhile, and force device failure
+ sleep $RUN_TIME
+ start_fail_scratch_dev
+ # After device turns in to failed state filesystem may yet not know about
+ # that so buffered write(2) may succeed, but any integrity operations
+ # such as (sync, fsync, fdatasync, direct-io) should fail.
+ dd if=/dev/zero of=$SCRATCH_MNT/touch_failed_filesystem count=1 bs=4k conv=fsync \
+ >> $seqres.full 2>&1 && \
+ _fail "failed: still able to perform integrity fsync on $SCRATCH_MNT"
+
+ kill $fs_pid
+ wait $fs_pid
+ wait $fio_pid
+
+ # We expect that broken FS still can be umounted
+ run_check umount $SCRATCH_DEV
+ # Once filesystem was umounted no one is able to write to block device
+ # It is now safe to bring device back to normal state
+ stop_fail_scratch_dev
+
+ # In order to check that filesystem is able to recover journal on mount(2)
+ # perform mount/umount, after that all errors should be fixed
+ run_check _scratch_mount
+ run_check _scratch_unmount
+ _check_scratch_fs
+}
+
+# real QA test starts here
+
+_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mount || _fail "mount failed"
+allow_fail_make_request
+_workout
+status=$?
+disallow_fail_make_request
+exit
--- /dev/null
+QA output created by 019
+Allow global fail_make_request feature
+
+Start fsstress..
+
+Start fio..
+Force SCRATCH_DEV device failure
+Make SCRATCH_DEV device operable again
+Disallow global fail_make_request feature
--- /dev/null
+#! /bin/bash
+# FS QA Test No. generic/021
+#
+# Standard collapse range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for fcollapse range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Samsung Electronics. 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!
+
+_cleanup()
+{
+ rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_falloc_punch
+_require_xfs_io_falloc
+_require_xfs_io_fiemap
+_require_xfs_io_falloc_collapse
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
+_check_test_fs
+
+status=0
+exit
--- /dev/null
+QA output created by 021
+ 1. into a hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 2. into allocated space
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
+ 3. into unwritten space
+0: [0..95]: extent
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 4. hole -> data
+0: [0..31]: hole
+1: [32..63]: extent
+2: [64..95]: hole
+d8f51c20223dbce5c7c90db87bc221b0
+ 5. hole -> unwritten
+0: [0..31]: hole
+1: [32..63]: extent
+2: [64..95]: hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 6. data -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 7. data -> unwritten
+0: [0..63]: extent
+1: [64..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 8. unwritten -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 9. unwritten -> data
+0: [0..63]: extent
+1: [64..95]: hole
+d8f51c20223dbce5c7c90db87bc221b0
+ 10. hole -> data -> hole
+bb7df04e1b0a2570657527a7e108ae23
+ 11. data -> hole -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 12. unwritten -> data -> unwritten
+0: [0..63]: extent
+bb7df04e1b0a2570657527a7e108ae23
+ 13. data -> unwritten -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 14. data -> hole @ 0
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
--- /dev/null
+#! /bin/bash
+# FS QA Test No. generic/022
+#
+# Delayed allocation collapse range tests
+# This testcase is one of the 4 testcases which tries to
+# test various corner cases for fcollapse range functionality over different
+# type of extents. These tests are based on generic/255 test case.
+# For the type of tests, check the description of _test_generic_punch
+# in common/rc.
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Samsung Electronics. 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!
+
+_cleanup()
+{
+ rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+# we need to include common/punch to get defination fo filter functions
+. ./common/rc
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_xfs_io_falloc_punch
+_require_xfs_io_falloc
+_require_xfs_io_fiemap
+_require_xfs_io_falloc_collapse
+
+testfile=$TEST_DIR/$seq.$$
+
+_test_generic_punch -d falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
+_check_test_fs
+
+status=0
+exit
--- /dev/null
+QA output created by 009
+ 1. into a hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 2. into allocated space
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
+ 3. into unwritten space
+0: [0..95]: extent
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 4. hole -> data
+0: [0..31]: hole
+1: [32..63]: extent
+2: [64..95]: hole
+d8f51c20223dbce5c7c90db87bc221b0
+ 5. hole -> unwritten
+0: [0..31]: hole
+1: [32..63]: extent
+2: [64..95]: hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 6. data -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 7. data -> unwritten
+0: [0..63]: extent
+1: [64..95]: hole
+f07217d5ac7ffa15dd8910c4aa912674
+ 8. unwritten -> hole
+0: [0..31]: extent
+1: [32..95]: hole
+f4f35d60b3cc18aaa6d8d92f0cd3708a
+ 9. unwritten -> data
+0: [0..63]: extent
+1: [64..95]: hole
+d8f51c20223dbce5c7c90db87bc221b0
+ 10. hole -> data -> hole
+bb7df04e1b0a2570657527a7e108ae23
+ 11. data -> hole -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 12. unwritten -> data -> unwritten
+0: [0..63]: extent
+bb7df04e1b0a2570657527a7e108ae23
+ 13. data -> unwritten -> data
+0: [0..63]: extent
+0f0151cbed83e4bf6e5bde26e82ab115
+ 14. data -> hole @ 0
+0: [0..95]: extent
+f1894a71ac539f6f90426d98a4990a47
009 auto quick prealloc
010 other udf auto
011 dir udf auto quick
+012 auto quick prealloc
013 other ioctl udf auto quick
014 rw udf auto quick
015 other auto quick
+016 auto quick prealloc
+017 auto prealloc
+018 auto fsr quick
+019 aio dangerous enospc rw stress
020 metadata attr udf auto quick
+021 auto quick prealloc
+022 auto quick prealloc
053 acl repair auto quick
062 attr udf auto quick
068 other auto freeze dangerous stress
+++ /dev/null
-#! /bin/bash
-# FS QA Test No. shared/001
-#
-# Standard collapse range tests
-# This testcase is one of the 4 testcases (shared 001 - 004) which tries to
-# test various corner cases for fcollapse range functionality over different
-# type of extents. These tests are based on generic/255 test case.
-# For the type of tests, check the description of _test_generic_punch
-# in common/rc.
-#-----------------------------------------------------------------------
-# Copyright (c) 2013 Samsung Electronics. 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!
-
-_cleanup()
-{
- rm -f $tmp.*
-}
-
-trap "_cleanup ; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-# we need to include common/punch to get defination fo filter functions
-. ./common/rc
-. ./common/filter
-. ./common/punch
-
-# real QA test starts here
-_supported_fs xfs ext4
-_supported_os Linux
-
-_require_xfs_io_falloc_punch
-_require_xfs_io_falloc
-_require_xfs_io_fiemap
-_require_xfs_io_falloc_collapse
-
-testfile=$TEST_DIR/$seq.$$
-
-_test_generic_punch falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
-_check_test_fs
-
-status=0
-exit
+++ /dev/null
-QA output created by 001
- 1. into a hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 2. into allocated space
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
- 3. into unwritten space
-0: [0..95]: extent
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 4. hole -> data
-0: [0..31]: hole
-1: [32..63]: extent
-2: [64..95]: hole
-d8f51c20223dbce5c7c90db87bc221b0
- 5. hole -> unwritten
-0: [0..31]: hole
-1: [32..63]: extent
-2: [64..95]: hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 6. data -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 7. data -> unwritten
-0: [0..63]: extent
-1: [64..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 8. unwritten -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 9. unwritten -> data
-0: [0..63]: extent
-1: [64..95]: hole
-d8f51c20223dbce5c7c90db87bc221b0
- 10. hole -> data -> hole
-bb7df04e1b0a2570657527a7e108ae23
- 11. data -> hole -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 12. unwritten -> data -> unwritten
-0: [0..63]: extent
-bb7df04e1b0a2570657527a7e108ae23
- 13. data -> unwritten -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 14. data -> hole @ 0
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
+++ /dev/null
-#! /bin/bash
-# FS QA Test No. shared/002
-#
-# Delayed allocation collapse range tests
-# This testcase is one of the 4 testcases (shared 001 - 004) which tries to
-# test various corner cases for fcollapse range functionality over different
-# type of extents. These tests are based on generic/255 test case.
-# For the type of tests, check the description of _test_generic_punch
-# in common/rc.
-#-----------------------------------------------------------------------
-# Copyright (c) 2013 Samsung Electronics. 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!
-
-_cleanup()
-{
- rm -f $tmp.*
-}
-
-trap "_cleanup ; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-# we need to include common/punch to get defination fo filter functions
-. ./common/rc
-. ./common/filter
-. ./common/punch
-
-# real QA test starts here
-_supported_fs xfs ext4
-_supported_os Linux
-
-_require_xfs_io_falloc_punch
-_require_xfs_io_falloc
-_require_xfs_io_fiemap
-_require_xfs_io_falloc_collapse
-
-testfile=$TEST_DIR/$seq.$$
-
-_test_generic_punch -d falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
-_check_test_fs
-
-status=0
-exit
+++ /dev/null
-QA output created by 002
- 1. into a hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 2. into allocated space
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
- 3. into unwritten space
-0: [0..95]: extent
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 4. hole -> data
-0: [0..31]: hole
-1: [32..63]: extent
-2: [64..95]: hole
-d8f51c20223dbce5c7c90db87bc221b0
- 5. hole -> unwritten
-0: [0..31]: hole
-1: [32..63]: extent
-2: [64..95]: hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 6. data -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 7. data -> unwritten
-0: [0..63]: extent
-1: [64..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 8. unwritten -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 9. unwritten -> data
-0: [0..63]: extent
-1: [64..95]: hole
-d8f51c20223dbce5c7c90db87bc221b0
- 10. hole -> data -> hole
-bb7df04e1b0a2570657527a7e108ae23
- 11. data -> hole -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 12. unwritten -> data -> unwritten
-0: [0..63]: extent
-bb7df04e1b0a2570657527a7e108ae23
- 13. data -> unwritten -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 14. data -> hole @ 0
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
+++ /dev/null
-#! /bin/bash
-# FS QA Test No. shared/003
-#
-# Multi collapse range tests
-# This testcase is one of the 4 testcases (shared 001 - 004) which tries to
-# test various corner cases for fcollapse range functionality over different
-# type of extents. These tests are based on generic/255 test case.
-# For the type of tests, check the description of _test_generic_punch
-# in common/rc.
-#-----------------------------------------------------------------------
-# Copyright (c) 2013 Samsung Electronics. 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!
-
-_cleanup()
-{
- rm -f $tmp.*
-}
-
-trap "_cleanup ; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-# we need to include common/punch to get defination fo filter functions
-. ./common/rc
-. ./common/filter
-. ./common/punch
-
-# real QA test starts here
-_supported_fs xfs ext4
-_supported_os Linux
-
-_require_xfs_io_falloc_punch
-_require_xfs_io_falloc
-_require_xfs_io_fiemap
-_require_xfs_io_falloc_collapse
-
-testfile=$TEST_DIR/$seq.$$
-
-_test_generic_punch -k falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
-_check_test_fs
-
-status=0
-exit
+++ /dev/null
-QA output created by 003
- 1. into a hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 2. into allocated space
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
- 3. into unwritten space
-0: [0..95]: extent
-f07217d5ac7ffa15dd8910c4aa912674
- 4. hole -> data
-0: [0..63]: extent
-1: [64..95]: hole
-e5c94f6299822646f9f57aeacd8bdc01
- 5. hole -> unwritten
-0: [0..63]: extent
-1: [64..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 6. data -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 7. data -> unwritten
-0: [0..63]: extent
-1: [64..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 8. unwritten -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 9. unwritten -> data
-0: [0..63]: extent
-1: [64..95]: hole
-e5c94f6299822646f9f57aeacd8bdc01
- 10. hole -> data -> hole
-0: [0..31]: extent
-1: [32..63]: hole
-76cc863b386460b228a493933813a6a0
- 11. data -> hole -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 12. unwritten -> data -> unwritten
-0: [0..63]: extent
-76cc863b386460b228a493933813a6a0
- 13. data -> unwritten -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 14. data -> hole @ 0
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
+++ /dev/null
-#! /bin/bash
-# FS QA Test No. shared/004
-#
-# Delayed allocation multi collapse range tests
-# This testcase is one of the 4 testcases (shared 001 - 004) which tries to
-# test various corner cases for fcollapse range functionality over different
-# type of extents. These tests are based on generic/255 test case.
-# For the type of tests, check the description of _test_generic_punch
-# in common/rc.
-#-----------------------------------------------------------------------
-# Copyright (c) 2013 Samsung Electronics. 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!
-
-_cleanup()
-{
- rm -f $tmp.*
-}
-
-trap "_cleanup ; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-# we need to include common/punch to get defination fo filter functions
-. ./common/rc
-. ./common/filter
-. ./common/punch
-
-# real QA test starts here
-_supported_fs xfs ext4
-_supported_os Linux
-
-_require_xfs_io_falloc_punch
-_require_xfs_io_falloc
-_require_xfs_io_fiemap
-_require_xfs_io_falloc_collapse
-
-testfile=$TEST_DIR/$seq.$$
-
-_test_generic_punch -d -k falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
-_check_test_fs
-
-status=0
-exit
+++ /dev/null
-QA output created by 004
- 1. into a hole
-f4f35d60b3cc18aaa6d8d92f0cd3708a
- 2. into allocated space
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
- 3. into unwritten space
-0: [0..95]: extent
-f07217d5ac7ffa15dd8910c4aa912674
- 4. hole -> data
-0: [0..63]: extent
-1: [64..95]: hole
-e5c94f6299822646f9f57aeacd8bdc01
- 5. hole -> unwritten
-0: [0..63]: extent
-1: [64..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 6. data -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 7. data -> unwritten
-0: [0..63]: extent
-1: [64..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 8. unwritten -> hole
-0: [0..31]: extent
-1: [32..95]: hole
-f07217d5ac7ffa15dd8910c4aa912674
- 9. unwritten -> data
-0: [0..63]: extent
-1: [64..95]: hole
-e5c94f6299822646f9f57aeacd8bdc01
- 10. hole -> data -> hole
-0: [0..31]: extent
-1: [32..63]: hole
-76cc863b386460b228a493933813a6a0
- 11. data -> hole -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 12. unwritten -> data -> unwritten
-0: [0..63]: extent
-76cc863b386460b228a493933813a6a0
- 13. data -> unwritten -> data
-0: [0..63]: extent
-0f0151cbed83e4bf6e5bde26e82ab115
- 14. data -> hole @ 0
-0: [0..95]: extent
-f1894a71ac539f6f90426d98a4990a47
+++ /dev/null
-#! /bin/bash
-# FS QA Test No. shared/005
-#
-# Test multiple fallocate collapse range calls on same file.
-# For different blocksizes, collapse a single alternate block multiple times
-# until the file is left with 80 blocks and as much number of extents.
-# Also check for file system consistency after completing this operation
-# for each blocksize.
-#-----------------------------------------------------------------------
-# Copyright (c) 2013 Samsung Electronics. 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 "rm -f $tmp.*; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-
-# real QA test starts here
-_supported_fs xfs ext4
-_supported_os Linux
-
-_require_scratch
-_require_xfs_io_fiemap
-_require_xfs_io_falloc_collapse
-_do_die_on_error=y
-testfile=$SCRATCH_MNT/$seq.$$
-BLOCKS=10240
-
-for (( BSIZE = 1024; BSIZE <= 4096; BSIZE *= 2 )); do
-
- length=$(($BLOCKS * $BSIZE))
- case $FSTYP in
- xfs)
- _scratch_mkfs -b size=$BSIZE >> $seqres.full 2>&1
- ;;
- ext4)
- _scratch_mkfs -b $BSIZE >> $seqres.full 2>&1
- ;;
- esac
- _scratch_mount >> $seqres.full 2>&1
-
- # Write file
- $XFS_IO_PROG -f -c "pwrite 0 $length" -c fsync $testfile > /dev/null
-
- # Collapse alternate blocks
- for (( i = 1; i <= 7; i++ )); do
- for (( j=0; j < $(($BLOCKS/(2**$i))); j++ )); do
- offset=$(($j*$BSIZE))
- $XFS_IO_PROG -c "fcollapse $offset $BSIZE" $testfile > /dev/null
- done
- done
-
- # Check if 80 extents are present
- $XFS_IO_PROG -c "fiemap -v" $testfile | grep "^ *[0-9]*:" |wc -l
-
- _check_scratch_fs
- if [ $? -ne 0 ]; then
- status=1
- exit
- fi
-
- umount $SCRATCH_MNT
-done
-
-# success, all done
-status=0
-exit
+++ /dev/null
-QA output created by 005
-80
-80
-80
+++ /dev/null
-#! /bin/bash
-# FS QA Test No. 218
-#
-# Basic defragmentation sanity tests
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2009 Eric Sandeen. 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
-. ./common/defrag
-
-# real QA test starts here
-_supported_fs xfs ext4 btrfs
-_supported_os Linux
-
-# We require scratch so that we'll have free contiguous space
-_require_scratch
-_scratch_mkfs >/dev/null 2>&1
-_scratch_mount
-
-_require_defrag
-
-fragfile=$SCRATCH_MNT/fragfile.$$
-
-rm -f $fragfile
-
-# Craft some fragmented files, defrag them, check the result.
-
-echo "zero-length file:" | tee -a $seqres.full
-touch $fragfile
-_defrag $fragfile
-
-echo "Sparse file (no blocks):" | tee -a $seqres.full
-$XFS_IO_PROG -f -c "truncate 1m" $fragfile
-_defrag $fragfile
-
-echo "Contiguous file:" | tee -a $seqres.full
-dd if=/dev/zero of=$fragfile bs=4k count=4 &>/dev/null
-_defrag $fragfile
-
-echo "Write backwards sync, but contiguous - should defrag to 1 extent" | tee -a $seqres.full
-for I in `seq 9 -1 0`; do
- dd if=/dev/zero of=$fragfile bs=4k count=1 conv=notrunc seek=$I oflag=sync &>/dev/null
-done
-_defrag $fragfile
-
-echo "Write backwards sync leaving holes - defrag should do nothing" | tee -a $seqres.full
-for I in `seq 31 -2 0`; do
- dd if=/dev/zero of=$fragfile bs=4k count=1 conv=notrunc seek=$I oflag=sync &>/dev/null
-done
-_defrag $fragfile
-
-echo "Write forwards sync leaving holes - defrag should do nothing" | tee -a $seqres.full
-for I in `seq 0 2 31`; do
- dd if=/dev/zero of=$fragfile bs=4k count=1 conv=notrunc seek=$I oflag=sync &>/dev/null
-done
-_defrag $fragfile
-
-rm -f $seqres.full
-status=0
-exit
+++ /dev/null
-QA output created by 218
-zero-length file:
-Before: 0
-After: 0
-Sparse file (no blocks):
-Before: 0
-After: 0
-Contiguous file:
-Before: 1
-After: 1
-Write backwards sync, but contiguous - should defrag to 1 extent
-Before: 10
-After: 1
-Write backwards sync leaving holes - defrag should do nothing
-Before: 16
-After: 16
-Write forwards sync leaving holes - defrag should do nothing
-Before: 16
-After: 16
+++ /dev/null
-#! /bin/bash
-# FSQA Test No. 305
-#
-# Run fsstress and fio(dio/aio and mmap) and simulate disk failure
-# check filesystem consistency at the end.
-#
-#-----------------------------------------------------------------------
-# (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
-#
-#-----------------------------------------------------------------------
-#
-
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-fio_config=$tmp.fio
-status=1 # failure is the default!
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-_supported_fs ext3 ext4 xfs btrfs reiserfs
-_supported_os Linux
-_need_to_be_root
-_require_scratch
-_require_fail_make_request
-
-# TODO: Function are common enough to be moved to common/blkdev
-SCRATCH_REAL_DEV=`readlink -f $SCRATCH_DEV`
-SCRATCH_BDEV=`basename $SCRATCH_REAL_DEV`
-
-allow_fail_make_request()
-{
- echo "Allow global fail_make_request feature"
- echo 100 > $DEBUGFS_MNT/fail_make_request/probability
- echo 9999999 > $DEBUGFS_MNT/fail_make_request/times
- echo 0 > /sys/kernel/debug/fail_make_request/verbose
-}
-
-disallow_fail_make_request()
-{
- echo "Disallow global fail_make_request feature"
- echo 0 > $DEBUGFS_MNT/fail_make_request/probability
- echo 0 > $DEBUGFS_MNT/fail_make_request/times
-}
-
-start_fail_scratch_dev()
-{
- echo "Force SCRATCH_DEV device failure"
- echo " echo 1 > /sys/block/$SCRATCH_BDEV/make-it-fail" >> $seqres.full
- echo 1 > /sys/block/$SCRATCH_BDEV/make-it-fail
-
-}
-
-stop_fail_scratch_dev()
-{
- echo "Make SCRATCH_DEV device operable again"
- echo " echo 0 > /sys/block/$SCRATCH_BDEV/make-it-fail" >> $seqres.full
- echo 0 > /sys/block/$SCRATCH_BDEV/make-it-fail
-
-}
-
-_cleanup()
-{
- poweron_scratch_dev
- disallow_fail_make_request
- rm -f $tmp.*
-}
-trap "_cleanup; exit \$status" 1 2 3 15
-
-RUN_TIME=$((20+10*$TIME_FACTOR))
-NUM_JOBS=$((4*LOAD_FACTOR))
-BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
-FILE_SIZE=$((BLK_DEV_SIZE * 512))
-
-cat >$fio_config <<EOF
-###########
-# $seq test's fio activity
-# Filenames derived from jobsname and jobid like follows:
-# ${JOB_NAME}.${JOB_ID}.${ITERATION_ID}
-[global]
-ioengine=libaio
-bs=4k
-directory=${SCRATCH_MNT}
-filesize=${FILE_SIZE}
-size=9999T
-continue_on_error=write
-ignore_error=EIO,ENOSPC:EIO
-error_dump=0
-
-[stress_dio_aio_activity]
-create_on_open=1
-fallocate=none
-iodepth=128*${LOAD_FACTOR}
-direct=1
-buffered=0
-numjobs=${NUM_JOBS}
-rw=randwrite
-runtime=40+${RUN_TIME}
-time_based
-
-[stress_mmap_activity]
-ioengine=mmap
-create_on_open=0
-fallocate=1
-fdatasync=40960
-filesize=8M
-size=9999T
-numjobs=${NUM_JOBS}
-rw=randwrite
-runtime=40+${RUN_TIME}
-time_based
-
-EOF
-
-_require_fio $fio_config
-
-# Disable all sync operations to get higher load
-FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0 -f setattr=1"
-
-_workout()
-{
- out=$SCRATCH_MNT/fsstress.$$
- args=`_scale_fsstress_args -p 1 -n999999999 -f setattr=0 $FSSTRESS_AVOID -d $out`
- echo ""
- echo "Start fsstress.."
- echo ""
- echo "fsstress $args" >> $seqres.full
- $FSSTRESS_PROG $args > /dev/null 2>&1 &
- fs_pid=$!
- echo "Start fio.."
- cat $fio_config >> $seqres.full
- $FIO_PROG $fio_config >> $seqres.full 2>&1 &
- fio_pid=$!
-
- # Let's it work for awhile, and force device failure
- sleep $RUN_TIME
- start_fail_scratch_dev
- # After device turns in to failed state filesystem may yet not know about
- # that so buffered write(2) may succeed, but any integrity operations
- # such as (sync, fsync, fdatasync, direct-io) should fail.
- dd if=/dev/zero of=$SCRATCH_MNT/touch_failed_filesystem count=1 bs=4k conv=fsync \
- >> $seqres.full 2>&1 && \
- _fail "failed: still able to perform integrity fsync on $SCRATCH_MNT"
-
- kill $fs_pid
- wait $fs_pid
- wait $fio_pid
-
- # We expect that broken FS still can be umounted
- run_check umount $SCRATCH_DEV
- # Once filesystem was umounted no one is able to write to block device
- # It is now safe to bring device back to normal state
- stop_fail_scratch_dev
-
- # In order to check that filesystem is able to recover journal on mount(2)
- # perform mount/umount, after that all errors should be fixed
- run_check _scratch_mount
- run_check _scratch_unmount
- _check_scratch_fs
-}
-
-# real QA test starts here
-
-_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
-_scratch_mount || _fail "mount failed"
-allow_fail_make_request
-_workout
-status=$?
-disallow_fail_make_request
-exit
+++ /dev/null
-QA output created by 305
-Allow global fail_make_request feature
-
-Start fsstress..
-
-Start fio..
-Force SCRATCH_DEV device failure
-Make SCRATCH_DEV device operable again
-Disallow global fail_make_request feature
# - do not start group names with a digit
# - comment line before each group is "new" description
#
-001 auto quick prealloc
-002 auto quick prealloc
-003 auto quick prealloc
-004 auto quick prealloc
-005 auto prealloc
006 auto enospc
032 mkfs auto quick
051 acl udf auto quick
-218 auto fsr quick
243 auto quick prealloc
272 auto enospc rw
289 auto quick
298 auto trim
-305 aio dangerous enospc rw stress
-