qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH] iotests: Improve mirror-sparse on various filesystems
Date: Fri, 23 May 2025 09:55:16 +0200	[thread overview]
Message-ID: <c02139a7-de4a-42da-bff3-525c0679223c@proxmox.com> (raw)
In-Reply-To: <20250522211451.2301791-2-eblake@redhat.com>

Am 22.05.25 um 23:14 schrieb Eric Blake:
> Fiona reported that an ext4 filesystem on top of LVM can sometimes
> report over-allocation to du (based on the hueristics the filesystem

Typo: heuristics

> is making while observing the contents being mirrored); even though
> the contents and actual size matched, about 50% of the time the size
> reported by disk_usage was too large by 4k, failing the test.
> 
> Similarly, on ZFS where a file is created with preallocation=full, du
> does not see the full allocation until things have had time to settle;
> adding a sync call reduces the chance of catching that async window:
> 
> | [I] febner@enia ~/qemu/build/tests/qemu-iotests (master)> qemu-img create my.raw 20M -f
> |w -o preallocation=full
> | Formatting 'my.raw', fmt=raw size=20971520 preallocation=full
> | [I] febner@enia ~/qemu/build/tests/qemu-iotests (master)> du --block-size=1 my.raw
> | 512 my.raw
> | [I] febner@enia ~/qemu/build/tests/qemu-iotests (master)> du --block-size=1 my.raw
> | 20980224    my.raw
> 
> Fiona also reported that on a compressed ZFS, the filesystem can end
> up reporting smaller disk_usage if it re-compresses a file, despite a
> fully-allocating mirror - but since I don't have a compressed ZFS
> handy for reproducing that test, that may remain a sporadic problem
> for another day.
> 
> Reported-by: Fiona Ebner <f.ebner@proxmox.com>
> Fixes: c0ddcb2c ("tests: Add iotest mirror-sparse for recent patches")
> Signed-off-by: Eric Blake <eblake@redhat.com>

If you drop the hunk with the sync:
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>

> ---
>  tests/qemu-iotests/common.rc           | 2 ++
>  tests/qemu-iotests/tests/mirror-sparse | 4 +++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 237f746af88..c3fc0bcf02a 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -143,6 +143,8 @@ _optstr_add()
>  # report real disk usage for sparse files
>  disk_usage()
>  {
> +    # ZFS has lazy allocation; sync the file first for best results
> +    sync "$1"

Unfortunately, just syncing the file seems to be not enough. It seems to
be necessary to sync the whole filesystem, but that of course is too
expensive for the helper here:

[I] febner@enia ~> rm my.raw; qemu-img create my.raw 20M -f raw -o
preallocation=full; sync my.raw; du --block-size=1 my.raw
Formatting 'my.raw', fmt=raw size=20971520 preallocation=full
512	my.raw
[I] febner@enia ~> rm my.raw; qemu-img create my.raw 20M -f raw -o
preallocation=full; sync -f my.raw; du --block-size=1 my.raw
Formatting 'my.raw', fmt=raw size=20971520 preallocation=full
20980224	my.raw

There's already quite a few other test failures on ZFS, so I guess it's
not worth it right now if there's no easy fix (mirror-sparse also still
fails, because the file is sparse again after mirroring, ZFS seems very
aggressive trying to reduce allocation):

For -raw:
Failures: 106 109 150 175 221 240 253 308 mirror-sparse write-zeroes-unmap
Failed 10 of 86 iotests


>      du --block-size=1 "$1" | awk '{print $1}'
>  }
> 

Best Regards,
Fiona



      reply	other threads:[~2025-05-23  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 21:14 [PATCH] iotests: Improve mirror-sparse on various filesystems Eric Blake
2025-05-23  7:55 ` Fiona Ebner [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=c02139a7-de4a-42da-bff3-525c0679223c@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).