qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jes.Sorensen@redhat.com
To: qemu-devel@nongnu.org
Cc: hch@infradead.org, kwolf@redhat.com, stefanha@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH] For AIO return -ENOSPC on short write
Date: Tue, 22 Feb 2011 11:18:00 +0100	[thread overview]
Message-ID: <1298369880-23859-2-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1298369880-23859-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 linux-aio.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/linux-aio.c b/linux-aio.c
index 68f4b3d..d9c0225 100644
--- a/linux-aio.c
+++ b/linux-aio.c
@@ -32,6 +32,7 @@ struct qemu_laiocb {
     ssize_t ret;
     size_t nbytes;
     int async_context_id;
+    int type;
     QLIST_ENTRY(qemu_laiocb) node;
 };
 
@@ -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;
 
@@ -204,6 +208,7 @@ BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
     laiocb->nbytes = nb_sectors * 512;
     laiocb->ctx = s;
     laiocb->ret = -EINPROGRESS;
+    laiocb->type = type;
     laiocb->async_context_id = get_async_context_id();
 
     iocbs = &laiocb->iocb;
-- 
1.7.4

  reply	other threads:[~2011-02-22 10:18 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 [this message]
2011-02-22 11:44   ` [Qemu-devel] " Kevin Wolf
2011-02-22 11:45     ` Jes Sorensen
2011-02-22 13:56       ` Avi Kivity
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=1298369880-23859-2-git-send-email-Jes.Sorensen@redhat.com \
    --to=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).