From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49506 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Prsmv-0004JI-89 for qemu-devel@nongnu.org; Tue, 22 Feb 2011 09:00:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrsjA-0005hv-MB for qemu-devel@nongnu.org; Tue, 22 Feb 2011 08:56:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrsjA-0005hc-DR for qemu-devel@nongnu.org; Tue, 22 Feb 2011 08:56:32 -0500 Message-ID: <4D63C07B.1090806@redhat.com> Date: Tue, 22 Feb 2011 15:56:11 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH] For AIO return -ENOSPC on short write References: <1298369880-23859-1-git-send-email-Jes.Sorensen@redhat.com> <1298369880-23859-2-git-send-email-Jes.Sorensen@redhat.com> <4D63A19E.8000806@redhat.com> <4D63A1E8.4000101@redhat.com> In-Reply-To: <4D63A1E8.4000101@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: Kevin Wolf , hch@infradead.org, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com On 02/22/2011 01:45 PM, Jes Sorensen wrote: > On 02/22/11 12:44, Kevin Wolf wrote: > >> @@ -62,6 +63,9 @@ static void qemu_laio_process_completion(struct qemu_laio_state *s, > >> if (ret != -ECANCELED) { > >> if (ret == laiocb->nbytes) > >> ret = 0; > >> + else if ((laiocb->type == QEMU_AIO_WRITE)&& (ret>= 0)&& > >> + (ret< laiocb->nbytes)) > >> + ret = -ENOSPC; > >> else if (ret>= 0) > >> ret = -EINVAL; > > > > Isn't there a way to get the real error code instead of just making it > > up more cleverly? Like retrying for the rest of the request? > > > > Kevin > > I guess we could retry the last part of the request, but if we already > have an error, it seems silly to try to rewrite the same stuff again > just to obtain the error code. Why? It's the standard Unix idiom. Keep writing until you either complete your request or get an error. We don't do this here, and instead invent an error. Admittedly it's harder to do. > I looked through the aio calls and I didn't find any obvious way to > retrieve the error code, but maybe I missed something? The existing code already has it: if ret is negative, that's what we return. What you have to do on a short read or write is to schedule a new request that starts from the point where this completion ends, and let the completion of the new request return the error (or perhaps succeed). -- error compiling committee.c: too many arguments to function