[PATCH 2/4] xfs/019: test reserved file support

Darrick J. Wong
2025-02-19T00:57:06Z

From: Darrick J. Wong <djwong@kernel.org>

Test creating files with preallocated blocks but a file size of zero,
since mkfs' protofile parser supports creating such things.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/xfs/019 | 5 +++++
tests/xfs/019.out | 5 +++++
2 files changed, 10 insertions(+)

diff --git a/tests/xfs/019 b/tests/xfs/019
index b30116560c7c40..5804ef228bd9d2 100755
--- a/tests/xfs/019
+++ b/tests/xfs/019
@@ -82,6 +82,7 @@ pipe p--670 0 0
symlink l--123 0 0 bigfile
: a file we actually read
bigfile ---666 3 0 $tempfile.2
+rsvfile r--666 3 0 1234567
: done
$
EOF
@@ -117,6 +118,10 @@ _verify_fs()
diff -q $SCRATCH_MNT/symlink $tempfile.2 \
|| echo "symlink broken"

+ rsvblocks=$(stat -c '%b' $SCRATCH_MNT/rsvfile)
+ test $rsvblocks -gt 0 \
+ || echo "rsvfile broken"
+
echo "*** unmount FS"
_full "umount"
_scratch_unmount >>$seqfull 2>&1 \
diff --git a/tests/xfs/019.out b/tests/xfs/019.out
index 9db157f9b413b9..9fd3b577e1ab94 100644
--- a/tests/xfs/019.out
+++ b/tests/xfs/019.out
@@ -69,6 +69,11 @@ Device: <DEVICE> Inode: <INODE> Links: 1
Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./rsvfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0666/-rw-rw-rw-) Uid: (3) Gid: (0)
+Device: <DEVICE> Inode: <INODE> Links: 1
+
File: "./setgid"
Size: 5 Filetype: Regular File
Mode: (2666/-rw-rwsrw-) Uid: (0) Gid: (0)