4 # Check that FIEMAP produces some output when we require an external
5 # block to hold extended attributes.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 7 15
41 # get standard environment, filters and checks
46 # real QA test starts here
51 _require_xfs_io_command "fiemap" "-a"
53 echo "Format and mount"
54 _scratch_mkfs > $seqres.full 2>&1
55 _scratch_mount >> $seqres.full 2>&1
57 testdir=$SCRATCH_MNT/test-$seq
60 echo "Create the original files"
61 testfile=$testdir/attrfile
63 blk_sz=$(_get_file_block_size $SCRATCH_MNT)
65 # Assume each attr eats at least 20 bytes. Try to fill 2 fs blocks.
66 max_attrs=$((2 * blk_sz / 20))
69 while [ $i -lt $max_attrs ]; do
70 n="$(printf "%010d" $i)"
71 $SETFATTR_PROG -n "user.$n" -v "$n" $testfile > $seqres.full 2>&1 || break
76 echo "Check attr extent counts"
77 f1=$(_count_attr_extents $testfile)
78 echo "$f1 xattr extents" >> $seqres.full
79 $XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
80 test $f1 -gt 0 || echo "Expected at least one xattr extent."
84 echo "Check attr extent counts after remount"
85 f1=$(_count_attr_extents $testfile)
86 echo "$f1 xattr extents" >> $seqres.full
87 $XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
88 test $f1 -gt 0 || echo "Expected at least one xattr extent."