generic/798: chain xfs_io commands into a single invocation

The write, cachestat, fsync, and cachestat calls were each run as
separate xfs_io invocations, closing and reopening the file in
between. Some filesystems flush dirty data back on close(), clearing
the dirty bit before the first cachestat ever ran, causing test failure

- output mismatch (see /opt/xfstests/results//generic/798.out.bad)
    --- tests/generic/798.out	2026-08-20 05:25:39.000000000 -0400
    +++ /opt/xfstests/results//generic/798.out.bad	2026-08-21 12:30:39.831381108 -0400
    @@ -1,16 +1,16 @@
     QA output created by 798
     === Test with 1 pages ===
    -Cached: 1, Dirty: 1, Writeback: 0, Evicted: 0, Recently Evicted: 0
    +Cached: 1, Dirty: 0, Writeback: 0, Evicted: 0, Recently Evicted: 0
     Cached: 1, Dirty: 0, Writeback: 0, Evicted: 0, Recently Evicted: 0
     === Test with 2 pages ===
    -Cached: 2, Dirty: 2, Writeback: 0, Evicted: 0, Recently Evicted: 0
    ...

Run the whole sequence on one open file descriptor instead by chaining
all xfs_io commands in single invocation.

Suggested-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
1 file changed