[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/9] file-win32: Support BDRV_REQ_ZERO_WRITE for truncate
From: |
Eric Blake |
Subject: |
[PATCH 2/9] file-win32: Support BDRV_REQ_ZERO_WRITE for truncate |
Date: |
Tue, 28 Apr 2020 15:28:58 -0500 |
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 <address@hidden>
---
block/file-win32.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/file-win32.c b/block/file-win32.c
index a6b0dda5c302..fa569685d8bc 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -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));
}
+ /* When extending regular files, we get zeros from the OS */
+ bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
+
ret = 0;
fail:
qemu_opts_del(opts);
--
2.26.2
- [PATCH 0/9] More truncate improvements, Eric Blake, 2020/04/28
- [PATCH 2/9] file-win32: Support BDRV_REQ_ZERO_WRITE for truncate,
Eric Blake <=
- [PATCH 3/9] nfs: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 1/9] gluster: Drop useless has_zero_init callback, Eric Blake, 2020/04/28
- [PATCH 5/9] sheepdog: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 4/9] rbd: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 6/9] ssh: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 8/9] vhdx: Rework truncation logic, Eric Blake, 2020/04/28
- [PATCH 7/9] parallels: Rework truncation logic, Eric Blake, 2020/04/28
- [PATCH 9/9] block: Drop unused .bdrv_has_zero_init_truncate, Eric Blake, 2020/04/28