mirror of https://github.com/proxmox/mirror_qemu
block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty()
Use bdrv_pwrite_sync() instead of calling bdrv_pwrite() and bdrv_flush() separately. Signed-off-by: Alberto Faria <afaria@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220609152744.3891847-11-afaria@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>master
parent
a8f0e83cef
commit
86da43220c
|
@ -516,15 +516,12 @@ int qcow2_mark_dirty(BlockDriverState *bs)
|
|||
}
|
||||
|
||||
val = cpu_to_be64(s->incompatible_features | QCOW2_INCOMPAT_DIRTY);
|
||||
ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, incompatible_features),
|
||||
ret = bdrv_pwrite_sync(bs->file,
|
||||
offsetof(QCowHeader, incompatible_features),
|
||||
sizeof(val), &val, 0);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
ret = bdrv_flush(bs->file->bs);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Only treat image as dirty if the header was updated successfully */
|
||||
s->incompatible_features |= QCOW2_INCOMPAT_DIRTY;
|
||||
|
|
Loading…
Reference in New Issue