file-win32: Support BDRV_REQ_ZERO_WRITE for truncate
When using bdrv_file, .bdrv_has_zero_init_truncate always returns 1; therefore, we can behave just like file-posix, and always implement BDRV_REQ_ZERO_WRITE by ignoring it since the OS gives it to us for free (note that file-posix.c had to use an 'if' because it shared code between regular files and block devices, but in file-win32.c, bdrv_host_device uses a separate .bdrv_file_open). Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20200428202905.770727-3-eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
5e09bcee5b
commit
8e51979504
@ -408,6 +408,9 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
win32_aio_attach_aio_context(s->aio, bdrv_get_aio_context(bs));
|
win32_aio_attach_aio_context(s->aio, bdrv_get_aio_context(bs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When extending regular files, we get zeros from the OS */
|
||||||
|
bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
fail:
|
fail:
|
||||||
qemu_opts_del(opts);
|
qemu_opts_del(opts);
|
||||||
|
Loading…
Reference in New Issue
Block a user