]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
iotests/common.rc: add disk_usage function
authorAndrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Fri, 9 May 2025 20:40:29 +0000 (15:40 -0500)
committerEric Blake <eblake@redhat.com>
Thu, 15 May 2025 02:22:22 +0000 (21:22 -0500)
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>
Message-ID: <20250509204341.3553601-27-eblake@redhat.com>

tests/qemu-iotests/250
tests/qemu-iotests/common.rc

index af48f83abacaf60bd56043a92a4db12f96227737..c0a0dbc0ff1e88013a3a4834eabc4d5e680cb14b 100755 (executable)
@@ -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
index 95c12577dd48ef9b07d1ac0ad1533f359dea8ccb..237f746af88f9e178f5d47739c989a3e45c3e36c 100644 (file)
@@ -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