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 <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Darrick J. Wong
2020-10-27 12:02:02 -07:00
committed by Eryu Guan
parent b951bb5cef
commit f3d639b1cc
2 changed files with 23 additions and 8 deletions
+16 -2
View File
@@ -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"
+7 -6
View File
@@ -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