mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: use fiemap to count extents and holes
For the follwoing tests, this patch adds general script to get extent and hole counts. xfs/137 (data vs filesize) xfs/138 (data vs filesize vs truncate) xfs/139 (data vs filesize vs partial truncate) xfs/140 (data vs filesize vs extending truncate) xfs/179 (data vs filesize w/ fsync) xfs/180 (data vs filesize w/ sync) xfs/182 (data vs filesize w/ recovery) It also requires these tests to check for fiemap support. [dchinner: use _require_xfs_io_command "fiemap" for consistency] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
e2b7ec91cc
commit
f71327511d
+3
-2
@@ -42,6 +42,7 @@ _supported_os Linux IRIX
|
||||
|
||||
_require_scratch
|
||||
_require_scratch_shutdown
|
||||
_require_fiemap
|
||||
_scratch_mkfs_xfs >/dev/null 2>&1
|
||||
_scratch_mount
|
||||
|
||||
@@ -59,8 +60,8 @@ _check_files()
|
||||
if [ `ls -l $file | tr -s ' ' | cut -d ' ' -f 5` -eq 32768 ]
|
||||
then
|
||||
# if file has non-zero size but no extents then it's contents will be NULLs, bad.
|
||||
if xfs_bmap $file | grep 'no extents' > /dev/null
|
||||
then
|
||||
num_extents=`_count_extents $file`
|
||||
if [ $num_extents -eq 0 ]; then
|
||||
echo corrupt file $file - non-zero size but no extents
|
||||
else
|
||||
rm -f $file
|
||||
|
||||
Reference in New Issue
Block a user