[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/15] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate
From: |
Kevin Wolf |
Subject: |
[PULL 07/15] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate |
Date: |
Thu, 30 Apr 2020 17:52:23 +0200 |
The raw format driver can simply forward the flag and let its bs->file
child take care of actually providing the zeros.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/raw-format.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/raw-format.c b/block/raw-format.c
index 3465c9a865..351f2d91c6 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -387,7 +387,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState
*bs, int64_t offset,
s->size = offset;
offset += s->offset;
- return bdrv_co_truncate(bs->file, offset, exact, prealloc, 0, errp);
+ return bdrv_co_truncate(bs->file, offset, exact, prealloc, flags, errp);
}
static void raw_eject(BlockDriverState *bs, bool eject_flag)
@@ -445,6 +445,8 @@ static int raw_open(BlockDriverState *bs, QDict *options,
int flags,
bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
bs->file->bs->supported_zero_flags);
+ bs->supported_truncate_flags = bs->file->bs->supported_truncate_flags &
+ BDRV_REQ_ZERO_WRITE;
if (bs->probed && !bdrv_is_read_only(bs)) {
bdrv_refresh_filename(bs->file->bs);
--
2.25.3
- [PULL 00/15] Block layer patches, Kevin Wolf, 2020/04/30
- [PULL 01/15] qcow2: Add incompatibility note between backing files and raw external data files, Kevin Wolf, 2020/04/30
- [PULL 02/15] qemu-iotests: allow qcow2 external discarded clusters to contain stale data, Kevin Wolf, 2020/04/30
- [PULL 03/15] block: Add flags to BlockDriver.bdrv_co_truncate(), Kevin Wolf, 2020/04/30
- [PULL 04/15] block: Add flags to bdrv(_co)_truncate(), Kevin Wolf, 2020/04/30
- [PULL 05/15] block-backend: Add flags to blk_truncate(), Kevin Wolf, 2020/04/30
- [PULL 07/15] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate,
Kevin Wolf <=
- [PULL 06/15] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate, Kevin Wolf, 2020/04/30
- [PULL 08/15] file-posix: Support BDRV_REQ_ZERO_WRITE for truncate, Kevin Wolf, 2020/04/30
- [PULL 09/15] block: truncate: Don't make backing file data visible, Kevin Wolf, 2020/04/30
- [PULL 10/15] iotests: Filter testfiles out in filter_img_info(), Kevin Wolf, 2020/04/30
- [PULL 12/15] qcow2: Forward ZERO_WRITE flag for full preallocation, Kevin Wolf, 2020/04/30
- [PULL 11/15] iotests: Test committing to short backing file, Kevin Wolf, 2020/04/30
- [PULL 13/15] nvme: introduce PMR support from NVMe 1.4 spec, Kevin Wolf, 2020/04/30
- [PULL 15/15] qemu-storage-daemon: Fix non-string --object properties, Kevin Wolf, 2020/04/30
- [PULL 14/15] qom: Factor out user_creatable_add_dict(), Kevin Wolf, 2020/04/30