Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-29 Thread Marcelo Tosatti
On Sat, Mar 29, 2008 at 01:09:30AM +, Jamie Lokier wrote: Marcelo Tosatti wrote: I don't think the first qemu_aio_flush() is necessary because the fsync request will be enqueued after pending ones: aio_fsync() function does a sync on all outstanding asynchronous I/O

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Jamie Lokier
Marcelo Tosatti wrote: Its necessary to guarantee that pending AIO writes have reached stable storage when the flush request returns. Also change fsync() to fdatasync(), since the modification time is not critical data. +if (aio_fsync(O_DSYNC, acb-aiocb) 0) { BDRVRawState *s =

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Marcelo Tosatti
On Fri, Mar 28, 2008 at 03:07:03PM +, Jamie Lokier wrote: Marcelo Tosatti wrote: Its necessary to guarantee that pending AIO writes have reached stable storage when the flush request returns. Also change fsync() to fdatasync(), since the modification time is not critical data. +

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Paul Brook
On Friday 28 March 2008, Marcelo Tosatti wrote: On Fri, Mar 28, 2008 at 03:07:03PM +, Jamie Lokier wrote: Marcelo Tosatti wrote: Its necessary to guarantee that pending AIO writes have reached stable storage when the flush request returns. Also change fsync() to fdatasync(),

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Marcelo Tosatti
On Fri, Mar 28, 2008 at 04:40:54PM +, Paul Brook wrote: On Friday 28 March 2008, Marcelo Tosatti wrote: On Fri, Mar 28, 2008 at 03:07:03PM +, Jamie Lokier wrote: Marcelo Tosatti wrote: Its necessary to guarantee that pending AIO writes have reached stable storage when the

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Paul Brook
Surely you should be using the normal aio notification to wait for the aio_fsync to complete before reporting success to the device. qemu_aio_flush() will wait for all pending AIO requests (including aio_fsync) to complete. Then why do you need to separate fdatasync? Paul

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Ian Jackson
Marcelo Tosatti writes ([Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request ): Its necessary to guarantee that pending AIO writes have reached stable storage when the flush request returns. Surely it isn't necessary to call qemu_aio_flush ? Because those pending AIO writes have not

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Jamie Lokier
Marcelo Tosatti wrote: On Fri, Mar 28, 2008 at 03:07:03PM +, Jamie Lokier wrote: Marcelo Tosatti wrote: Its necessary to guarantee that pending AIO writes have reached stable storage when the flush request returns. Also change fsync() to fdatasync(), since the modification time

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Marcelo Tosatti
On Fri, Mar 28, 2008 at 05:00:39PM +, Paul Brook wrote: Surely you should be using the normal aio notification to wait for the aio_fsync to complete before reporting success to the device. qemu_aio_flush() will wait for all pending AIO requests (including aio_fsync) to complete.

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Marcelo Tosatti
On Fri, Mar 28, 2008 at 06:03:25PM +, Jamie Lokier wrote: Marcelo Tosatti wrote: On Fri, Mar 28, 2008 at 03:07:03PM +, Jamie Lokier wrote: Marcelo Tosatti wrote: Its necessary to guarantee that pending AIO writes have reached stable storage when the flush request returns.

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Jamie Lokier
Marcelo Tosatti wrote: I don't think the first qemu_aio_flush() is necessary because the fsync request will be enqueued after pending ones: aio_fsync() function does a sync on all outstanding asynchronous I/O operations associated with aiocbp-aio_fildes. More

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Jamie Lokier
Marcelo Tosatti wrote: static void raw_flush(BlockDriverState *bs) { BDRVRawState *s = bs-opaque; -fsync(s-fd); +raw_aio_flush(bs); + +/* We rely on the fact that no other AIO will be submitted + * in parallel, but this should be fixed by per-device + * AIO

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Paul Brook
That'll depend on what kind of device is emulated. Does the SCSI emulation handle multiple in-flight commands with any guarantee on order? SCSI definitely allows (and we emulate) multiple in flight commands. I can't find any requirement that writes must complete before a subsequent

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Jamie Lokier
Paul Brook wrote: That'll depend on what kind of device is emulated. Does the SCSI emulation handle multiple in-flight commands with any guarantee on order? SCSI definitely allows (and we emulate) multiple in flight commands. I can't find any requirement that writes must complete before

Re: [kvm-devel] [Qemu-devel] [PATCH] QEMU: fsync AIO writes on flush request

2008-03-28 Thread Paul Brook
On Saturday 29 March 2008, Jamie Lokier wrote: Paul Brook wrote: That'll depend on what kind of device is emulated. Does the SCSI emulation handle multiple in-flight commands with any guarantee on order? SCSI definitely allows (and we emulate) multiple in flight commands. I can't