QED does not deliver flush on synchronized write

Bug #1353545 reported by Nybble
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Invalid
Undecided
Unassigned

Bug Description

At least one flush method should be provided by qed driver (common/co/aio).

I was doing "sync write" benchmarking on varies qemu supported formats (on ssd). I was surprised that QED shows significant high performance over several other formats (qcow2/vmdk/vdi..). In some test cases QED even runs a little bit faster than raw format!

After careful reading of the code I found QED skipped the necessary flush by providing nothing on flush api. unlike read/write which require at least one type of implementation, flush API is not mandatory because your format could guarantee that synchronization is done in write path or others. However that's not the case in QED because data is buffered in the "bs->file" and QED needs to propagate the flush command to it to make data safe.

However I'm not a skilled qemu developer. Above is what I got from my thinking and study. Please correct me if in any way I misunderstood the design. I really appreciate!

The patch is short:
https://github.com/wuxb45/qemu/commit/fe46e640f53a006907091e910fb4868a878ea0a8

qemu release version: 2.1.0. But this should have been there for a long time.
The patch is based on this recent commit:
69f87f713069f1f70f86cb65883f7d43e3aa21de

Thanks.

Tags: block disk qed
Nybble (wuxb45)
description: updated
Nybble (wuxb45)
Changed in qemu:
status: New → Invalid
Revision history for this message
Stefan Hajnoczi (stefanha) wrote : Re: [Qemu-devel] [Bug 1353545] Re: QED does not deliver flush on synchronized write

On Wed, Aug 06, 2014 at 03:32:29PM -0000, Nybble wrote:
> ** Changed in: qemu
> Status: New => Invalid

I guess you saw that bdrv_co_flush() calls bdrv_co_flush(bs->file).
This means that even block drivers that do not provide
->bdrv_co_flush_to_disk() will have fdatasync() called on their image
file.

Stefan

Revision history for this message
Nybble (wuxb45) wrote :

I'm really sorry that I didn't see that call when I submit this...
I was writing a experimental block image driver and found it runs too slow. It turned out that it calls bdrv_flush itself and the flush on ->file is than called again from block.c

thanks for your confirmation!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.