[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/97] qcow2: Avoid COW during metadata preallocation
From: |
Michael Roth |
Subject: |
[PATCH 01/97] qcow2: Avoid COW during metadata preallocation |
Date: |
Tue, 1 Oct 2019 18:44:40 -0500 |
From: Kevin Wolf <address@hidden>
Limiting the allocation to INT_MAX bytes isn't particularly clever
because it means that the final cluster will be a partial cluster which
will be completed through a COW operation. This results in unnecessary
data read and write requests which lead to an unwanted non-sparse
filesystem block for metadata preallocation.
Align the maximum allocation size down to the cluster size to avoid this
situation.
Cc: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
(cherry picked from commit f29fbf7c6b1c9a84f6931c1c222716fbe073e6e4)
Signed-off-by: Michael Roth <address@hidden>
---
block/qcow2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 3ace3b2209..dfac74c264 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2734,7 +2734,7 @@ static int coroutine_fn preallocate_co(BlockDriverState
*bs, uint64_t offset,
bytes = new_length - offset;
while (bytes) {
- cur_bytes = MIN(bytes, INT_MAX);
+ cur_bytes = MIN(bytes, QEMU_ALIGN_DOWN(INT_MAX, s->cluster_size));
ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes,
&host_offset, &meta);
if (ret < 0) {
--
2.17.1
- [PATCH 00/97] Patch Round-up for stable 4.0.1, freeze on 2019-10-10, Michael Roth, 2019/10/01
- [PATCH 12/97] usb-tablet: fix serial compat property, Michael Roth, 2019/10/01
- [PATCH 22/97] iotests.py: rewrite run_job to be pickier, Michael Roth, 2019/10/01
- [PATCH 21/97] iotests.py: Fix VM.run_job, Michael Roth, 2019/10/01
- [PATCH 16/97] blockdev-backup: don't check aio_context too early, Michael Roth, 2019/10/01
- [PATCH 11/97] kbd-state: fix autorepeat handling, Michael Roth, 2019/10/01
- [PATCH 15/97] s390x/cpumodel: ignore csske for expansion, Michael Roth, 2019/10/01
- [PATCH 24/97] migration/dirty-bitmaps: change bitmap enumeration method, Michael Roth, 2019/10/01
- [PATCH 18/97] iotests: Test commit job start with concurrent I/O, Michael Roth, 2019/10/01
- [PATCH 28/97] target/ppc: Fix xxbrq, xxbrw, Michael Roth, 2019/10/01
- [PATCH 01/97] qcow2: Avoid COW during metadata preallocation,
Michael Roth <=
- [PATCH 30/97] target/ppc: Fix lxvw4x, lxvh8x and lxvb16x, Michael Roth, 2019/10/01
- [PATCH 13/97] block/file-posix: Unaligned O_DIRECT block-status, Michael Roth, 2019/10/01
- [PATCH 29/97] target/ppc: Fix vsum2sws, Michael Roth, 2019/10/01
- [PATCH 34/97] target/i386: define md-clear bit, Michael Roth, 2019/10/01
- [PATCH 14/97] iotests: Test unaligned raw images with O_DIRECT, Michael Roth, 2019/10/01
- [PATCH 20/97] QEMUMachine: add events_wait method, Michael Roth, 2019/10/01
- [PATCH 33/97] target/i386: add MDS-NO feature, Michael Roth, 2019/10/01
- [PATCH 25/97] vhost: fix vhost_log size overflow during migration, Michael Roth, 2019/10/01
- [PATCH 02/97] qcow2: Add errp to preallocate_co(), Michael Roth, 2019/10/01
- [PATCH 37/97] usbredir: fix buffer-overflow on vmload, Michael Roth, 2019/10/01