diff options
| author | Eric Blake <eblake@redhat.com> | 2025-05-09 15:40:18 -0500 |
|---|---|---|
| committer | Eric Blake <eblake@redhat.com> | 2025-05-14 15:33:34 -0500 |
| commit | c33159dec79069514f78faecfe268439226b0f5b (patch) | |
| tree | 651e46b5273c37edbe34f125d607998dc01743a8 /tests/unit/test-block-iothread.c | |
| parent | 864813878951b44e964eb4c012d832fd21f8cc0c (diff) | |
| download | focaccia-qemu-c33159dec79069514f78faecfe268439226b0f5b.tar.gz focaccia-qemu-c33159dec79069514f78faecfe268439226b0f5b.zip | |
block: Expand block status mode from bool to flags
This patch is purely mechanical, changing bool want_zero into an unsigned int for bitwise-or of flags. As of this patch, all implementations are unchanged (the old want_zero==true is now mode==BDRV_WANT_PRECISE which is a superset of BDRV_WANT_ZERO); but the callers in io.c that used to pass want_zero==false are now prepared for future driver changes that can now distinguish bewteen BDRV_WANT_ZERO vs. BDRV_WANT_ALLOCATED. The next patch will actually change the file-posix driver along those lines, now that we have more-specific hints. As for the background why this patch is useful: right now, the file-posix driver recognizes that if allocation is being queried, the entire image can be reported as allocated (there is no backing file to refer to) - but this throws away information on whether the entire image reads as zero (trivially true if lseek(SEEK_HOLE) at offset 0 returns -ENXIO, a bit more complicated to prove if the raw file was created with 'qemu-img create' since we intentionally allocate a small chunk of all-zero data to help with alignment probing). Later patches will add a generic algorithm for seeing if an entire file reads as zeroes. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20250509204341.3553601-16-eblake@redhat.com>
Diffstat (limited to 'tests/unit/test-block-iothread.c')
| -rw-r--r-- | tests/unit/test-block-iothread.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c index 2b358eaaa8..e26b3be593 100644 --- a/tests/unit/test-block-iothread.c +++ b/tests/unit/test-block-iothread.c @@ -63,7 +63,7 @@ bdrv_test_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, } static int coroutine_fn bdrv_test_co_block_status(BlockDriverState *bs, - bool want_zero, + unsigned int mode, int64_t offset, int64_t count, int64_t *pnum, int64_t *map, BlockDriverState **file) |