qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, vsementsov@yandex-team.ru,
	stefanha@redhat.com,
	Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>,
	Alexander Ivanov <alexander.ivanov@virtuozzo.com>,
	Alberto Garcia <berto@igalia.com>, Kevin Wolf <kwolf@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>
Subject: [PATCH v3 09/11] iotests/common.rc: add disk_usage function
Date: Thu, 24 Apr 2025 19:52:09 -0500	[thread overview]
Message-ID: <20250425005439.2252467-22-eblake@redhat.com> (raw)
In-Reply-To: <20250425005439.2252467-13-eblake@redhat.com>

From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>

Move the definition from iotests/250 to common.rc.  This is used to
detect real disk usage of sparse files.  In particular, we want to use
it for checking subclusters-based discards.

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-ID: <20240913163942.423050-6-andrey.drobyshev@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/qemu-iotests/common.rc | 6 ++++++
 tests/qemu-iotests/250       | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 95c12577dd4..237f746af88 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -140,6 +140,12 @@ _optstr_add()
     fi
 }

+# report real disk usage for sparse files
+disk_usage()
+{
+    du --block-size=1 "$1" | awk '{print $1}'
+}
+
 # Set the variables to the empty string to turn Valgrind off
 # for specific processes, e.g.
 # $ VALGRIND_QEMU_IO= ./check -qcow2 -valgrind 015
diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250
index af48f83abac..c0a0dbc0ff1 100755
--- a/tests/qemu-iotests/250
+++ b/tests/qemu-iotests/250
@@ -52,11 +52,6 @@ _unsupported_imgopts data_file
 # bdrv_co_truncate(bs->file) call in qcow2_co_truncate(), which might succeed
 # anyway.

-disk_usage()
-{
-    du --block-size=1 $1 | awk '{print $1}'
-}
-
 size=2100M

 _make_test_img -o "cluster_size=1M,preallocation=metadata" $size
-- 
2.49.0



  parent reply	other threads:[~2025-04-25  0:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  0:52 [PATCH v3 00/11] Make blockdev-mirror dest sparse in more cases Eric Blake
2025-04-25  0:52 ` [PATCH v3 01/11] block: Expand block status mode from bool to flags Eric Blake
2025-04-25  0:52 ` [PATCH v3 02/11] file-posix, gluster: Handle zero block status hint better Eric Blake
2025-04-25  0:52 ` [PATCH v3 03/11] block: Let bdrv_co_is_zero_fast consolidate adjacent extents Eric Blake
2025-05-01 17:20   ` Stefan Hajnoczi
2025-04-25  0:52 ` [PATCH v3 04/11] block: Add new bdrv_co_is_all_zeroes() function Eric Blake
2025-05-01 17:24   ` Stefan Hajnoczi
2025-04-25  0:52 ` [PATCH v3 05/11] iotests: Improve iotest 194 to mirror data Eric Blake
2025-04-25  0:52 ` [PATCH v3 06/11] mirror: Minor refactoring Eric Blake
2025-04-25  0:52 ` [PATCH v3 07/11] mirror: Skip pre-zeroing destination if it is already zero Eric Blake
2025-04-30 16:09   ` Sunny Zhu
2025-05-01 17:33     ` Eric Blake
2025-05-02  3:26       ` Sunny Zhu
2025-04-25  0:52 ` [PATCH v3 08/11] mirror: Skip writing zeroes when target " Eric Blake
2025-04-30 16:38   ` Re " Sunny Zhu
2025-05-01 17:58     ` Eric Blake
2025-05-02  5:43       ` Sunny Zhu
2025-04-25  0:52 ` Eric Blake [this message]
2025-04-25  0:52 ` [PATCH v3 10/11] tests: Add iotest mirror-sparse for recent patches Eric Blake
2025-05-01 17:34   ` Stefan Hajnoczi
2025-05-01 18:00     ` Eric Blake
2025-05-09 15:33   ` Eric Blake
2025-08-01  7:54   ` Michael Tokarev
2025-04-25  0:52 ` [PATCH v3 11/11] mirror: Allow QMP override to declare target already zero Eric Blake

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=20250425005439.2252467-22-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=berto@igalia.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    /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).