generic: test FIEMAP on extended attribute blocks

Make sure that FIEMAP produces some output when we add enough xattrs
to force the xattrs to be stored in an external block.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-04-06 09:01:30 -07:00
committed by Eryu Guan
parent 9fefd025d8
commit 0e613380dc
4 changed files with 112 additions and 1 deletions
+14 -1
View File
@@ -2056,7 +2056,7 @@ _require_xfs_io_command()
;;
"fiemap")
testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
-c "fiemap -v" $testfile 2>&1`
-c "fiemap -v $param" $testfile 2>&1`
;;
"flink" )
testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
@@ -2089,6 +2089,8 @@ _require_xfs_io_command()
_notrun "xfs_io $command support is missing"
echo $testio | grep -q "Operation not supported" && \
_notrun "xfs_io $command failed (old kernel/wrong fs?)"
echo $testio | grep -q "Invalid" && \
_notrun "xfs_io $command failed (old kernel/wrong fs/bad args?)"
echo $testio | grep -q "foreign file active" && \
_notrun "xfs_io $command not supported on $FSTYP"
@@ -2938,6 +2940,17 @@ _count_holes()
$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep hole | wc -l
}
# Does fiemap support reporting xattr extents?
_require_fiemap_attr()
{
_require_xfs_io_command "fiemap" "-a"
}
_count_attr_extents()
{
$XFS_IO_PROG -c "fiemap -a" $1 | tail -n +2 | grep -v hole | wc -l
}
# arg 1 is dev to remove and is output of the below eg.
# ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev
_devmgt_remove()