qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: [PATCH] For AIO return -ENOSPC on short write


From: Avi Kivity
Subject: Re: [Qemu-devel] Re: [PATCH] For AIO return -ENOSPC on short write
Date: Tue, 22 Feb 2011 15:56:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7

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




reply via email to

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