qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/6] vmdk: Flush only once in vmdk_L2update()


From: Eric Blake
Subject: Re: [PATCH 5/6] vmdk: Flush only once in vmdk_L2update()
Date: Thu, 30 Apr 2020 09:18:29 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 4/30/20 8:30 AM, Kevin Wolf wrote:
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>
---
  block/vmdk.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index dcd30f1419..d3eb9a5cdc 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) {

Worth reindenting ther est of the function call?

@@ -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;
+    }

But indentation doesn't affect correctness.

Reviewed-by: Eric Blake <address@hidden>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]