From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaIod-0004oK-Ty for qemu-devel@nongnu.org; Thu, 19 Feb 2009 19:00:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaIoZ-0004lg-7l for qemu-devel@nongnu.org; Thu, 19 Feb 2009 19:00:26 -0500 Received: from [199.232.76.173] (port=43732 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaIoZ-0004ld-2a for qemu-devel@nongnu.org; Thu, 19 Feb 2009 19:00:23 -0500 Received: from mail-qy0-f20.google.com ([209.85.221.20]:55930) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LaIoY-0006a3-Kd for qemu-devel@nongnu.org; Thu, 19 Feb 2009 19:00:22 -0500 Received: by qyk13 with SMTP id 13so1290983qyk.10 for ; Thu, 19 Feb 2009 16:00:22 -0800 (PST) Message-ID: <499DF276.4080305@codemonkey.ws> Date: Thu, 19 Feb 2009 17:59:50 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] migration: adding migration to/from a file (v2) References: <499DADBB.4080008@redhat.com> <499DBB8E.6030705@codemonkey.ws> <20090219202849.GE22319@shareable.org> <20090219.163601.29203982.imp@bsdimp.com> In-Reply-To: <20090219.163601.29203982.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: uril@redhat.com M. Warner Losh wrote: > In message: <20090219202849.GE22319@shareable.org> > Jamie Lokier writes: > : Anthony Liguori wrote: > : > >Sure looks like a bug. > : > I wish! It's Unix suckiness. > : > : Windows is the same. > : It's a more of a conceptual problem than it looks, not merely an API bug. > : > : It comes down to "what would 'readable' and 'writable' mean on a file?". > > "Would a read or write operation block?" is a better way to look at > the interface that select() or poll() provides. For a regular file, > the answer is "no" since the writes are so fast and often > asynchronous... > Except when they aren't.. The real issue is that read/write offers streaming semantics, not random access. You cannot guarantee that a read is going to complete unless you do read ahead. So the semantics would be something like pread(fd, buf, X) = EAGAIN (kernel starts the operation for X), later, pread(fd, buf, X) = OK. Sort of a weird interface. For write, it's even more bizarre because you can't "write-ahead". If you're dealing with O_SYNC or O_DIRECT, there's simply no semantic that makes sense. So fundamentally, read/write is a bad interface for random IO. Regards, Anthony Liguori > Warner > > >