2010-04-29 09:59:24 +10:00
|
|
|
#! /bin/bash
|
2018-06-09 11:35:42 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (c) 2009 Eric Sandeen. All Rights Reserved.
|
|
|
|
|
#
|
2010-03-06 11:24:54 +11:00
|
|
|
# FS QA Test No. 225
|
|
|
|
|
#
|
|
|
|
|
# Run the fiemap (file extent mapping) tester
|
|
|
|
|
#
|
|
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2010-03-06 11:24:54 +11:00
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
2016-11-13 02:12:33 +08:00
|
|
|
tmp=/tmp/$$
|
2010-03-06 11:24:54 +11:00
|
|
|
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
|
2013-03-15 12:28:04 +00:00
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
2010-03-06 11:24:54 +11:00
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs generic
|
2011-10-10 02:14:14 +00:00
|
|
|
_require_scratch
|
2016-06-09 14:42:08 -04:00
|
|
|
_require_odirect
|
2014-08-13 11:20:59 +10:00
|
|
|
_require_xfs_io_command "fiemap"
|
2010-03-06 11:24:54 +11:00
|
|
|
|
2011-10-10 02:14:14 +00:00
|
|
|
_scratch_mkfs > /dev/null 2>&1
|
|
|
|
|
_scratch_mount > /dev/null 2>&1
|
|
|
|
|
|
2013-03-15 12:28:02 +00:00
|
|
|
rm -f $seqres.full
|
2011-10-10 02:14:14 +00:00
|
|
|
fiemapfile=$SCRATCH_MNT/$seq.fiemap
|
|
|
|
|
fiemaplog=$SCRATCH_MNT/$seq.log
|
2010-03-06 11:24:54 +11:00
|
|
|
|
2016-02-09 00:22:21 -08:00
|
|
|
_require_test_program "fiemap-tester"
|
2010-03-06 11:24:54 +11:00
|
|
|
|
2021-04-13 18:05:20 -07:00
|
|
|
# FIEMAP test doesn't like finding unwritten blocks after it punches out
|
|
|
|
|
# a partial rt extent.
|
|
|
|
|
test "$FSTYP" = "xfs" && \
|
|
|
|
|
_require_file_block_size_equals_fs_block_size $fiemapfile
|
|
|
|
|
|
2011-03-09 10:30:07 -06:00
|
|
|
seed=`date +%s`
|
|
|
|
|
|
|
|
|
|
echo "using seed $seed" >> $fiemaplog
|
|
|
|
|
|
2011-03-08 09:16:23 -06:00
|
|
|
echo "fiemap run without preallocation, with sync"
|
2011-03-09 10:30:07 -06:00
|
|
|
$here/src/fiemap-tester -q -S -s $seed -p 0 -r 200 $fiemapfile 2>&1 | tee -a $fiemaplog
|
2011-03-08 09:16:23 -06:00
|
|
|
|
2011-10-10 02:14:14 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
if grep -q "Operation not supported" $fiemaplog; then
|
|
|
|
|
_notrun "FIEMAP not supported by this filesystem type: $FSTYP"
|
|
|
|
|
fi
|
|
|
|
|
status=$?
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
2011-03-08 09:16:23 -06:00
|
|
|
echo "fiemap run without preallocation or sync"
|
2011-03-09 10:30:07 -06:00
|
|
|
$here/src/fiemap-tester -q -s $seed -p 0 -r 200 $fiemapfile 2>&1 | tee -a $fiemaplog
|
2010-10-21 21:12:04 +02:00
|
|
|
|
2010-03-06 11:24:54 +11:00
|
|
|
status=0
|
|
|
|
|
exit
|