linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH] fstests: generic/563: use fs blocksize to do the writes
Date: Thu, 3 Oct 2024 12:15:08 -0700	[thread overview]
Message-ID: <20241003191508.GA435178@zen.localdomain> (raw)
In-Reply-To: <20240929235038.24497-1-wqu@suse.com>

On Mon, Sep 30, 2024 at 09:20:38AM +0930, Qu Wenruo wrote:
> [FALSE ALERTS]
> If the system has a page size larger than 4K, and the fs block size
> matches the page size, test case generic/563 will fail:
> 
>     --- tests/generic/563.out	2024-04-25 18:13:45.178550333 +0930
>     +++ /home/adam/xfstests-dev/results//generic/563.out.bad	2024-09-30 09:09:16.155312379 +0930
>     @@ -3,7 +3,8 @@
>      read is in range
>      write is in range
>      write -> read/write
>     -read is in range
>     +read has value of 8388608
>     +read is NOT in range -33792 .. 33792
>      write is in range
>     ...
> 
> Both Ext4 and btrfs fail with 64K block size and 64K page size
> 
> [CAUSE]
> The test case writes the 8MiB file using the default block size xfs_io
> pwrite, which is 4KiB.
> 
> Since the fs block size is 64K, such 4KiB write is unaligned inside a
> block, causing the fs to read out the full page.
> 
> Thus the pwrite will cause the fs to read out every page, resulting the
> above 8MiB+ read value.
> 
> [FIX]
> Fix the test case by using the fs block size to avoid such unaligned
> buffered write.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

The rationale and change look good to me. I also tested it on my system
with blocksize=pagesize=4k, though I don't have access to one with a 64k
page size for the more interesting confirmation.

Reviewed-by: Boris Burkov <boris@bur.io>

> ---
>  tests/generic/563 | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/generic/563 b/tests/generic/563
> index 0a8129a6..e8db8acf 100755
> --- a/tests/generic/563
> +++ b/tests/generic/563
> @@ -94,6 +94,8 @@ sminor=$((0x`stat -L -c %T $LOOP_DEV`))
>  _mkfs_dev $LOOP_DEV >> $seqres.full 2>&1
>  _mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed"
>  
> +blksize=$(_get_block_size "$SCRATCH_MNT")
> +
>  drop_io_cgroup=
>  grep -q -w io $cgdir/cgroup.subtree_control || drop_io_cgroup=1
>  
> @@ -103,7 +105,7 @@ echo "+io" > $cgdir/cgroup.subtree_control || _fail "subtree control"
>  echo "read/write"
>  reset
>  switch_cg $cgdir/$seq-cg
> -$XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite 0 $iosize" -c fsync \
> +$XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite -b $blksize 0 $iosize" -c fsync \
>  	$SCRATCH_MNT/file >> $seqres.full 2>&1
>  switch_cg $cgdir
>  $XFS_IO_PROG -c fsync $SCRATCH_MNT/file
> @@ -114,9 +116,9 @@ check_cg $cgdir/$seq-cg $iosize $iosize 5% 5%
>  echo "write -> read/write"
>  reset
>  switch_cg $cgdir/$seq-cg
> -$XFS_IO_PROG -c "pwrite 0 $iosize" $SCRATCH_MNT/file >> $seqres.full 2>&1
> +$XFS_IO_PROG -c "pwrite -b $blksize 0 $iosize" $SCRATCH_MNT/file >> $seqres.full 2>&1
>  switch_cg $cgdir/$seq-cg-2
> -$XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite 0 $iosize" $SCRATCH_MNT/file \
> +$XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite -b $blksize 0 $iosize" $SCRATCH_MNT/file \
>  	>> $seqres.full 2>&1
>  switch_cg $cgdir
>  $XFS_IO_PROG -c fsync $SCRATCH_MNT/file
> @@ -134,7 +136,7 @@ reset
>  switch_cg $cgdir/$seq-cg
>  $XFS_IO_PROG -c "pread 0 $iosize" $SCRATCH_MNT/file >> $seqres.full 2>&1
>  switch_cg $cgdir/$seq-cg-2
> -$XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite 0 $iosize" $SCRATCH_MNT/file \
> +$XFS_IO_PROG -c "pread 0 $iosize" -c "pwrite -b $blksize 0 $iosize" $SCRATCH_MNT/file \
>  	>> $seqres.full 2>&1
>  switch_cg $cgdir
>  $XFS_IO_PROG -c fsync $SCRATCH_MNT/file
> -- 
> 2.46.0
> 

  reply	other threads:[~2024-10-03 19:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29 23:50 [PATCH] fstests: generic/563: use fs blocksize to do the writes Qu Wenruo
2024-10-03 19:15 ` Boris Burkov [this message]
2024-10-04  9:45 ` Mark Harmstone
2024-10-04  9:52   ` Qu Wenruo
2024-10-04 11:18     ` Mark Harmstone
2024-10-09  9:28 ` Qu Wenruo
2024-10-10  6:43   ` Zorro Lang

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=20241003191508.GA435178@zen.localdomain \
    --to=boris@bur.io \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@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).