2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
7 # Check that FIEMAP produces some output when we require an external
8 # block to hold extended attributes.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 7 15
26 # get standard environment, filters and checks
31 # real QA test starts here
35 _require_xfs_io_command "fiemap" "-a"
37 echo "Format and mount"
38 _scratch_mkfs > $seqres.full 2>&1
39 _scratch_mount >> $seqres.full 2>&1
41 testdir=$SCRATCH_MNT/test-$seq
44 echo "Create the original files"
45 testfile=$testdir/attrfile
47 blk_sz=$(_get_file_block_size $SCRATCH_MNT)
49 # Assume each attr eats at least 20 bytes. Try to fill 2 fs blocks.
50 max_attrs=$((2 * blk_sz / 20))
53 while [ $i -lt $max_attrs ]; do
54 n="$(printf "%010d" $i)"
55 $SETFATTR_PROG -n "user.$n" -v "$n" $testfile > $seqres.full 2>&1 || break
60 echo "Check attr extent counts"
61 f1=$(_count_attr_extents $testfile)
62 echo "$f1 xattr extents" >> $seqres.full
63 $XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
64 test $f1 -gt 0 || echo "Expected at least one xattr extent."
68 echo "Check attr extent counts after remount"
69 f1=$(_count_attr_extents $testfile)
70 echo "$f1 xattr extents" >> $seqres.full
71 $XFS_IO_PROG -c 'fiemap -a -v' $testfile >> $seqres.full
72 test $f1 -gt 0 || echo "Expected at least one xattr extent."