qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	hch@infradead.org, qemu-devel@nongnu.org,
	stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] Re: [PATCH] For AIO return -ENOSPC on short write
Date: Tue, 22 Feb 2011 15:56:11 +0200	[thread overview]
Message-ID: <4D63C07B.1090806@redhat.com> (raw)
In-Reply-To: <4D63A1E8.4000101@redhat.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

  reply	other threads:[~2011-02-22 14:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 10:17 [Qemu-devel] [PATCH] For AIO return -ENOSPC on short write Jes.Sorensen
2011-02-22 10:18 ` Jes.Sorensen
2011-02-22 11:44   ` [Qemu-devel] " Kevin Wolf
2011-02-22 11:45     ` Jes Sorensen
2011-02-22 13:56       ` Avi Kivity [this message]
2011-02-22 15:02   ` [Qemu-devel] " Stefan Hajnoczi
2011-02-22 15:11     ` Kevin Wolf
2011-02-22 15:16       ` Stefan Hajnoczi
2011-02-22 16:59         ` [Qemu-devel] " Paolo Bonzini
2011-03-01 20:19           ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D63C07B.1090806@redhat.com \
    --to=avi@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=hch@infradead.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).