diff --git a/016 b/016 index 9275ade5..08a73f49 100755 --- a/016 +++ b/016 @@ -65,6 +65,15 @@ _init() $here/src/devzero -b 2048 -n 50 -v 198 $SCRATCH_DEV echo "*** mkfs" force_opts="-dsize=50m -lsize=$log_size" + # + # Do not discard blocks as we check for patterns in free space. + # + # First, make sure that mkfs supports '-K' option by using its + # dry run (-N option) and then add it to the force_opts. + # + if _scratch_mkfs_xfs -N -K $force_opts >/dev/null 2>&1; then + force_opts="-K $force_opts" + fi echo mkfs_xfs $force_opts $SCRATCH_DEV >>$seq.full _scratch_mkfs_xfs $force_opts >$tmp.mkfs0 2>&1 [ $? -ne 0 ] && \ diff --git a/030 b/030 index 74147d41..fe573729 100755 --- a/030 +++ b/030 @@ -55,7 +55,8 @@ _check_ag() for structure in 'sb 0' 'agf 0' 'agi 0' 'agfl 0' do echo "Corrupting $structure - setting bits to $1" - _check_repair $1 "$structure" + _check_repair $1 "$structure" | + sed -e '/^error following ag 0 unlinked list$/d' done } diff --git a/030.out.linux b/030.out.linux index 59909015..cf3259f6 100644 --- a/030.out.linux +++ b/030.out.linux @@ -85,7 +85,6 @@ bad agbno AGBNO for inobt root, agno 0 root inode chunk not found Phase 3 - for each AG... - scan and clear agi unlinked lists... -error following ag 0 unlinked list - process known inodes and perform inode discovery... - process newly discovered inodes... Phase 4 - check for duplicate blocks... diff --git a/273 b/273 index 2965132b..67f3d6b1 100755 --- a/273 +++ b/273 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -rf $SCRATCH_MNT/* $tmp.* + rm -rf $tmp.* _scratch_unmount } @@ -43,7 +43,7 @@ _cleanup() . ./common.filter threads=50 -count=1 +count=2 _threads_set() { @@ -68,7 +68,7 @@ _file_create() cd $SCRATCH_MNT/origin - _disksize=`df --block-size=1 | grep $SCRATCH_DEV | awk '{print $2}'` + _disksize=`df --block-size=1 $SCRATCH_DEV | awk -v sd=$SCRATCH_DEV 'BEGIN{c=0}{for(i=1;i<=NF;++i){a[c]=$i;++c}}END{for(entry in a){if(a[entry] ~ sd){print a[entry + 3]; break}}}'` _disksize=$(($_disksize / 3)) _num=$(($_disksize / $count / $threads / 4096)) _count=$count @@ -106,8 +106,6 @@ _do_workload() _pids="" _pid=1 - rm -rf $SCRATCH_MNT/* - _threads_set _file_create @@ -134,7 +132,7 @@ echo "------------------------------" rm -f $seq.full -umount $SCRATCH_DEV 2>/dev/null +_scratch_unmount 2>/dev/null _scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seq.full 2>&1 _scratch_mount diff --git a/274 b/274 index b6580047..dcad90ee 100755 --- a/274 +++ b/274 @@ -1,7 +1,9 @@ #! /bin/bash # FS QA Test No. 274 # -# preallocation test +# preallocation test: +# Preallocate space to a file, and fill the rest of the fs to 100%. +# Then test a write into that preallocated space, which should succeed. # #----------------------------------------------------------------------- # Copyright (c) 2011-2012 Fujitsu, Inc. All Rights Reserved. @@ -35,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -f $SCRATCH_MNT/* $tmp.* + rm -f $tmp.* _scratch_unmount } @@ -46,6 +48,7 @@ _cleanup() _supported_fs generic _supported_os IRIX Linux _require_scratch +_require_xfs_io_falloc echo "------------------------------" echo "preallocation test" @@ -57,35 +60,42 @@ umount $SCRATCH_DEV 2>/dev/null _scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >>$seq.full 2>&1 _scratch_mount -rm -rf $SCRATCH_MNT/* -cd $SCRATCH_MNT -dd if=/dev/zero of=test bs=4K count=1 >/dev/null 2>&1 -if [ $? -ne 0 ] -then - echo "create file err" - status=1 - exit -fi +# Create a 4k file and Allocate 4M past EOF on that file +xfs_io -F -f -c "pwrite 0 4k" -c "falloc -k 4k 4m" $SCRATCH_MNT/test \ + >>$seq.full 2>&1 || _fail "failed to create test file" -fallocate -n -o 4K -l 1M test >/dev/null 2>&1 -if [ $? -ne 0 ] -then - echo "fallocate file err" - status=1 - exit -fi - -dd if=/dev/zero of=tmp1 bs=1M >/dev/null 2>&1 -dd if=/dev/zero of=tmp2 bs=4K >/dev/null 2>&1 +# Fill the rest of the fs completely +# Note, this will show ENOSPC errors in $seq.full, that's ok. +echo "Fill fs with 1M IOs; ENOSPC expected" >> $seq.full +dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=1M >>$seq.full 2>&1 +echo "Fill fs with 4K IOs; ENOSPC expected" >> $seq.full +dd if=/dev/zero of=$SCRATCH_MNT/tmp2 bs=4K >>$seq.full 2>&1 sync +# Last effort, use O_SYNC +echo "Fill fs with 4K DIOs; ENOSPC expected" >> $seq.full +dd if=/dev/zero of=$SCRATCH_MNT/tmp3 bs=4K oflag=sync >>$seq.full 2>&1 +# Save space usage info +echo "Post-fill space:" >> $seq.full +df $SCRATCH_MNT >>$seq.full 2>&1 -dd if=/dev/zero of=test seek=1 bs=4K count=2 conv=notrunc >/dev/null 2>&1 -if [ $? -ne 0 ] -then - echo "fill prealloc range err" - status=1 - exit -fi +# Now attempt a write into all of the preallocated space - +# in a very nasty way, badly fragmenting it and then filling it in. +echo "Fill in prealloc space; fragment at offsets:" >> $seq.full +for i in `seq 1 2 1023`; do + echo -n "$i " >> $seq.full + dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc \ + >>$seq.full 2>/dev/null || _fail "failed to write to test file" +done +sync +echo >> $seq.full +echo "Fill in prealloc space; fill holes at offsets:" >> $seq.full +for i in `seq 2 2 1023`; do + echo -n "$i " >> $seq.full + dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc \ + >>$seq.full 2>/dev/null || _fail "failed to fill test file" +done +sync +echo >> $seq.full echo "done" exit diff --git a/README b/README index 0f52f020..d81ede9f 100644 --- a/README +++ b/README @@ -3,7 +3,9 @@ BUILDING THE FSQA SUITE _______________________ Building Linux: - - cd into the xfstests directory and run make. + - cd into the xfstests directory + - run make + - run make install Building IRIX: - cd into the xfstests directory diff --git a/common.attr b/common.attr index 0f1e7891..6e2c004b 100644 --- a/common.attr +++ b/common.attr @@ -187,7 +187,7 @@ _sort_getfattr_output() if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" ]; then MAX_ATTRS=1000 else # Assume max ~1 block of attrs - BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3` + BLOCK_SIZE=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3` # user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead let MAX_ATTRS=$BLOCK_SIZE/40 fi @@ -198,7 +198,7 @@ export MAX_ATTRS if [ "$FSTYP" == "xfs" -o "$FSTYP" == "udf" -o "$FSTYP" == "btrfs" ]; then MAX_ATTRVAL_SIZE=64 else # Assume max ~1 block of attrs - BLOCK_SIZE=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3` + BLOCK_SIZE=`stat -f $TEST_DIR | grep "Block size" | cut -d " " -f3` # leave a little overhead let MAX_ATTRVAL_SIZE=$BLOCK_SIZE-256 fi diff --git a/common.dump b/common.dump index ca09ec16..e89dedcf 100644 --- a/common.dump +++ b/common.dump @@ -863,7 +863,7 @@ _dump_filter_main() -e 's/1048576/BLOCKSZ/' \ -e 's/2097152/BLOCKSZ/' \ -e 's/(pid[ ]*[1-9][0-9]*)/\(pid PID\)/' \ - -e '/version 3\.0/d' \ + -e '/version [3-9]\.[0-9]/d' \ -e 's/\/hw\/module.*$/SCRATCH_DEV/' \ -e 's/xfsdump: ino map phase 1: .*/xfsdump: ino map /' \ -e '/xfsdump: ino map phase [2]/,1d' \