|
|
902636 |
From 55bfda3a0e077b822f57e8ed901f0cee848bc471 Mon Sep 17 00:00:00 2001
|
|
|
902636 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Date: Mon, 8 Jun 2020 15:01:35 +0100
|
|
|
902636 |
Subject: [PATCH 07/17] file-posix: Support BDRV_REQ_ZERO_WRITE for truncate
|
|
|
902636 |
|
|
|
902636 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Message-id: <20200608150140.38218-7-kwolf@redhat.com>
|
|
|
902636 |
Patchwork-id: 97452
|
|
|
902636 |
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 06/11] file-posix: 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 |
For regular files, we always get BDRV_REQ_ZERO_WRITE behaviour from the
|
|
|
902636 |
OS, so we can advertise the flag and just ignore it.
|
|
|
902636 |
|
|
|
902636 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
902636 |
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
|
|
902636 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
902636 |
Message-Id: <20200424125448.63318-7-kwolf@redhat.com>
|
|
|
902636 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
(cherry picked from commit 2f0c6e7a650de133eccd94e9bb6cf7b2070f07f1)
|
|
|
902636 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
902636 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
902636 |
---
|
|
|
902636 |
block/file-posix.c | 4 ++++
|
|
|
902636 |
1 file changed, 4 insertions(+)
|
|
|
902636 |
|
|
|
902636 |
diff --git a/block/file-posix.c b/block/file-posix.c
|
|
|
902636 |
index 7551e8d..adafbfa 100644
|
|
|
902636 |
--- a/block/file-posix.c
|
|
|
902636 |
+++ b/block/file-posix.c
|
|
|
902636 |
@@ -674,6 +674,10 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
|
|
902636 |
#endif
|
|
|
902636 |
|
|
|
902636 |
bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK;
|
|
|
902636 |
+ if (S_ISREG(st.st_mode)) {
|
|
|
902636 |
+ /* When extending regular files, we get zeros from the OS */
|
|
|
902636 |
+ bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
|
|
|
902636 |
+ }
|
|
|
902636 |
ret = 0;
|
|
|
902636 |
fail:
|
|
|
902636 |
if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) {
|
|
|
902636 |
--
|
|
|
902636 |
1.8.3.1
|
|
|
902636 |
|