qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH 5/6] vmdk: Flush only once in vmdk_L2update()
Date: Thu, 30 Apr 2020 09:18:29 -0500	[thread overview]
Message-ID: <aa7db1b1-8376-eeae-dbe7-29768fbc30fc@redhat.com> (raw)
In-Reply-To: <20200430133007.170335-6-kwolf@redhat.com>

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 <kwolf@redhat.com>
> ---
>   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 <eblake@redhat.com>

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



  reply	other threads:[~2020-04-30 14:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 13:30 [PATCH 0/6] vmdk: Fix zero cluster handling Kevin Wolf
2020-04-30 13:30 ` [PATCH 1/6] vmdk: Rename VmdkMetaData.valid to new_allocation Kevin Wolf
2020-04-30 14:10   ` Eric Blake
2020-04-30 13:30 ` [PATCH 2/6] vmdk: Fix zero cluster allocation Kevin Wolf
2020-04-30 14:14   ` Eric Blake
2020-04-30 14:19   ` Eric Blake
2020-04-30 14:32     ` Kevin Wolf
2020-04-30 13:30 ` [PATCH 3/6] vmdk: Fix partial overwrite of zero cluster Kevin Wolf
2020-04-30 14:16   ` Eric Blake
2020-04-30 13:30 ` [PATCH 4/6] vmdk: Don't update L2 table for zero write on " Kevin Wolf
2020-04-30 14:17   ` Eric Blake
2020-04-30 13:30 ` [PATCH 5/6] vmdk: Flush only once in vmdk_L2update() Kevin Wolf
2020-04-30 14:18   ` Eric Blake [this message]
2020-04-30 13:30 ` [PATCH 6/6] iotests: vmdk: Enable zeroed_grained=on by default Kevin Wolf
2020-04-30 14:22   ` Eric Blake
2020-04-30 14:42     ` Kevin Wolf
2020-05-05  9:42 ` [PATCH 0/6] vmdk: Fix zero cluster handling Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa7db1b1-8376-eeae-dbe7-29768fbc30fc@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).