fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Avinesh Kumar <avinesh.kumar@suse.com>,
	djwong@kernel.org, fstests@vger.kernel.org
Cc: wqu@suse.com
Subject: Re: [PATCH v3] generic/798: chain xfs_io commands into a single invocation
Date: Thu, 27 Aug 2026 07:43:19 +0930	[thread overview]
Message-ID: <c67ab7c6-2d94-457c-aa85-aeba6f1c2c60@gmx.com> (raw)
In-Reply-To: <20260826155423.183785-1-avinesh.kumar@suse.com>



在 2026/8/27 01:24, Avinesh Kumar 写道:
> From: Avinesh Kumar <avinesh.kumar@suse.com>
> 
> 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: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   tests/generic/798 | 19 ++++++++++++++-----
>   1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/generic/798 b/tests/generic/798
> index 0fe37646..5c81b429 100755
> --- a/tests/generic/798
> +++ b/tests/generic/798
> @@ -27,12 +27,21 @@ for num_page in 1 2 4 8 16; do
>   	echo "=== Test with $num_page pages ==="
>   
>   	rm -f $SCRATCH_MNT/foobar
> -	$XFS_IO_PROG -f -c "pwrite -b $pagesize 0 $size" $SCRATCH_MNT/foobar > /dev/null
> -	# Basic cached number reporting
> -	$XFS_IO_PROG -c "cachestat 0 $size" $SCRATCH_MNT/foobar
>   
> -	# Test dirty page number reporting after a fsync.
> -	$XFS_IO_PROG -c "fsync" -c "cachestat 0 $size" $SCRATCH_MNT/foobar
> +	# Basic cached number reporting and test dirty page number
> +	# reporting after a fsync.
> +	#
> +	# Do the whole write+cachestat+fsync+cachestat sequence in a
> +	# single xfs_io invocation. Some filesystems (e.g. NFS) flush
> +	# dirty data back to the server as part of their own close()-time
> +	# cache consistency, which would clear the dirty bits before the
> +	# second xfs_io process ever got to run cachestat.
> +	$XFS_IO_PROG -f \
> +		-c "pwrite -q -b $pagesize 0 $size" \
> +		-c "cachestat 0 $size" \
> +		-c "fsync" \
> +		-c "cachestat 0 $size" \
> +		$SCRATCH_MNT/foobar
>   done
>   
>   _scratch_unmount


      parent reply	other threads:[~2026-08-26 22:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 15:11 [PATCH] generic/798: exclude nfs from cachestat dirty page reporting test Avinesh Kumar
2026-08-24 16:15 ` Darrick J. Wong
2026-08-26 14:39   ` Avinesh Kumar
2026-08-26 15:01   ` [PATCH v2] generic/798: chain xfs_io commands into a single invocation Avinesh Kumar
2026-08-26 15:20     ` Darrick J. Wong
2026-08-26 15:54       ` [PATCH v3] " Avinesh Kumar
2026-08-26 16:15         ` Darrick J. Wong
2026-08-26 17:00         ` Zorro Lang
2026-08-26 22:13         ` Qu Wenruo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c67ab7c6-2d94-457c-aa85-aeba6f1c2c60@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=avinesh.kumar@suse.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).