qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT)


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] Align file accesses with cache=off (O_DIRECT)
Date: Tue, 29 Apr 2008 18:21:31 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20071114)

Laurent Vivier schrieb:
Disabling O_DIRECT for a single aio request is impossible (after all, aio is asynchronous), and disabling it for at least one aio request is

Perhaps I'm wrong, but I think it is possible: the only consequence is
the asynchronous I/O becomes synchronous...

Hm, yes. We could call raw_pread in raw_aio_read when O_DIRECT is used and the request is not properly aligned. Is this what you meant?

going to be ugly. So maybe we better turn O_DIRECT off for snapsnot saving/loading, even if it's not the generic fix I wanted to have when I started.

I don't think it is a good idea:

In linux world, there are three reasons to use O_DIRECT:

1- to use linux AIO (not POSIX AIO).

2- to avoid a buffer copy between user- and kernel- space
(performance ?)

3- to increase reliability: by using O_DIRECT you are sure your data are
on the disk when the write is over and your system can now crash (if it
wants).

And I think reliability is better when the snapshot is being saved...

I think we agree that it's mostly item 3 why one would use O_DIRECT with qemu. In terms of reliability, it is important that the data really is written to the disk when the guest OS thinks so. But when for example qemu crashes, I don't think it's too important if 40% or 50% of a snapshot have already been written - it's unusable anyway. A sync afterwards could be enough there.

I'm still undecided, though. What do you think?

Is it possible to align the last AIO ?

I have to admit that I neither know how to recognize the "last AIO" in the generic code nor do I understand what you want to achieve with it. The main problem are unaligned buffers and these occur on any request.

And see comments below

Good suggestion, will change the patch accordingly.

Kevin




reply via email to

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