_require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
+# Takes the fsxattr.xflags line,
+# i.e. fsxattr.xflags = 0x0 [--------------C-]
+# and tests whether a flag character is set
+test_xflag()
+{
+ local flg=$1
+ grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
+}
+
rm -f $seqres.full
echo "Format and mount"
$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
_scratch_cycle_mount
-$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
echo "Unset cowextsize and check flag"
$XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
_scratch_cycle_mount
-$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | _filter_scratch
+$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
status=0