From 85e9f67d9d07dcbdc03e582262943d7a13919a6d Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 6 Sep 2023 17:37:52 +0300 Subject: [PATCH] Add supported_truncate_flags --- src/qemu_driver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 0024c5d3..28eaf9b5 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -493,6 +493,10 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E return -1; } bs->total_sectors = client->size / BDRV_SECTOR_SIZE; +#if QEMU_VERSION_MAJOR > 5 || QEMU_VERSION_MAJOR == 5 && QEMU_VERSION_MINOR >= 1 + /* When extending regular files, we get zeros from the OS */ + bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE; +#endif //client->aio_context = bdrv_get_aio_context(bs); qdict_del(options, "use-rdma"); qdict_del(options, "rdma-mtu");