|
|
902636 |
From 5d590d354e42515ea074bf2110a2ab236dbabba1 Mon Sep 17 00:00:00 2001
|
|
|
902636 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Date: Mon, 8 Jun 2020 15:01:34 +0100
|
|
|
902636 |
Subject: [PATCH 06/17] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate
|
|
|
902636 |
|
|
|
902636 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Message-id: <20200608150140.38218-6-kwolf@redhat.com>
|
|
|
902636 |
Patchwork-id: 97447
|
|
|
902636 |
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 05/11] raw-format: Support BDRV_REQ_ZERO_WRITE for truncate
|
|
|
902636 |
Bugzilla: 1780574
|
|
|
902636 |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
902636 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
902636 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
902636 |
|
|
|
902636 |
The raw format driver can simply forward the flag and let its bs->file
|
|
|
902636 |
child take care of actually providing the zeros.
|
|
|
902636 |
|
|
|
902636 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
902636 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
902636 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
902636 |
Message-Id: <20200424125448.63318-6-kwolf@redhat.com>
|
|
|
902636 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
(cherry picked from commit 1ddaabaecb7eaeb6d8948a32340af95db44c54a1)
|
|
|
902636 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
902636 |
---
|
|
|
902636 |
block/raw-format.c | 4 +++-
|
|
|
902636 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
902636 |
|
|
|
902636 |
diff --git a/block/raw-format.c b/block/raw-format.c
|
|
|
902636 |
index c3acf9a..bdec466 100644
|
|
|
902636 |
--- a/block/raw-format.c
|
|
|
902636 |
+++ b/block/raw-format.c
|
|
|
902636 |
@@ -387,7 +387,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
|
|
902636 |
|
|
|
902636 |
s->size = offset;
|
|
|
902636 |
offset += s->offset;
|
|
|
902636 |
- return bdrv_co_truncate(bs->file, offset, exact, prealloc, 0, errp);
|
|
|
902636 |
+ return bdrv_co_truncate(bs->file, offset, exact, prealloc, flags, errp);
|
|
|
902636 |
}
|
|
|
902636 |
|
|
|
902636 |
static void raw_eject(BlockDriverState *bs, bool eject_flag)
|
|
|
902636 |
@@ -445,6 +445,8 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
902636 |
bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
|
|
|
902636 |
((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
|
|
|
902636 |
bs->file->bs->supported_zero_flags);
|
|
|
902636 |
+ bs->supported_truncate_flags = bs->file->bs->supported_truncate_flags &
|
|
|
902636 |
+ BDRV_REQ_ZERO_WRITE;
|
|
|
902636 |
|
|
|
902636 |
if (bs->probed && !bdrv_is_read_only(bs)) {
|
|
|
902636 |
bdrv_refresh_filename(bs->file->bs);
|
|
|
902636 |
--
|
|
|
902636 |
1.8.3.1
|
|
|
902636 |
|