[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/30] vmdk: Flush only once in vmdk_L2update()
From: |
Kevin Wolf |
Subject: |
[PULL 14/30] vmdk: Flush only once in vmdk_L2update() |
Date: |
Fri, 8 May 2020 14:41:19 +0200 |
If we have a backup L2 table, we currently flush once after writing to
the active L2 table and again after writing to the backup table. A
single flush is enough and makes things a little less slow.
Signed-off-by: Kevin Wolf <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vmdk.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 2880d88dea..b18f128816 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1435,7 +1435,7 @@ static int vmdk_L2update(VmdkExtent *extent, VmdkMetaData
*m_data,
offset = cpu_to_le32(offset);
/* update L2 table */
BLKDBG_EVENT(extent->file, BLKDBG_L2_UPDATE);
- if (bdrv_pwrite_sync(extent->file,
+ if (bdrv_pwrite(extent->file,
((int64_t)m_data->l2_offset * 512)
+ (m_data->l2_index * sizeof(offset)),
&offset, sizeof(offset)) < 0) {
@@ -1444,13 +1444,16 @@ static int vmdk_L2update(VmdkExtent *extent,
VmdkMetaData *m_data,
/* update backup L2 table */
if (extent->l1_backup_table_offset != 0) {
m_data->l2_offset = extent->l1_backup_table[m_data->l1_index];
- if (bdrv_pwrite_sync(extent->file,
+ if (bdrv_pwrite(extent->file,
((int64_t)m_data->l2_offset * 512)
+ (m_data->l2_index * sizeof(offset)),
&offset, sizeof(offset)) < 0) {
return VMDK_ERROR;
}
}
+ if (bdrv_flush(extent->file->bs) < 0) {
+ return VMDK_ERROR;
+ }
if (m_data->l2_cache_entry) {
*m_data->l2_cache_entry = offset;
}
--
2.25.3
- [PULL 03/30] iotests/148: use skip_if_unsupported, (continued)
- [PULL 03/30] iotests/148: use skip_if_unsupported, Kevin Wolf, 2020/05/08
- [PULL 06/30] iotests/055: skip vmdk target tests if vmdk is not whitelisted, Kevin Wolf, 2020/05/08
- [PULL 05/30] iotests/055: refactor compressed backup to vmdk, Kevin Wolf, 2020/05/08
- [PULL 07/30] iotests/109: mark required formats as required to support whitelisting, Kevin Wolf, 2020/05/08
- [PULL 08/30] iotests/113: mark bochs as required to support whitelisting, Kevin Wolf, 2020/05/08
- [PULL 10/30] vmdk: Rename VmdkMetaData.valid to new_allocation, Kevin Wolf, 2020/05/08
- [PULL 13/30] vmdk: Don't update L2 table for zero write on zero cluster, Kevin Wolf, 2020/05/08
- [PULL 12/30] vmdk: Fix partial overwrite of zero cluster, Kevin Wolf, 2020/05/08
- [PULL 11/30] vmdk: Fix zero cluster allocation, Kevin Wolf, 2020/05/08
- [PULL 09/30] qcow2: Avoid integer wraparound in qcow2_co_truncate(), Kevin Wolf, 2020/05/08
- [PULL 14/30] vmdk: Flush only once in vmdk_L2update(),
Kevin Wolf <=
- [PULL 16/30] iotests/283: Use consistent size for source and target, Kevin Wolf, 2020/05/08
- [PULL 15/30] iotests: vmdk: Enable zeroed_grained=on by default, Kevin Wolf, 2020/05/08
- [PULL 21/30] qcow2: Fix preallocation on block devices, Kevin Wolf, 2020/05/08
- [PULL 27/30] ssh: Support BDRV_REQ_ZERO_WRITE for truncate, Kevin Wolf, 2020/05/08
- [PULL 22/30] gluster: Drop useless has_zero_init callback, Kevin Wolf, 2020/05/08
- [PULL 17/30] backup: Improve error for bdrv_getlength() failure, Kevin Wolf, 2020/05/08
- [PULL 20/30] iotests/055: Use cache.no-flush for vmdk target, Kevin Wolf, 2020/05/08
- [PULL 18/30] backup: Make sure that source and target size match, Kevin Wolf, 2020/05/08
- [PULL 29/30] vhdx: Rework truncation logic, Kevin Wolf, 2020/05/08
- [PULL 19/30] iotests: Backup with different source/target size, Kevin Wolf, 2020/05/08