From: Darrick J. Wong Date: Tue, 27 Oct 2020 19:02:02 +0000 (-0700) Subject: xfs/327: fix inode reflink flag checking X-Git-Tag: v2022.05.01~612 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=f3d639b1cc72029a07ceb488c523daa278dfff4c;ds=sidebyside xfs/327: fix inode reflink flag checking This is a regression test that tried to make sure that repair correctly clears the XFS inode reflink flag when it detects files that do not share any blocks. However, it does this checking by looking at the (online) lsattr output. This worked fine during development when we exposed the reflink state via the stat ioctls, but that has long since been removed. Now the only way to check is via xfs_db, so switch it to use that. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Eryu Guan --- diff --git a/tests/xfs/327 b/tests/xfs/327 index 017e2a84..7a14798f 100755 --- a/tests/xfs/327 +++ b/tests/xfs/327 @@ -49,10 +49,21 @@ seq 1 $nr | while read i; do done sync +ino_0=$(stat -c '%i' $SCRATCH_MNT/file.0) +ino_64=$(stat -c '%i' $SCRATCH_MNT/file.64) +ino_128=$(stat -c '%i' $SCRATCH_MNT/file.128) + +echo "Check filesystem" +_scratch_unmount +_scratch_xfs_db -c "inode $ino_0" -c print \ + -c "inode $ino_64" -c print \ + -c "inode $ino_128" -c print | grep reflink | sed -e 's/^v[0-9]*/vX/g' +_scratch_mount + echo "Check files" for i in 0 $((nr / 2)) $nr; do md5sum $SCRATCH_MNT/file.$i | _filter_scratch - $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch + $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i >> $seqres.full done echo "CoW all files" @@ -63,12 +74,15 @@ done echo "Repair filesystem" _scratch_unmount _repair_scratch_fs >> $seqres.full +_scratch_xfs_db -c "inode $ino_0" -c print \ + -c "inode $ino_64" -c print \ + -c "inode $ino_128" -c print | grep reflink | sed -e 's/^v[0-9]*/vX/g' _scratch_mount echo "Check files again" for i in 0 $((nr / 2)) $nr; do md5sum $SCRATCH_MNT/file.$i | _filter_scratch - $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch + $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i >> $seqres.full done echo "Done" diff --git a/tests/xfs/327.out b/tests/xfs/327.out index 5b3cba21..0e204205 100644 --- a/tests/xfs/327.out +++ b/tests/xfs/327.out @@ -1,20 +1,21 @@ QA output created by 327 Format filesystem Create files +Check filesystem +vX.reflink = 1 +vX.reflink = 1 +vX.reflink = 1 Check files 8fa14cdd754f91cc6554c9e71929cce7 SCRATCH_MNT/file.0 -[] SCRATCH_MNT/file.0 8fa14cdd754f91cc6554c9e71929cce7 SCRATCH_MNT/file.64 -[] SCRATCH_MNT/file.64 8fa14cdd754f91cc6554c9e71929cce7 SCRATCH_MNT/file.128 -[] SCRATCH_MNT/file.128 CoW all files Repair filesystem +vX.reflink = 0 +vX.reflink = 0 +vX.reflink = 0 Check files again 8fa14cdd754f91cc6554c9e71929cce7 SCRATCH_MNT/file.0 -[] SCRATCH_MNT/file.0 0f17fd72b7bbf5bda0ff433e6d1fc118 SCRATCH_MNT/file.64 -[] SCRATCH_MNT/file.64 0f17fd72b7bbf5bda0ff433e6d1fc118 SCRATCH_MNT/file.128 -[] SCRATCH_MNT/file.128 Done