[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 24/43] block/null: Implement bdrv_get_allocated_file_size
From: |
Max Reitz |
Subject: |
[PATCH v8 24/43] block/null: Implement bdrv_get_allocated_file_size |
Date: |
Tue, 1 Sep 2020 16:34:05 +0200 |
It is trivial, so we might as well do it.
Remove _filter_actual_image_size from iotest 184, so we get to see the
result in its reference output.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/null.c | 7 +++++++
tests/qemu-iotests/153.out | 2 +-
tests/qemu-iotests/184 | 3 +--
tests/qemu-iotests/184.out | 6 ++++--
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/block/null.c b/block/null.c
index 15e1d56746..cc9b1d4ea7 100644
--- a/block/null.c
+++ b/block/null.c
@@ -262,6 +262,11 @@ static void null_refresh_filename(BlockDriverState *bs)
bs->drv->format_name);
}
+static int64_t null_allocated_file_size(BlockDriverState *bs)
+{
+ return 0;
+}
+
static const char *const null_strong_runtime_opts[] = {
BLOCK_OPT_SIZE,
NULL_OPT_ZEROES,
@@ -277,6 +282,7 @@ static BlockDriver bdrv_null_co = {
.bdrv_file_open = null_file_open,
.bdrv_parse_filename = null_co_parse_filename,
.bdrv_getlength = null_getlength,
+ .bdrv_get_allocated_file_size = null_allocated_file_size,
.bdrv_co_preadv = null_co_preadv,
.bdrv_co_pwritev = null_co_pwritev,
@@ -297,6 +303,7 @@ static BlockDriver bdrv_null_aio = {
.bdrv_file_open = null_file_open,
.bdrv_parse_filename = null_aio_parse_filename,
.bdrv_getlength = null_getlength,
+ .bdrv_get_allocated_file_size = null_allocated_file_size,
.bdrv_aio_preadv = null_aio_preadv,
.bdrv_aio_pwritev = null_aio_pwritev,
diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out
index 8a79e1ee87..fcaa71aeee 100644
--- a/tests/qemu-iotests/153.out
+++ b/tests/qemu-iotests/153.out
@@ -464,7 +464,7 @@ No conflict:
image: null-co://
file format: null-co
virtual size: 1 GiB (1073741824 bytes)
-disk size: unavailable
+disk size: 0 B
Conflict:
qemu-img: --force-share/-U conflicts with image options
diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
index 33dd8d2a4f..eebb53faed 100755
--- a/tests/qemu-iotests/184
+++ b/tests/qemu-iotests/184
@@ -45,8 +45,7 @@ do_run_qemu()
run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
- | _filter_qemu_io | _filter_generated_node_ids \
- | _filter_actual_image_size
+ | _filter_qemu_io | _filter_generated_node_ids
}
test_throttle=$($QEMU_IMG --help|grep throttle)
diff --git a/tests/qemu-iotests/184.out b/tests/qemu-iotests/184.out
index 3deb3cfb94..dec4017ad5 100644
--- a/tests/qemu-iotests/184.out
+++ b/tests/qemu-iotests/184.out
@@ -29,7 +29,8 @@ Testing:
"image": {
"virtual-size": 1073741824,
"filename": "json:{\"throttle-group\": \"group0\", \"driver\":
\"throttle\", \"file\": {\"driver\": \"null-co\"}}",
- "format": "throttle"
+ "format": "throttle",
+ "actual-size": 0
},
"iops_wr": 0,
"ro": false,
@@ -56,7 +57,8 @@ Testing:
"image": {
"virtual-size": 1073741824,
"filename": "null-co://",
- "format": "null-co"
+ "format": "null-co",
+ "actual-size": 0
},
"iops_wr": 0,
"ro": false,
--
2.26.2
- [PATCH v8 12/43] stream: Deal with filters, (continued)
- [PATCH v8 12/43] stream: Deal with filters, Max Reitz, 2020/09/01
- [PATCH v8 13/43] block: Use CAFs when working with backing chains, Max Reitz, 2020/09/01
- [PATCH v8 14/43] block: Use bdrv_cow_child() in bdrv_co_truncate(), Max Reitz, 2020/09/01
- [PATCH v8 15/43] block: Re-evaluate backing file handling in reopen, Max Reitz, 2020/09/01
- [PATCH v8 17/43] vmdk: Drop vmdk_co_flush(), Max Reitz, 2020/09/01
- [PATCH v8 16/43] block: Flush all children in generic code, Max Reitz, 2020/09/01
- [PATCH v8 18/43] block: Iterate over children in refresh_limits, Max Reitz, 2020/09/01
- [PATCH v8 19/43] block: Use CAFs in bdrv_refresh_filename(), Max Reitz, 2020/09/01
- [PATCH v8 20/43] block: Use CAF in bdrv_co_rw_vmstate(), Max Reitz, 2020/09/01
- [PATCH v8 21/43] block/snapshot: Fix fallback, Max Reitz, 2020/09/01
- [PATCH v8 24/43] block/null: Implement bdrv_get_allocated_file_size,
Max Reitz <=
- [PATCH v8 22/43] block: Use CAFs for debug breakpoints, Max Reitz, 2020/09/01
- [PATCH v8 23/43] block: Improve get_allocated_file_size's default, Max Reitz, 2020/09/01
- [PATCH v8 25/43] blockdev: Use CAF in external_snapshot_prepare(), Max Reitz, 2020/09/01
- [PATCH v8 26/43] block: Report data child for query-blockstats, Max Reitz, 2020/09/01
- [PATCH v8 27/43] block: Use child access functions for QAPI queries, Max Reitz, 2020/09/01
- [PATCH v8 28/43] block-copy: Use CAF to find sync=top base, Max Reitz, 2020/09/01
- [PATCH v8 29/43] mirror: Deal with filters, Max Reitz, 2020/09/01
- [PATCH v8 30/43] backup: Deal with filters, Max Reitz, 2020/09/01