qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/14] Block patches
@ 2010-05-28 16:45 Kevin Wolf
  0 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2010-05-28 16:45 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

Hi Anthony,

this includes again some patches that should be applied to stable-0.12, too:

    86fa8da qcow2: Fix corruption after error in update_refcount
    25408c0 qcow2: Fix corruption after refblock allocation
    cbf1dff block: Fix multiwrite with overlapping requests
    175e115 qcow2: Fix error handling in l2_allocate
    1b7c801 qcow2: Clear L2 table cache after write error

Kevin


The following changes since commit 29f91781bd300b228d9c38b9f6c1e0b6a38f25fb:
  Jes Sorensen (1):
        vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2

are available in the git repository at:

  git://repo.or.cz/qemu/kevin.git for-anthony

Gerd Hoffmann (1):
      drive: allow rerror, werror and readonly for if=none

Jes Sorensen (1):
      block.h: Make BDRV_SECTOR_SIZE 64 bit safe

Kevin Wolf (9):
      qcow2: Clear L2 table cache after write error
      qcow2: Fix error handling in l2_allocate
      block: Fix multiwrite with overlapping requests
      qemu-io: Add multiwrite command
      qcow2: Allow qcow2_get_cluster_offset to return errors
      qcow2: Change l2_load to return 0/-errno
      qcow2: Return right error code in write_refcount_block_entries
      qcow2: Fix corruption after refblock allocation
      qcow2: Fix corruption after error in update_refcount

MORITA Kazutaka (1):
      add support for protocol driver create_options

Nicholas A. Bellinger (1):
      block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format()

Stefan Hajnoczi (1):
      posix-aio-compat: Expand tabs that have crept in

 block.c                |   13 ++--
 block.h                |    3 +-
 block/qcow2-cluster.c  |   94 ++++++++++++++----------
 block/qcow2-refcount.c |   42 +++++++----
 block/qcow2.c          |   16 +++-
 block/qcow2.h          |    4 +-
 posix-aio-compat.c     |   58 +++++++-------
 qemu-img.c             |   49 +++++++++----
 qemu-io.c              |  192 ++++++++++++++++++++++++++++++++++++++++++++++++
 qemu-option.c          |   53 ++++++++++++--
 qemu-option.h          |    2 +
 vl.c                   |    6 +-
 12 files changed, 414 insertions(+), 118 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2010-06-22 14:09 Kevin Wolf
  0 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2010-06-22 14:09 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit cada87c432e3b9cd55869a24055baf2b7bc0b70c:
  Blue Swirl (1):
        Update OpenBIOS images

are available in the git repository at:

  git://repo.or.cz/qemu/kevin.git for-anthony

Christoph Hellwig (1):
      block: fix physical_block_size calculation

Eduardo Habkost (1):
      monitor: allow device to be ejected if no disk is inserted

Kevin Wolf (8):
      block: Add bdrv_(p)write_sync
      cow: Use bdrv_(p)write_sync for metadata writes
      qcow: Use bdrv_(p)write_sync for metadata writes
      qcow2: Use bdrv_(p)write_sync for metadata writes
      vmdk: Use bdrv_(p)write_sync for metadata writes
      vpc: Use bdrv_(p)write_sync for metadata writes
      qcow2: Fix qemu-img check segfault on corrupted images
      qcow2: Don't try to check tables that couldn't be loaded

MORITA Kazutaka (1):
      qemu-io: check registered fds in command_loop()

Nicholas Bellinger (2):
      scsi-bus: Add PERSISTENT_RESERVE_OUT SCSIRequest->cmd.mode setup
      scsi-bus: Add MAINTENANCE_IN and MAINTENANCE_OUT SCSIRequest xfer and mode assignments

Yoshiaki Tamura (1):
      virtio-blk: fix the list operation in virtio_blk_load().

 block.c                |   37 +++++++++++++++++++++++++++++++++++++
 block.h                |    4 ++++
 block/cow.c            |   20 +++++++++++---------
 block/qcow.c           |   18 ++++++++++--------
 block/qcow2-cluster.c  |   24 ++++++++++++------------
 block/qcow2-refcount.c |   39 ++++++++++++++++++++++++---------------
 block/qcow2-snapshot.c |   23 +++++++++++------------
 block/qcow2.c          |   10 +++++-----
 block/vmdk.c           |   10 +++++-----
 block/vpc.c            |    9 +++++----
 block_int.h            |    4 +++-
 blockdev.c             |   22 ++++++++++------------
 cmd.c                  |   33 ++++++++++++++++++++++++++++++---
 hw/scsi-bus.c          |   11 +++++++++++
 hw/scsi-defs.h         |    2 ++
 hw/virtio-blk.c        |    2 +-
 16 files changed, 181 insertions(+), 87 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2010-12-09 11:09 Kevin Wolf
  2010-12-17 14:48 ` Anthony Liguori
  0 siblings, 1 reply; 27+ messages in thread
From: Kevin Wolf @ 2010-12-09 11:09 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit 138b38b61bf92d4e9588acf934e532499c94e185:

  ppc: kvm: fix signedness warning (2010-12-08 21:30:19 +0100)

are available in the git repository at:
  git://repo.or.cz/qemu/kevin.git for-anthony

Christian Brunner (1):
      ceph/rbd block driver for qemu-kvm

Jes Sorensen (8):
      Add missing tracing to qemu_mallocz()
      Use qemu_mallocz() instead of calloc() in img_convert()
      img_convert(): Only try to free bs[] entries if bs is valid.
      Consolidate printing of block driver options
      Fix formatting and missing braces in qemu-img.c
      Fail if detecting an unknown option
      Make error handling more consistent in img_create() and img_resize()
      qemu-img: Deprecate obsolete -6 and -e options

Stefan Hajnoczi (5):
      block: Make bdrv_create_file() ':' handling consistent
      qemu-option: Don't reinvent append_option_parameters()
      qemu-option: Fix parse_option_parameters() documentation typo
      qemu-img: Free option parameter lists in img_create()
      qemu-img: Fail creation if backing format is invalid

 Makefile.objs     |    1 +
 block.c           |    2 +-
 block/rbd.c       | 1059 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 block/rbd_types.h |   71 ++++
 block_int.h       |    1 -
 configure         |   52 +++
 qemu-img.c        |  247 ++++++++-----
 qemu-malloc.c     |    5 +-
 qemu-option.c     |   13 +-
 9 files changed, 1344 insertions(+), 107 deletions(-)
 create mode 100644 block/rbd.c
 create mode 100644 block/rbd_types.h

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PULL 00/14] Block patches
  2010-12-09 11:09 Kevin Wolf
@ 2010-12-17 14:48 ` Anthony Liguori
  0 siblings, 0 replies; 27+ messages in thread
From: Anthony Liguori @ 2010-12-17 14:48 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On 12/09/2010 05:09 AM, Kevin Wolf wrote:
> The following changes since commit 138b38b61bf92d4e9588acf934e532499c94e185:
>
>    ppc: kvm: fix signedness warning (2010-12-08 21:30:19 +0100)
>
> are available in the git repository at:
>    git://repo.or.cz/qemu/kevin.git for-anthony
>
> Christian Brunner (1):
>        ceph/rbd block driver for qemu-kvm
>    

Pulled.  Thanks.

Regards,

Anthony Liguori
> Jes Sorensen (8):
>        Add missing tracing to qemu_mallocz()
>        Use qemu_mallocz() instead of calloc() in img_convert()
>        img_convert(): Only try to free bs[] entries if bs is valid.
>        Consolidate printing of block driver options
>        Fix formatting and missing braces in qemu-img.c
>        Fail if detecting an unknown option
>        Make error handling more consistent in img_create() and img_resize()
>        qemu-img: Deprecate obsolete -6 and -e options
>
> Stefan Hajnoczi (5):
>        block: Make bdrv_create_file() ':' handling consistent
>        qemu-option: Don't reinvent append_option_parameters()
>        qemu-option: Fix parse_option_parameters() documentation typo
>        qemu-img: Free option parameter lists in img_create()
>        qemu-img: Fail creation if backing format is invalid
>
>   Makefile.objs     |    1 +
>   block.c           |    2 +-
>   block/rbd.c       | 1059 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>   block/rbd_types.h |   71 ++++
>   block_int.h       |    1 -
>   configure         |   52 +++
>   qemu-img.c        |  247 ++++++++-----
>   qemu-malloc.c     |    5 +-
>   qemu-option.c     |   13 +-
>   9 files changed, 1344 insertions(+), 107 deletions(-)
>   create mode 100644 block/rbd.c
>   create mode 100644 block/rbd_types.h
>
>
>    

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2011-06-15 14:02 Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable Kevin Wolf
                   ` (14 more replies)
  0 siblings, 15 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:02 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit 0b862cedf36d927818c50584ddd611b0370673df:

  configure: Detect and don't try to use older libcurl (2011-06-13 21:16:27 +0200)

are available in the git repository at:
  git://repo.or.cz/qemu/kevin.git for-anthony

Christoph Hellwig (3):
      make dma_bdrv_io available to drivers
      ide: allow other dma comands than read and write
      ide: add TRIM support

Devin Nakamura (1):
      Replaced tabs with spaces in block.h and block_int.h

Kevin Wolf (9):
      qcow2: Avoid direct AIO callback
      qcow: Avoid direct AIO callback
      vdi: Avoid direct AIO callback
      qcow2: Fix in-flight list after qcow2_cache_put failure
      ide: Split error status from status register
      ide: Fix ide_drive_pio_state_needed()
      ide: Add forgotten VMSTATE_END_OF_LIST in subsection
      ide: Clear error_status after restarting flush
      Allow nested qemu_bh_poll() after BH deletion

Stefan Weil (1):
      block/rbd: Remove unused local variable

 async.c               |    5 +-
 block.h               |    6 +-
 block/qcow.c          |   58 ++++++++++++++++++-
 block/qcow2-cluster.c |   12 +++-
 block/qcow2.c         |   39 ++++++++++---
 block/rbd.c           |    4 -
 block/vdi.c           |   41 +++++++++++--
 block_int.h           |    4 +-
 dma-helpers.c         |   23 +++----
 dma.h                 |    8 +++
 hw/ide/core.c         |  154 ++++++++++++++++++++++++++++++++++++++++++++-----
 hw/ide/internal.h     |   32 ++++++++++-
 hw/ide/macio.c        |   13 ++++-
 hw/ide/pci.c          |   88 +++++++++++++++++++++++++---
 hw/ide/pci.h          |    4 +
 hw/ide/qdev.c         |    5 ++
 16 files changed, 423 insertions(+), 73 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 02/14] qcow2: Avoid direct AIO callback Kevin Wolf
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Weil <weil@mail.berlios.de>

Variable 'snap' is assigned a value that is never used.
Remove snap and the related code.

Cc: Christian Brunner <chb@muc.de>
Cc: Josh Durgin <josh.durgin@dreamhost.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Reviewed-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/rbd.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index bdc448a..d5659cd 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -227,7 +227,6 @@ static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options)
     char name[RBD_MAX_IMAGE_NAME_SIZE];
     char snap_buf[RBD_MAX_SNAP_NAME_SIZE];
     char conf[RBD_MAX_CONF_SIZE];
-    char *snap = NULL;
     rados_t cluster;
     rados_ioctx_t io_ctx;
     int ret;
@@ -238,9 +237,6 @@ static int qemu_rbd_create(const char *filename, QEMUOptionParameter *options)
                            conf, sizeof(conf)) < 0) {
         return -EINVAL;
     }
-    if (snap_buf[0] != '\0') {
-        snap = snap_buf;
-    }
 
     /* Read out options */
     while (options && options->name) {
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 02/14] qcow2: Avoid direct AIO callback
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 03/14] qcow: " Kevin Wolf
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

bdrv_aio_* must not call the callback before returning to its caller. In qcow2,
this could happen in some error cases. This starts the real requests processing
in a BH to avoid this situation.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2.c |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 8451ded..2c51e7c 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -378,6 +378,7 @@ typedef struct QCowAIOCB {
     uint64_t bytes_done;
     uint64_t cluster_offset;
     uint8_t *cluster_data;
+    bool is_write;
     BlockDriverAIOCB *hd_aiocb;
     QEMUIOVector hd_qiov;
     QEMUBH *bh;
@@ -399,12 +400,19 @@ static AIOPool qcow2_aio_pool = {
 };
 
 static void qcow2_aio_read_cb(void *opaque, int ret);
-static void qcow2_aio_read_bh(void *opaque)
+static void qcow2_aio_write_cb(void *opaque, int ret);
+
+static void qcow2_aio_rw_bh(void *opaque)
 {
     QCowAIOCB *acb = opaque;
     qemu_bh_delete(acb->bh);
     acb->bh = NULL;
-    qcow2_aio_read_cb(opaque, 0);
+
+    if (acb->is_write) {
+        qcow2_aio_write_cb(opaque, 0);
+    } else {
+        qcow2_aio_read_cb(opaque, 0);
+    }
 }
 
 static int qcow2_schedule_bh(QEMUBHFunc *cb, QCowAIOCB *acb)
@@ -493,14 +501,14 @@ static void qcow2_aio_read_cb(void *opaque, int ret)
                     goto done;
                 }
             } else {
-                ret = qcow2_schedule_bh(qcow2_aio_read_bh, acb);
+                ret = qcow2_schedule_bh(qcow2_aio_rw_bh, acb);
                 if (ret < 0)
                     goto done;
             }
         } else {
             /* Note: in this case, no need to wait */
             qemu_iovec_memset(&acb->hd_qiov, 0, 512 * acb->cur_nr_sectors);
-            ret = qcow2_schedule_bh(qcow2_aio_read_bh, acb);
+            ret = qcow2_schedule_bh(qcow2_aio_rw_bh, acb);
             if (ret < 0)
                 goto done;
         }
@@ -515,7 +523,7 @@ static void qcow2_aio_read_cb(void *opaque, int ret)
             s->cluster_cache + index_in_cluster * 512,
             512 * acb->cur_nr_sectors);
 
-        ret = qcow2_schedule_bh(qcow2_aio_read_bh, acb);
+        ret = qcow2_schedule_bh(qcow2_aio_rw_bh, acb);
         if (ret < 0)
             goto done;
     } else {
@@ -572,6 +580,7 @@ static QCowAIOCB *qcow2_aio_setup(BlockDriverState *bs, int64_t sector_num,
     acb->hd_aiocb = NULL;
     acb->sector_num = sector_num;
     acb->qiov = qiov;
+    acb->is_write = is_write;
 
     qemu_iovec_init(&acb->hd_qiov, qiov->niov);
 
@@ -591,17 +600,22 @@ static BlockDriverAIOCB *qcow2_aio_readv(BlockDriverState *bs,
                                          void *opaque)
 {
     QCowAIOCB *acb;
+    int ret;
 
     acb = qcow2_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
     if (!acb)
         return NULL;
 
-    qcow2_aio_read_cb(acb, 0);
+    ret = qcow2_schedule_bh(qcow2_aio_rw_bh, acb);
+    if (ret < 0) {
+        qemu_iovec_destroy(&acb->hd_qiov);
+        qemu_aio_release(acb);
+        return NULL;
+    }
+
     return &acb->common;
 }
 
-static void qcow2_aio_write_cb(void *opaque, int ret);
-
 static void run_dependent_requests(QCowL2Meta *m)
 {
     QCowAIOCB *req;
@@ -724,6 +738,7 @@ static BlockDriverAIOCB *qcow2_aio_writev(BlockDriverState *bs,
 {
     BDRVQcowState *s = bs->opaque;
     QCowAIOCB *acb;
+    int ret;
 
     s->cluster_cache_offset = -1; /* disable compressed cache */
 
@@ -731,7 +746,13 @@ static BlockDriverAIOCB *qcow2_aio_writev(BlockDriverState *bs,
     if (!acb)
         return NULL;
 
-    qcow2_aio_write_cb(acb, 0);
+    ret = qcow2_schedule_bh(qcow2_aio_rw_bh, acb);
+    if (ret < 0) {
+        qemu_iovec_destroy(&acb->hd_qiov);
+        qemu_aio_release(acb);
+        return NULL;
+    }
+
     return &acb->common;
 }
 
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 03/14] qcow: Avoid direct AIO callback
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 02/14] qcow2: Avoid direct AIO callback Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 04/14] vdi: " Kevin Wolf
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

bdrv_aio_* must not call the callback before returning to its caller. In qcow,
this could happen in some error cases. This starts the real requests processing
in a BH to avoid this situation.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/block/qcow.c b/block/qcow.c
index a26c886..227b104 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -496,6 +496,8 @@ typedef struct QCowAIOCB {
     uint64_t cluster_offset;
     uint8_t *cluster_data;
     struct iovec hd_iov;
+    bool is_write;
+    QEMUBH *bh;
     QEMUIOVector hd_qiov;
     BlockDriverAIOCB *hd_aiocb;
 } QCowAIOCB;
@@ -525,6 +527,8 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs,
     acb->hd_aiocb = NULL;
     acb->sector_num = sector_num;
     acb->qiov = qiov;
+    acb->is_write = is_write;
+
     if (qiov->niov > 1) {
         acb->buf = acb->orig_buf = qemu_blockalign(bs, qiov->size);
         if (is_write)
@@ -538,6 +542,38 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs,
     return acb;
 }
 
+static void qcow_aio_read_cb(void *opaque, int ret);
+static void qcow_aio_write_cb(void *opaque, int ret);
+
+static void qcow_aio_rw_bh(void *opaque)
+{
+    QCowAIOCB *acb = opaque;
+    qemu_bh_delete(acb->bh);
+    acb->bh = NULL;
+
+    if (acb->is_write) {
+        qcow_aio_write_cb(opaque, 0);
+    } else {
+        qcow_aio_read_cb(opaque, 0);
+    }
+}
+
+static int qcow_schedule_bh(QEMUBHFunc *cb, QCowAIOCB *acb)
+{
+    if (acb->bh) {
+        return -EIO;
+    }
+
+    acb->bh = qemu_bh_new(cb, acb);
+    if (!acb->bh) {
+        return -EIO;
+    }
+
+    qemu_bh_schedule(acb->bh);
+
+    return 0;
+}
+
 static void qcow_aio_read_cb(void *opaque, int ret)
 {
     QCowAIOCB *acb = opaque;
@@ -640,12 +676,21 @@ static BlockDriverAIOCB *qcow_aio_readv(BlockDriverState *bs,
         BlockDriverCompletionFunc *cb, void *opaque)
 {
     QCowAIOCB *acb;
+    int ret;
 
     acb = qcow_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
     if (!acb)
         return NULL;
 
-    qcow_aio_read_cb(acb, 0);
+    ret = qcow_schedule_bh(qcow_aio_rw_bh, acb);
+    if (ret < 0) {
+        if (acb->qiov->niov > 1) {
+            qemu_vfree(acb->orig_buf);
+        }
+        qemu_aio_release(acb);
+        return NULL;
+    }
+
     return &acb->common;
 }
 
@@ -725,6 +770,7 @@ static BlockDriverAIOCB *qcow_aio_writev(BlockDriverState *bs,
 {
     BDRVQcowState *s = bs->opaque;
     QCowAIOCB *acb;
+    int ret;
 
     s->cluster_cache_offset = -1; /* disable compressed cache */
 
@@ -733,7 +779,15 @@ static BlockDriverAIOCB *qcow_aio_writev(BlockDriverState *bs,
         return NULL;
 
 
-    qcow_aio_write_cb(acb, 0);
+    ret = qcow_schedule_bh(qcow_aio_rw_bh, acb);
+    if (ret < 0) {
+        if (acb->qiov->niov > 1) {
+            qemu_vfree(acb->orig_buf);
+        }
+        qemu_aio_release(acb);
+        return NULL;
+    }
+
     return &acb->common;
 }
 
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 04/14] vdi: Avoid direct AIO callback
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 03/14] qcow: " Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 05/14] Replaced tabs with spaces in block.h and block_int.h Kevin Wolf
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

bdrv_aio_* must not call the callback before returning to its caller. In vdi,
this could happen in some error cases. This starts the real requests processing
in a BH to avoid this situation.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vdi.c |   41 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/block/vdi.c b/block/vdi.c
index 4c9e201..261cf9b 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -152,6 +152,7 @@ typedef struct {
     /* Buffer for new allocated block. */
     void *block_buffer;
     void *orig_buf;
+    bool is_write;
     int header_modified;
     BlockDriverAIOCB *hd_aiocb;
     struct iovec hd_iov;
@@ -504,6 +505,8 @@ static VdiAIOCB *vdi_aio_setup(BlockDriverState *bs, int64_t sector_num,
         acb->hd_aiocb = NULL;
         acb->sector_num = sector_num;
         acb->qiov = qiov;
+        acb->is_write = is_write;
+
         if (qiov->niov > 1) {
             acb->buf = qemu_blockalign(bs, qiov->size);
             acb->orig_buf = acb->buf;
@@ -542,14 +545,20 @@ static int vdi_schedule_bh(QEMUBHFunc *cb, VdiAIOCB *acb)
 }
 
 static void vdi_aio_read_cb(void *opaque, int ret);
+static void vdi_aio_write_cb(void *opaque, int ret);
 
-static void vdi_aio_read_bh(void *opaque)
+static void vdi_aio_rw_bh(void *opaque)
 {
     VdiAIOCB *acb = opaque;
     logout("\n");
     qemu_bh_delete(acb->bh);
     acb->bh = NULL;
-    vdi_aio_read_cb(opaque, 0);
+
+    if (acb->is_write) {
+        vdi_aio_write_cb(opaque, 0);
+    } else {
+        vdi_aio_read_cb(opaque, 0);
+    }
 }
 
 static void vdi_aio_read_cb(void *opaque, int ret)
@@ -597,7 +606,7 @@ static void vdi_aio_read_cb(void *opaque, int ret)
     if (bmap_entry == VDI_UNALLOCATED) {
         /* Block not allocated, return zeros, no need to wait. */
         memset(acb->buf, 0, n_sectors * SECTOR_SIZE);
-        ret = vdi_schedule_bh(vdi_aio_read_bh, acb);
+        ret = vdi_schedule_bh(vdi_aio_rw_bh, acb);
         if (ret < 0) {
             goto done;
         }
@@ -630,12 +639,23 @@ static BlockDriverAIOCB *vdi_aio_readv(BlockDriverState *bs,
         BlockDriverCompletionFunc *cb, void *opaque)
 {
     VdiAIOCB *acb;
+    int ret;
+
     logout("\n");
     acb = vdi_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
     if (!acb) {
         return NULL;
     }
-    vdi_aio_read_cb(acb, 0);
+
+    ret = vdi_schedule_bh(vdi_aio_rw_bh, acb);
+    if (ret < 0) {
+        if (acb->qiov->niov > 1) {
+            qemu_vfree(acb->orig_buf);
+        }
+        qemu_aio_release(acb);
+        return NULL;
+    }
+
     return &acb->common;
 }
 
@@ -789,12 +809,23 @@ static BlockDriverAIOCB *vdi_aio_writev(BlockDriverState *bs,
         BlockDriverCompletionFunc *cb, void *opaque)
 {
     VdiAIOCB *acb;
+    int ret;
+
     logout("\n");
     acb = vdi_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque, 1);
     if (!acb) {
         return NULL;
     }
-    vdi_aio_write_cb(acb, 0);
+
+    ret = vdi_schedule_bh(vdi_aio_rw_bh, acb);
+    if (ret < 0) {
+        if (acb->qiov->niov > 1) {
+            qemu_vfree(acb->orig_buf);
+        }
+        qemu_aio_release(acb);
+        return NULL;
+    }
+
     return &acb->common;
 }
 
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 05/14] Replaced tabs with spaces in block.h and block_int.h
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 04/14] vdi: " Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 06/14] qcow2: Fix in-flight list after qcow2_cache_put failure Kevin Wolf
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Devin Nakamura <devin122@gmail.com>

Signed-off-by: Devin Nakamura <devin122@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.h     |    6 +++---
 block_int.h |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block.h b/block.h
index da7d39c..859d1d9 100644
--- a/block.h
+++ b/block.h
@@ -110,7 +110,7 @@ int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res);
 typedef struct BlockDriverAIOCB BlockDriverAIOCB;
 typedef void BlockDriverCompletionFunc(void *opaque, int ret);
 typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector,
-				     int sector_num);
+                                     int sector_num);
 BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
                                  QEMUIOVector *iov, int nb_sectors,
                                  BlockDriverCompletionFunc *cb, void *opaque);
@@ -118,7 +118,7 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
                                   QEMUIOVector *iov, int nb_sectors,
                                   BlockDriverCompletionFunc *cb, void *opaque);
 BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs,
-				 BlockDriverCompletionFunc *cb, void *opaque);
+                                 BlockDriverCompletionFunc *cb, void *opaque);
 void bdrv_aio_cancel(BlockDriverAIOCB *acb);
 
 typedef struct BlockRequest {
@@ -150,7 +150,7 @@ void bdrv_close_all(void);
 int bdrv_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors);
 int bdrv_has_zero_init(BlockDriverState *bs);
 int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
-	int *pnum);
+                      int *pnum);
 
 #define BIOS_ATA_TRANSLATION_AUTO   0
 #define BIOS_ATA_TRANSLATION_NONE   1
diff --git a/block_int.h b/block_int.h
index fa91337..1e265d2 100644
--- a/block_int.h
+++ b/block_int.h
@@ -203,8 +203,8 @@ struct BlockDriverState {
     void *private;
 };
 
-#define CHANGE_MEDIA	0x01
-#define CHANGE_SIZE	0x02
+#define CHANGE_MEDIA    0x01
+#define CHANGE_SIZE     0x02
 
 struct BlockDriverAIOCB {
     AIOPool *pool;
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 06/14] qcow2: Fix in-flight list after qcow2_cache_put failure
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 05/14] Replaced tabs with spaces in block.h and block_int.h Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 07/14] ide: Split error status from status register Kevin Wolf
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

If qcow2_cache_put returns an error during cluster allocation and the
allocation fails, it must be removed from the list of in-flight allocations.
Otherwise we'd get a loop in the list when the ACB is used for the next
allocation.

Luckily, this qcow2_cache_put shouldn't fail anyway because the L2 table is
only read, so that qcow2_cache_put doesn't even involve I/O.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 block/qcow2-cluster.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index c9e7bbd..882f50a 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -796,8 +796,8 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,
                 m->depends_on = old_alloc;
                 m->nb_clusters = 0;
                 *num = 0;
-                ret = 0;
-                goto fail;
+
+                goto out_wait_dependency;
             }
         }
     }
@@ -812,7 +812,6 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,
 
     cluster_offset = qcow2_alloc_clusters(bs, nb_clusters * s->cluster_size);
     if (cluster_offset < 0) {
-        QLIST_REMOVE(m, next_in_flight);
         ret = cluster_offset;
         goto fail;
     }
@@ -825,7 +824,7 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,
 out:
     ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
     if (ret < 0) {
-        return ret;
+        goto fail_put;
     }
 
     m->nb_available = MIN(nb_clusters << (s->cluster_bits - 9), n_end);
@@ -835,8 +834,13 @@ out:
 
     return 0;
 
+out_wait_dependency:
+    return qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
+
 fail:
     qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
+fail_put:
+    QLIST_REMOVE(m, next_in_flight);
     return ret;
 }
 
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 07/14] ide: Split error status from status register
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (5 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 06/14] qcow2: Fix in-flight list after qcow2_cache_put failure Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 08/14] ide: Fix ide_drive_pio_state_needed() Kevin Wolf
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

When adding the werror=stop mode, some flags were added to s->status
which are used to determine what kind of operation should be restarted
when the VM is continued.

Unfortunately, it turns out that s->status is in fact a device register
and as such is visible to the guest (some of the abused bits are even
writable for the guest).

For migration we keep on using the old VMState field (renamed to
migration_compat_status) if the status register doesn't use any of the
previously abused bits. If it does, we use a subsection with a clean copy of
the status register.

The error status is always sent in a subsection if there is any error. It can't
use the old field because errors happen even without PCI.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/core.c     |   28 +++++++++++++++++++-
 hw/ide/internal.h |    8 ++++++
 hw/ide/pci.c      |   73 +++++++++++++++++++++++++++++++++++++++++++++++-----
 hw/ide/pci.h      |    4 +++
 4 files changed, 105 insertions(+), 8 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 95beb17..da250ac 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -446,7 +446,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
     if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)
             || action == BLOCK_ERR_STOP_ANY) {
         s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
-        s->bus->dma->ops->add_status(s->bus->dma, op);
+        s->bus->error_status = op;
         bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
         vm_stop(VMSTOP_DISKFULL);
     } else {
@@ -1847,6 +1847,13 @@ static bool ide_atapi_gesn_needed(void *opaque)
     return s->events.new_media || s->events.eject_request;
 }
 
+static bool ide_error_needed(void *opaque)
+{
+    IDEBus *bus = opaque;
+
+    return (bus->error_status != 0);
+}
+
 /* Fields for GET_EVENT_STATUS_NOTIFICATION ATAPI command */
 const VMStateDescription vmstate_ide_atapi_gesn_state = {
     .name ="ide_drive/atapi/gesn_state",
@@ -1921,6 +1928,17 @@ const VMStateDescription vmstate_ide_drive = {
     }
 };
 
+const VMStateDescription vmstate_ide_error_status = {
+    .name ="ide_bus/error",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields = (VMStateField []) {
+        VMSTATE_INT32(error_status, IDEBus),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 const VMStateDescription vmstate_ide_bus = {
     .name = "ide_bus",
     .version_id = 1,
@@ -1930,6 +1948,14 @@ const VMStateDescription vmstate_ide_bus = {
         VMSTATE_UINT8(cmd, IDEBus),
         VMSTATE_UINT8(unit, IDEBus),
         VMSTATE_END_OF_LIST()
+    },
+    .subsections = (VMStateSubsection []) {
+        {
+            .vmsd = &vmstate_ide_error_status,
+            .needed = ide_error_needed,
+        }, {
+            /* empty */
+        }
     }
 };
 
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index c2b35ec..8d18cc3 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -486,6 +486,8 @@ struct IDEBus {
     uint8_t unit;
     uint8_t cmd;
     qemu_irq irq;
+
+    int error_status;
 };
 
 struct IDEDevice {
@@ -505,11 +507,17 @@ struct IDEDeviceInfo {
 #define BM_STATUS_DMAING 0x01
 #define BM_STATUS_ERROR  0x02
 #define BM_STATUS_INT    0x04
+
+/* FIXME These are not status register bits */
 #define BM_STATUS_DMA_RETRY  0x08
 #define BM_STATUS_PIO_RETRY  0x10
 #define BM_STATUS_RETRY_READ  0x20
 #define BM_STATUS_RETRY_FLUSH 0x40
 
+#define BM_MIGRATION_COMPAT_STATUS_BITS \
+        (BM_STATUS_DMA_RETRY | BM_STATUS_PIO_RETRY | \
+        BM_STATUS_RETRY_READ | BM_STATUS_RETRY_FLUSH)
+
 #define BM_CMD_START     0x01
 #define BM_CMD_READ      0x08
 
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index a4726ad..7fa32bd 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -183,27 +183,33 @@ static void bmdma_restart_dma(BMDMAState *bm, int is_read)
     bmdma_start_dma(&bm->dma, s, bm->dma_cb);
 }
 
+/* TODO This should be common IDE code */
 static void bmdma_restart_bh(void *opaque)
 {
     BMDMAState *bm = opaque;
+    IDEBus *bus = bm->bus;
     int is_read;
 
     qemu_bh_delete(bm->bh);
     bm->bh = NULL;
 
-    is_read = !!(bm->status & BM_STATUS_RETRY_READ);
+    if (bm->unit == (uint8_t) -1) {
+        return;
+    }
 
-    if (bm->status & BM_STATUS_DMA_RETRY) {
-        bm->status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
+    is_read = !!(bus->error_status & BM_STATUS_RETRY_READ);
+
+    if (bus->error_status & BM_STATUS_DMA_RETRY) {
+        bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
         bmdma_restart_dma(bm, is_read);
-    } else if (bm->status & BM_STATUS_PIO_RETRY) {
-        bm->status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ);
+    } else if (bus->error_status & BM_STATUS_PIO_RETRY) {
+        bus->error_status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ);
         if (is_read) {
             ide_sector_read(bmdma_active_if(bm));
         } else {
             ide_sector_write(bmdma_active_if(bm));
         }
-    } else if (bm->status & BM_STATUS_RETRY_FLUSH) {
+    } else if (bus->error_status & BM_STATUS_RETRY_FLUSH) {
         ide_flush_cache(bmdma_active_if(bm));
     }
 }
@@ -351,6 +357,43 @@ static bool ide_bmdma_current_needed(void *opaque)
     return (bm->cur_prd_len != 0);
 }
 
+static bool ide_bmdma_status_needed(void *opaque)
+{
+    BMDMAState *bm = opaque;
+
+    /* Older versions abused some bits in the status register for internal
+     * error state. If any of these bits are set, we must add a subsection to
+     * transfer the real status register */
+    uint8_t abused_bits = BM_MIGRATION_COMPAT_STATUS_BITS;
+
+    return ((bm->status & abused_bits) != 0);
+}
+
+static void ide_bmdma_pre_save(void *opaque)
+{
+    BMDMAState *bm = opaque;
+    uint8_t abused_bits = BM_MIGRATION_COMPAT_STATUS_BITS;
+
+    bm->migration_compat_status =
+        (bm->status & ~abused_bits) | (bm->bus->error_status & abused_bits);
+}
+
+/* This function accesses bm->bus->error_status which is loaded only after
+ * BMDMA itself. This is why the function is called from ide_pci_post_load
+ * instead of being registered with VMState where it would run too early. */
+static int ide_bmdma_post_load(void *opaque, int version_id)
+{
+    BMDMAState *bm = opaque;
+    uint8_t abused_bits = BM_MIGRATION_COMPAT_STATUS_BITS;
+
+    if (bm->status == 0) {
+        bm->status = bm->migration_compat_status & ~abused_bits;
+        bm->bus->error_status |= bm->migration_compat_status & abused_bits;
+    }
+
+    return 0;
+}
+
 static const VMStateDescription vmstate_bmdma_current = {
     .name = "ide bmdma_current",
     .version_id = 1,
@@ -365,15 +408,26 @@ static const VMStateDescription vmstate_bmdma_current = {
     }
 };
 
+const VMStateDescription vmstate_bmdma_status = {
+    .name ="ide bmdma/status",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields = (VMStateField []) {
+        VMSTATE_UINT8(status, BMDMAState),
+        VMSTATE_END_OF_LIST()
+    }
+};
 
 static const VMStateDescription vmstate_bmdma = {
     .name = "ide bmdma",
     .version_id = 3,
     .minimum_version_id = 0,
     .minimum_version_id_old = 0,
+    .pre_save  = ide_bmdma_pre_save,
     .fields      = (VMStateField []) {
         VMSTATE_UINT8(cmd, BMDMAState),
-        VMSTATE_UINT8(status, BMDMAState),
+        VMSTATE_UINT8(migration_compat_status, BMDMAState),
         VMSTATE_UINT32(addr, BMDMAState),
         VMSTATE_INT64(sector_num, BMDMAState),
         VMSTATE_UINT32(nsector, BMDMAState),
@@ -385,6 +439,9 @@ static const VMStateDescription vmstate_bmdma = {
             .vmsd = &vmstate_bmdma_current,
             .needed = ide_bmdma_current_needed,
         }, {
+            .vmsd = &vmstate_bmdma_status,
+            .needed = ide_bmdma_status_needed,
+        }, {
             /* empty */
         }
     }
@@ -399,7 +456,9 @@ static int ide_pci_post_load(void *opaque, int version_id)
         /* current versions always store 0/1, but older version
            stored bigger values. We only need last bit */
         d->bmdma[i].unit &= 1;
+        ide_bmdma_post_load(&d->bmdma[i], -1);
     }
+
     return 0;
 }
 
diff --git a/hw/ide/pci.h b/hw/ide/pci.h
index cd72cba..b4f3691 100644
--- a/hw/ide/pci.h
+++ b/hw/ide/pci.h
@@ -22,6 +22,10 @@ typedef struct BMDMAState {
     IORange addr_ioport;
     QEMUBH *bh;
     qemu_irq irq;
+
+    /* Bit 0-2 and 7:   BM status register
+     * Bit 3-6:         bus->error_status */
+    uint8_t migration_compat_status;
 } BMDMAState;
 
 typedef struct PCIIDEState {
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 08/14] ide: Fix ide_drive_pio_state_needed()
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (6 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 07/14] ide: Split error status from status register Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 09/14] ide: Add forgotten VMSTATE_END_OF_LIST in subsection Kevin Wolf
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

When a failed PIO request caused the VM to stop, we still need to transfer the
PIO state even though DRQ=0 at this point.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index da250ac..e5def8b 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1837,7 +1837,8 @@ static bool ide_drive_pio_state_needed(void *opaque)
 {
     IDEState *s = opaque;
 
-    return (s->status & DRQ_STAT) != 0;
+    return ((s->status & DRQ_STAT) != 0)
+        || (s->bus->error_status & BM_STATUS_PIO_RETRY);
 }
 
 static bool ide_atapi_gesn_needed(void *opaque)
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 09/14] ide: Add forgotten VMSTATE_END_OF_LIST in subsection
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (7 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 08/14] ide: Fix ide_drive_pio_state_needed() Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 10/14] make dma_bdrv_io available to drivers Kevin Wolf
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index e5def8b..399b74c 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1864,6 +1864,7 @@ const VMStateDescription vmstate_ide_atapi_gesn_state = {
     .fields = (VMStateField []) {
         VMSTATE_BOOL(events.new_media, IDEState),
         VMSTATE_BOOL(events.eject_request, IDEState),
+        VMSTATE_END_OF_LIST()
     }
 };
 
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 10/14] make dma_bdrv_io available to drivers
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (8 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 09/14] ide: Add forgotten VMSTATE_END_OF_LIST in subsection Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 11/14] ide: allow other dma comands than read and write Kevin Wolf
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Christoph Hellwig <hch@lst.de>

Make dma_bdrv_io available for drivers, and pass an explicit I/O function
instead of hardcoding bdrv_aio_readv/bdrv_aio_writev.  This is required
to implement non-READ/WRITE dma commands in the ide driver, e.g. the
upcoming TRIM support.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 dma-helpers.c |   23 ++++++++++-------------
 dma.h         |    8 ++++++++
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/dma-helpers.c b/dma-helpers.c
index 712ed89..ba7f897 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -47,6 +47,7 @@ typedef struct {
     target_phys_addr_t sg_cur_byte;
     QEMUIOVector iov;
     QEMUBH *bh;
+    DMAIOFunc *io_func;
 } DMAAIOCB;
 
 static void dma_bdrv_cb(void *opaque, int ret);
@@ -116,13 +117,8 @@ static void dma_bdrv_cb(void *opaque, int ret)
         return;
     }
 
-    if (dbs->is_write) {
-        dbs->acb = bdrv_aio_writev(dbs->bs, dbs->sector_num, &dbs->iov,
-                                   dbs->iov.size / 512, dma_bdrv_cb, dbs);
-    } else {
-        dbs->acb = bdrv_aio_readv(dbs->bs, dbs->sector_num, &dbs->iov,
-                                  dbs->iov.size / 512, dma_bdrv_cb, dbs);
-    }
+    dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov,
+                            dbs->iov.size / 512, dma_bdrv_cb, dbs);
     if (!dbs->acb) {
         dma_bdrv_unmap(dbs);
         qemu_iovec_destroy(&dbs->iov);
@@ -144,12 +140,12 @@ static AIOPool dma_aio_pool = {
     .cancel             = dma_aio_cancel,
 };
 
-static BlockDriverAIOCB *dma_bdrv_io(
+BlockDriverAIOCB *dma_bdrv_io(
     BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,
-    BlockDriverCompletionFunc *cb, void *opaque,
-    int is_write)
+    DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
+    void *opaque, int is_write)
 {
-    DMAAIOCB *dbs =  qemu_aio_get(&dma_aio_pool, bs, cb, opaque);
+    DMAAIOCB *dbs = qemu_aio_get(&dma_aio_pool, bs, cb, opaque);
 
     dbs->acb = NULL;
     dbs->bs = bs;
@@ -158,6 +154,7 @@ static BlockDriverAIOCB *dma_bdrv_io(
     dbs->sg_cur_index = 0;
     dbs->sg_cur_byte = 0;
     dbs->is_write = is_write;
+    dbs->io_func = io_func;
     dbs->bh = NULL;
     qemu_iovec_init(&dbs->iov, sg->nsg);
     dma_bdrv_cb(dbs, 0);
@@ -173,12 +170,12 @@ BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
                                 QEMUSGList *sg, uint64_t sector,
                                 void (*cb)(void *opaque, int ret), void *opaque)
 {
-    return dma_bdrv_io(bs, sg, sector, cb, opaque, 0);
+    return dma_bdrv_io(bs, sg, sector, bdrv_aio_readv, cb, opaque, 0);
 }
 
 BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
                                  QEMUSGList *sg, uint64_t sector,
                                  void (*cb)(void *opaque, int ret), void *opaque)
 {
-    return dma_bdrv_io(bs, sg, sector, cb, opaque, 1);
+    return dma_bdrv_io(bs, sg, sector, bdrv_aio_writev, cb, opaque, 1);
 }
diff --git a/dma.h b/dma.h
index f3bb275..3d8324b 100644
--- a/dma.h
+++ b/dma.h
@@ -32,6 +32,14 @@ void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
                      target_phys_addr_t len);
 void qemu_sglist_destroy(QEMUSGList *qsg);
 
+typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num,
+                                 QEMUIOVector *iov, int nb_sectors,
+                                 BlockDriverCompletionFunc *cb, void *opaque);
+
+BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs,
+                              QEMUSGList *sg, uint64_t sector_num,
+                              DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
+                              void *opaque, int is_write);
 BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
                                 QEMUSGList *sg, uint64_t sector,
                                 BlockDriverCompletionFunc *cb, void *opaque);
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 11/14] ide: allow other dma comands than read and write
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (9 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 10/14] make dma_bdrv_io available to drivers Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 12/14] ide: add TRIM support Kevin Wolf
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Christoph Hellwig <hch@lst.de>

Replace the is_read flag with a dma_cmd flag to allow the dma and
restart logic to handler other commands like TRIM.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/core.c     |   25 ++++++++++++++-----------
 hw/ide/internal.h |   10 +++++++++-
 hw/ide/macio.c    |    9 +++++++--
 hw/ide/pci.c      |    6 +++---
 4 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 399b74c..14bda82 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -472,7 +472,7 @@ handle_rw_error:
     if (ret < 0) {
         int op = BM_STATUS_DMA_RETRY;
 
-        if (s->is_read)
+        if (s->dma_cmd == IDE_DMA_READ)
             op |= BM_STATUS_RETRY_READ;
         if (ide_handle_rw_error(s, -ret, op)) {
             return;
@@ -482,7 +482,7 @@ handle_rw_error:
     n = s->io_buffer_size >> 9;
     sector_num = ide_get_sector(s);
     if (n > 0) {
-        dma_buf_commit(s, s->is_read);
+        dma_buf_commit(s, ide_cmd_is_read(s));
         sector_num += n;
         ide_set_sector(s, sector_num);
         s->nsector -= n;
@@ -499,23 +499,26 @@ handle_rw_error:
     n = s->nsector;
     s->io_buffer_index = 0;
     s->io_buffer_size = n * 512;
-    if (s->bus->dma->ops->prepare_buf(s->bus->dma, s->is_read) == 0) {
+    if (s->bus->dma->ops->prepare_buf(s->bus->dma, ide_cmd_is_read(s)) == 0) {
         /* The PRDs were too short. Reset the Active bit, but don't raise an
          * interrupt. */
         goto eot;
     }
 
 #ifdef DEBUG_AIO
-    printf("ide_dma_cb: sector_num=%" PRId64 " n=%d, is_read=%d\n",
-           sector_num, n, s->is_read);
+    printf("ide_dma_cb: sector_num=%" PRId64 " n=%d, cmd_cmd=%d\n",
+           sector_num, n, s->dma_cmd);
 #endif
 
-    if (s->is_read) {
+    switch (s->dma_cmd) {
+    case IDE_DMA_READ:
         s->bus->dma->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num,
                                            ide_dma_cb, s);
-    } else {
+        break;
+    case IDE_DMA_WRITE:
         s->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num,
                                             ide_dma_cb, s);
+        break;
     }
 
     if (!s->bus->dma->aiocb) {
@@ -528,12 +531,12 @@ eot:
    ide_set_inactive(s);
 }
 
-static void ide_sector_start_dma(IDEState *s, int is_read)
+static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
 {
     s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
     s->io_buffer_index = 0;
     s->io_buffer_size = 0;
-    s->is_read = is_read;
+    s->dma_cmd = dma_cmd;
     s->bus->dma->ops->start_dma(s->bus->dma, s, ide_dma_cb);
 }
 
@@ -916,7 +919,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         if (!s->bs)
             goto abort_cmd;
 	ide_cmd_lba48_transform(s, lba48);
-        ide_sector_start_dma(s, 1);
+        ide_sector_start_dma(s, IDE_DMA_READ);
         break;
 	case WIN_WRITEDMA_EXT:
 	lba48 = 1;
@@ -925,7 +928,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         if (!s->bs)
             goto abort_cmd;
 	ide_cmd_lba48_transform(s, lba48);
-        ide_sector_start_dma(s, 0);
+        ide_sector_start_dma(s, IDE_DMA_WRITE);
         s->media_changed = 1;
         break;
     case WIN_READ_NATIVE_MAX_EXT:
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 8d18cc3..ea3edf5 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -379,6 +379,14 @@ struct unreported_events {
     bool new_media;
 };
 
+enum ide_dma_cmd {
+    IDE_DMA_READ,
+    IDE_DMA_WRITE,
+};
+
+#define ide_cmd_is_read(s) \
+	((s)->dma_cmd == IDE_DMA_READ)
+
 /* NOTE: IDEState represents in fact one drive */
 struct IDEState {
     IDEBus *bus;
@@ -446,7 +454,7 @@ struct IDEState {
     uint32_t mdata_size;
     uint8_t *mdata_storage;
     int media_changed;
-    int is_read;
+    enum ide_dma_cmd dma_cmd;
     /* SMART */
     uint8_t smart_enabled;
     uint8_t smart_autosave;
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 7107f6b..099b8cb 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -145,12 +145,17 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
     io->addr += io->len;
     io->len = 0;
 
-    if (s->is_read)
+    switch (s->dma_cmd) {
+    case IDE_DMA_READ:
         m->aiocb = dma_bdrv_read(s->bs, &s->sg, sector_num,
 		                 pmac_ide_transfer_cb, io);
-    else
+        break;
+    case IDE_DMA_WRITE:
         m->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num,
 		                  pmac_ide_transfer_cb, io);
+        break;
+    }
+
     if (!m->aiocb)
         pmac_ide_transfer_cb(io, -1);
 }
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 7fa32bd..80c5794 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -169,7 +169,7 @@ static int bmdma_set_inactive(IDEDMA *dma)
     return 0;
 }
 
-static void bmdma_restart_dma(BMDMAState *bm, int is_read)
+static void bmdma_restart_dma(BMDMAState *bm, enum ide_dma_cmd dma_cmd)
 {
     IDEState *s = bmdma_active_if(bm);
 
@@ -177,7 +177,7 @@ static void bmdma_restart_dma(BMDMAState *bm, int is_read)
     s->io_buffer_index = 0;
     s->io_buffer_size = 0;
     s->nsector = bm->nsector;
-    s->is_read = is_read;
+    s->dma_cmd = dma_cmd;
     bm->cur_addr = bm->addr;
     bm->dma_cb = ide_dma_cb;
     bmdma_start_dma(&bm->dma, s, bm->dma_cb);
@@ -201,7 +201,7 @@ static void bmdma_restart_bh(void *opaque)
 
     if (bus->error_status & BM_STATUS_DMA_RETRY) {
         bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
-        bmdma_restart_dma(bm, is_read);
+        bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
     } else if (bus->error_status & BM_STATUS_PIO_RETRY) {
         bus->error_status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ);
         if (is_read) {
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 12/14] ide: add TRIM support
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (10 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 11/14] ide: allow other dma comands than read and write Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flush Kevin Wolf
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Christoph Hellwig <hch@lst.de>

Add support for TRIM sub function of the data set management command,
and wire it up to the qemu discard infrastructure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/core.c     |   97 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 hw/ide/internal.h |   14 +++++++-
 hw/ide/macio.c    |    4 ++
 hw/ide/pci.c      |    9 ++++-
 hw/ide/qdev.c     |    5 +++
 5 files changed, 124 insertions(+), 5 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 14bda82..ca17a43 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -78,7 +78,7 @@ static void ide_identify(IDEState *s)
 {
     uint16_t *p;
     unsigned int oldsize;
-    IDEDevice *dev;
+    IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master;
 
     if (s->identify_set) {
 	memcpy(s->io_buffer, s->identify_data, sizeof(s->identify_data));
@@ -124,6 +124,9 @@ static void ide_identify(IDEState *s)
     put_le16(p + 66, 120);
     put_le16(p + 67, 120);
     put_le16(p + 68, 120);
+    if (dev && dev->conf.discard_granularity) {
+        put_le16(p + 69, (1 << 14)); /* determinate TRIM behavior */
+    }
 
     if (s->ncq_queues) {
         put_le16(p + 75, s->ncq_queues - 1);
@@ -154,9 +157,12 @@ static void ide_identify(IDEState *s)
     put_le16(p + 101, s->nb_sectors >> 16);
     put_le16(p + 102, s->nb_sectors >> 32);
     put_le16(p + 103, s->nb_sectors >> 48);
-    dev = s->unit ? s->bus->slave : s->bus->master;
+
     if (dev && dev->conf.physical_block_size)
         put_le16(p + 106, 0x6000 | get_physical_block_exp(&dev->conf));
+    if (dev && dev->conf.discard_granularity) {
+        put_le16(p + 169, 1); /* TRIM support */
+    }
 
     memcpy(s->identify_data, p, sizeof(s->identify_data));
     s->identify_set = 1;
@@ -299,6 +305,74 @@ static void ide_set_signature(IDEState *s)
     }
 }
 
+typedef struct TrimAIOCB {
+    BlockDriverAIOCB common;
+    QEMUBH *bh;
+    int ret;
+} TrimAIOCB;
+
+static void trim_aio_cancel(BlockDriverAIOCB *acb)
+{
+    TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common);
+
+    qemu_bh_delete(iocb->bh);
+    iocb->bh = NULL;
+    qemu_aio_release(iocb);
+}
+
+static AIOPool trim_aio_pool = {
+    .aiocb_size         = sizeof(TrimAIOCB),
+    .cancel             = trim_aio_cancel,
+};
+
+static void ide_trim_bh_cb(void *opaque)
+{
+    TrimAIOCB *iocb = opaque;
+
+    iocb->common.cb(iocb->common.opaque, iocb->ret);
+
+    qemu_bh_delete(iocb->bh);
+    iocb->bh = NULL;
+
+    qemu_aio_release(iocb);
+}
+
+BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
+        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
+        BlockDriverCompletionFunc *cb, void *opaque)
+{
+    TrimAIOCB *iocb;
+    int i, j, ret;
+
+    iocb = qemu_aio_get(&trim_aio_pool, bs, cb, opaque);
+    iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
+    iocb->ret = 0;
+
+    for (j = 0; j < qiov->niov; j++) {
+        uint64_t *buffer = qiov->iov[j].iov_base;
+
+        for (i = 0; i < qiov->iov[j].iov_len / 8; i++) {
+            /* 6-byte LBA + 2-byte range per entry */
+            uint64_t entry = le64_to_cpu(buffer[i]);
+            uint64_t sector = entry & 0x0000ffffffffffffULL;
+            uint16_t count = entry >> 48;
+
+            if (count == 0) {
+                break;
+            }
+
+            ret = bdrv_discard(bs, sector, count);
+            if (!iocb->ret) {
+                iocb->ret = ret;
+            }
+        }
+    }
+
+    qemu_bh_schedule(iocb->bh);
+
+    return &iocb->common;
+}
+
 static inline void ide_abort_command(IDEState *s)
 {
     s->status = READY_STAT | ERR_STAT;
@@ -474,6 +548,9 @@ handle_rw_error:
 
         if (s->dma_cmd == IDE_DMA_READ)
             op |= BM_STATUS_RETRY_READ;
+        else if (s->dma_cmd == IDE_DMA_TRIM)
+            op |= BM_STATUS_RETRY_TRIM;
+
         if (ide_handle_rw_error(s, -ret, op)) {
             return;
         }
@@ -519,6 +596,10 @@ handle_rw_error:
         s->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num,
                                             ide_dma_cb, s);
         break;
+    case IDE_DMA_TRIM:
+        s->bus->dma->aiocb = dma_bdrv_io(s->bs, &s->sg, sector_num,
+                                         ide_issue_trim, ide_dma_cb, s, 1);
+        break;
     }
 
     if (!s->bus->dma->aiocb) {
@@ -818,6 +899,18 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         return;
 
     switch(val) {
+    case WIN_DSM:
+        switch (s->feature) {
+        case DSM_TRIM:
+            if (!s->bs) {
+                goto abort_cmd;
+            }
+            ide_sector_start_dma(s, IDE_DMA_TRIM);
+            break;
+        default:
+            goto abort_cmd;
+        }
+        break;
     case WIN_IDENTIFY:
         if (s->bs && s->drive_kind != IDE_CD) {
             if (s->drive_kind != IDE_CFATA)
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index ea3edf5..02e805f 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -62,7 +62,11 @@ typedef struct IDEDMAOps IDEDMAOps;
  */
 #define CFA_REQ_EXT_ERROR_CODE		0x03 /* CFA Request Extended Error Code */
 /*
- *	0x04->0x07 Reserved
+ *      0x04->0x05 Reserved
+ */
+#define WIN_DSM                         0x06
+/*
+ *      0x07 Reserved
  */
 #define WIN_SRST			0x08 /* ATAPI soft reset command */
 #define WIN_DEVICE_RESET		0x08
@@ -190,6 +194,9 @@ typedef struct IDEDMAOps IDEDMAOps;
 
 #define IDE_DMA_BUF_SECTORS 256
 
+/* feature values for Data Set Management */
+#define DSM_TRIM                        0x01
+
 #if (IDE_DMA_BUF_SECTORS < MAX_MULT_SECTORS)
 #error "IDE_DMA_BUF_SECTORS must be bigger or equal to MAX_MULT_SECTORS"
 #endif
@@ -382,6 +389,7 @@ struct unreported_events {
 enum ide_dma_cmd {
     IDE_DMA_READ,
     IDE_DMA_WRITE,
+    IDE_DMA_TRIM,
 };
 
 #define ide_cmd_is_read(s) \
@@ -521,6 +529,7 @@ struct IDEDeviceInfo {
 #define BM_STATUS_PIO_RETRY  0x10
 #define BM_STATUS_RETRY_READ  0x20
 #define BM_STATUS_RETRY_FLUSH 0x40
+#define BM_STATUS_RETRY_TRIM 0x80
 
 #define BM_MIGRATION_COMPAT_STATUS_BITS \
         (BM_STATUS_DMA_RETRY | BM_STATUS_PIO_RETRY | \
@@ -591,6 +600,9 @@ void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
                         EndTransferFunc *end_transfer_func);
 void ide_transfer_stop(IDEState *s);
 void ide_set_inactive(IDEState *s);
+BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
+        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
+        BlockDriverCompletionFunc *cb, void *opaque);
 
 /* hw/ide/atapi.c */
 void ide_atapi_cmd(IDEState *s);
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 099b8cb..7daeb31 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -154,6 +154,10 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
         m->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num,
 		                  pmac_ide_transfer_cb, io);
         break;
+    case IDE_DMA_TRIM:
+        m->aiocb = dma_bdrv_io(s->bs, &s->sg, sector_num,
+                               ide_issue_trim, pmac_ide_transfer_cb, s, 1);
+        break;
     }
 
     if (!m->aiocb)
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 80c5794..c940375 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -200,8 +200,13 @@ static void bmdma_restart_bh(void *opaque)
     is_read = !!(bus->error_status & BM_STATUS_RETRY_READ);
 
     if (bus->error_status & BM_STATUS_DMA_RETRY) {
-        bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
-        bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
+        if (bus->error_status & BM_STATUS_RETRY_TRIM) {
+            bus->error_status &= ~BM_STATUS_RETRY_TRIM;
+            bmdma_restart_dma(bm, IDE_DMA_TRIM);
+        } else {
+            bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
+            bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
+        }
     } else if (bus->error_status & BM_STATUS_PIO_RETRY) {
         bus->error_status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ);
         if (is_read) {
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 3f9dc89..d9b8f24 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -125,6 +125,11 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
     const char *serial;
     DriveInfo *dinfo;
 
+    if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) {
+        error_report("discard_granularity must be 512 for ide");
+        return -1;
+    }
+
     serial = dev->serial;
     if (!serial) {
         /* try to fall back to value set with legacy -drive serial=... */
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flush
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (11 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 12/14] ide: add TRIM support Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 14/14] Allow nested qemu_bh_poll() after BH deletion Kevin Wolf
  2011-06-15 14:18 ` [Qemu-devel] [PULL 00/14] Block patches Anthony Liguori
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

Clearing the error status flag was missing for restarting flushes. Now that the
error status is separate from the BM status register, we can simply set it to 0
after restarting the request. This ensures that we never forget to clear a bit.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/pci.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index c940375..9f3050a 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -189,6 +189,7 @@ static void bmdma_restart_bh(void *opaque)
     BMDMAState *bm = opaque;
     IDEBus *bus = bm->bus;
     int is_read;
+    int error_status;
 
     qemu_bh_delete(bm->bh);
     bm->bh = NULL;
@@ -199,22 +200,25 @@ static void bmdma_restart_bh(void *opaque)
 
     is_read = !!(bus->error_status & BM_STATUS_RETRY_READ);
 
-    if (bus->error_status & BM_STATUS_DMA_RETRY) {
-        if (bus->error_status & BM_STATUS_RETRY_TRIM) {
-            bus->error_status &= ~BM_STATUS_RETRY_TRIM;
+    /* The error status must be cleared before resubmitting the request: The
+     * request may fail again, and this case can only be distinguished if the
+     * called function can set a new error status. */
+    error_status = bus->error_status;
+    bus->error_status = 0;
+
+    if (error_status & BM_STATUS_DMA_RETRY) {
+        if (error_status & BM_STATUS_RETRY_TRIM) {
             bmdma_restart_dma(bm, IDE_DMA_TRIM);
         } else {
-            bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
             bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
         }
-    } else if (bus->error_status & BM_STATUS_PIO_RETRY) {
-        bus->error_status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ);
+    } else if (error_status & BM_STATUS_PIO_RETRY) {
         if (is_read) {
             ide_sector_read(bmdma_active_if(bm));
         } else {
             ide_sector_write(bmdma_active_if(bm));
         }
-    } else if (bus->error_status & BM_STATUS_RETRY_FLUSH) {
+    } else if (error_status & BM_STATUS_RETRY_FLUSH) {
         ide_flush_cache(bmdma_active_if(bm));
     }
 }
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH 14/14] Allow nested qemu_bh_poll() after BH deletion
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (12 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flush Kevin Wolf
@ 2011-06-15 14:03 ` Kevin Wolf
  2011-06-15 14:18 ` [Qemu-devel] [PULL 00/14] Block patches Anthony Liguori
  14 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2011-06-15 14:03 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

Without this, qemu segfaults when a BH handler first deletes its BH and
then calls another function which involves a nested qemu_bh_poll() call.

This can be reproduced by generating an I/O error (e.g. with blkdebug) on
an IDE device and using rerror/werror=stop to stop the VM. When continuing
the VM, qemu segfaults.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 async.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/async.c b/async.c
index 57ac3a8..fd313df 100644
--- a/async.c
+++ b/async.c
@@ -137,11 +137,12 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
 
 int qemu_bh_poll(void)
 {
-    QEMUBH *bh, **bhp;
+    QEMUBH *bh, **bhp, *next;
     int ret;
 
     ret = 0;
-    for (bh = async_context->first_bh; bh; bh = bh->next) {
+    for (bh = async_context->first_bh; bh; bh = next) {
+        next = bh->next;
         if (!bh->deleted && bh->scheduled) {
             bh->scheduled = 0;
             if (!bh->idle)
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PULL 00/14] Block patches
  2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
                   ` (13 preceding siblings ...)
  2011-06-15 14:03 ` [Qemu-devel] [PATCH 14/14] Allow nested qemu_bh_poll() after BH deletion Kevin Wolf
@ 2011-06-15 14:18 ` Anthony Liguori
  14 siblings, 0 replies; 27+ messages in thread
From: Anthony Liguori @ 2011-06-15 14:18 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On 06/15/2011 09:02 AM, Kevin Wolf wrote:
> The following changes since commit 0b862cedf36d927818c50584ddd611b0370673df:
>
>    configure: Detect and don't try to use older libcurl (2011-06-13 21:16:27 +0200)
>
> are available in the git repository at:
>    git://repo.or.cz/qemu/kevin.git for-anthony

Pulled.  Thanks.

Regards,

Anthony Liguori

> Christoph Hellwig (3):
>        make dma_bdrv_io available to drivers
>        ide: allow other dma comands than read and write
>        ide: add TRIM support
>
> Devin Nakamura (1):
>        Replaced tabs with spaces in block.h and block_int.h
>
> Kevin Wolf (9):
>        qcow2: Avoid direct AIO callback
>        qcow: Avoid direct AIO callback
>        vdi: Avoid direct AIO callback
>        qcow2: Fix in-flight list after qcow2_cache_put failure
>        ide: Split error status from status register
>        ide: Fix ide_drive_pio_state_needed()
>        ide: Add forgotten VMSTATE_END_OF_LIST in subsection
>        ide: Clear error_status after restarting flush
>        Allow nested qemu_bh_poll() after BH deletion
>
> Stefan Weil (1):
>        block/rbd: Remove unused local variable
>
>   async.c               |    5 +-
>   block.h               |    6 +-
>   block/qcow.c          |   58 ++++++++++++++++++-
>   block/qcow2-cluster.c |   12 +++-
>   block/qcow2.c         |   39 ++++++++++---
>   block/rbd.c           |    4 -
>   block/vdi.c           |   41 +++++++++++--
>   block_int.h           |    4 +-
>   dma-helpers.c         |   23 +++----
>   dma.h                 |    8 +++
>   hw/ide/core.c         |  154 ++++++++++++++++++++++++++++++++++++++++++++-----
>   hw/ide/internal.h     |   32 ++++++++++-
>   hw/ide/macio.c        |   13 ++++-
>   hw/ide/pci.c          |   88 +++++++++++++++++++++++++---
>   hw/ide/pci.h          |    4 +
>   hw/ide/qdev.c         |    5 ++
>   16 files changed, 423 insertions(+), 73 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2011-12-15 14:09 Kevin Wolf
  2011-12-19 15:44 ` Anthony Liguori
  0 siblings, 1 reply; 27+ messages in thread
From: Kevin Wolf @ 2011-12-15 14:09 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit 222f23f508a8d778f56eddef14752dfd26d225b4:

  tcg/arm: remove fixed map code buffer restriction (2011-12-14 21:58:18 +0100)

are available in the git repository at:
  git://repo.or.cz/qemu/kevin.git for-anthony

Avi Kivity (1):
      coroutine: switch per-thread free pool to a global pool

Josh Durgin (1):
      rbd: always set out parameter in qemu_rbd_snap_list

Kevin Wolf (3):
      qemu-img rebase: Fix for undersized backing files
      Documentation: Add qemu-img -t parameter in man page
      qcow2: Allow >4 GB VM state

Li Zhi Hui (2):
      block/qcow2.c: call qcow2_free_snapshots in the function of qcow2_close
      block/cow: Return real error code

Paolo Bonzini (7):
      block: bdrv_aio_* do not return NULL
      block: simplify failure handling for bdrv_aio_multiwrite
      block: qemu_aio_get does not return NULL
      dma: the passed io_func does not return NULL
      block: dma_bdrv_* does not return NULL
      block: avoid useless checks on acb->bh
      qiov: prevent double free or use-after-free

 block-migration.c      |   13 ---------
 block.c                |   56 +++-------------------------------------
 block.h                |    2 +-
 block/blkverify.c      |   24 ++++++-----------
 block/cow.c            |   44 +++++++++++++++++++++-----------
 block/curl.c           |    4 ---
 block/qcow2-snapshot.c |   34 +++++++++++++++++++++++-
 block/qcow2.c          |    1 +
 block/qcow2.h          |    2 +-
 block/qed-table.c      |   22 +++++-----------
 block/qed.c            |   60 +++++++++++--------------------------------
 block/rbd.c            |    6 +---
 block/vdi.c            |   66 +++++++++++++----------------------------------
 coroutine-ucontext.c   |   30 +++++++++++----------
 cutils.c               |    3 ++
 dma-helpers.c          |    4 +--
 docs/specs/qcow2.txt   |    8 +++++-
 hw/ide/atapi.c         |    8 +-----
 hw/ide/core.c          |   13 +--------
 hw/ide/macio.c         |   11 +-------
 hw/scsi-disk.c         |    9 ------
 hw/scsi-generic.c      |    4 ---
 hw/virtio-blk.c        |   19 +++-----------
 linux-aio.c            |    2 -
 posix-aio-compat.c     |    4 ---
 qemu-img-cmds.hx       |    6 ++--
 qemu-img.c             |   42 ++++++++++++++++++++++++------
 qemu-img.texi          |   10 +++++--
 qemu-io.c              |   39 ++++++----------------------
 savevm.c               |    2 +-
 trace-events           |    2 -
 31 files changed, 205 insertions(+), 345 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PULL 00/14] Block patches
  2011-12-15 14:09 Kevin Wolf
@ 2011-12-19 15:44 ` Anthony Liguori
  0 siblings, 0 replies; 27+ messages in thread
From: Anthony Liguori @ 2011-12-19 15:44 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On 12/15/2011 08:09 AM, Kevin Wolf wrote:
> The following changes since commit 222f23f508a8d778f56eddef14752dfd26d225b4:
>
>    tcg/arm: remove fixed map code buffer restriction (2011-12-14 21:58:18 +0100)
>
> are available in the git repository at:
>    git://repo.or.cz/qemu/kevin.git for-anthony

Pulled.  Thanks.

Regards,

Anthony Liguori

>
> Avi Kivity (1):
>        coroutine: switch per-thread free pool to a global pool
>
> Josh Durgin (1):
>        rbd: always set out parameter in qemu_rbd_snap_list
>
> Kevin Wolf (3):
>        qemu-img rebase: Fix for undersized backing files
>        Documentation: Add qemu-img -t parameter in man page
>        qcow2: Allow>4 GB VM state
>
> Li Zhi Hui (2):
>        block/qcow2.c: call qcow2_free_snapshots in the function of qcow2_close
>        block/cow: Return real error code
>
> Paolo Bonzini (7):
>        block: bdrv_aio_* do not return NULL
>        block: simplify failure handling for bdrv_aio_multiwrite
>        block: qemu_aio_get does not return NULL
>        dma: the passed io_func does not return NULL
>        block: dma_bdrv_* does not return NULL
>        block: avoid useless checks on acb->bh
>        qiov: prevent double free or use-after-free
>
>   block-migration.c      |   13 ---------
>   block.c                |   56 +++-------------------------------------
>   block.h                |    2 +-
>   block/blkverify.c      |   24 ++++++-----------
>   block/cow.c            |   44 +++++++++++++++++++++-----------
>   block/curl.c           |    4 ---
>   block/qcow2-snapshot.c |   34 +++++++++++++++++++++++-
>   block/qcow2.c          |    1 +
>   block/qcow2.h          |    2 +-
>   block/qed-table.c      |   22 +++++-----------
>   block/qed.c            |   60 +++++++++++--------------------------------
>   block/rbd.c            |    6 +---
>   block/vdi.c            |   66 +++++++++++++----------------------------------
>   coroutine-ucontext.c   |   30 +++++++++++----------
>   cutils.c               |    3 ++
>   dma-helpers.c          |    4 +--
>   docs/specs/qcow2.txt   |    8 +++++-
>   hw/ide/atapi.c         |    8 +-----
>   hw/ide/core.c          |   13 +--------
>   hw/ide/macio.c         |   11 +-------
>   hw/scsi-disk.c         |    9 ------
>   hw/scsi-generic.c      |    4 ---
>   hw/virtio-blk.c        |   19 +++-----------
>   linux-aio.c            |    2 -
>   posix-aio-compat.c     |    4 ---
>   qemu-img-cmds.hx       |    6 ++--
>   qemu-img.c             |   42 ++++++++++++++++++++++++------
>   qemu-img.texi          |   10 +++++--
>   qemu-io.c              |   39 ++++++----------------------
>   savevm.c               |    2 +-
>   trace-events           |    2 -
>   31 files changed, 205 insertions(+), 345 deletions(-)
>
>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2013-03-22 17:41 Kevin Wolf
  0 siblings, 0 replies; 27+ messages in thread
From: Kevin Wolf @ 2013-03-22 17:41 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit afed26082219b49443193b4ac32d113bbcf967fd:

  microblaze: Ignore non-cpu accesses to unmapped areas (2013-03-19 17:34:47 +0100)

are available in the git repository at:

  git://repo.or.cz/qemu/kevin.git for-anthony

for you to fetch changes up to 681e7ad024d80123a1ae8e35f86fb1a7f03b1bc9:

  nbd: Check against invalid option combinations (2013-03-22 17:51:32 +0100)

----------------------------------------------------------------
Kevin Wolf (12):
      block: Add options QDict to bdrv_file_open() prototypes
      block: Pass bdrv_file_open() options to block drivers
      qemu-socket: Make socket_optslist public
      nbd: Keep hostname and port separate
      nbd: Remove unused functions
      nbd: Accept -drive options for the network connection
      block: Introduce .bdrv_parse_filename callback
      block: Rename variable to avoid shadowing
      block: Make find_image_format safe with NULL filename
      block: Allow omitting the file name when using driver-specific options
      nbd: Use default port if only host is specified
      nbd: Check against invalid option combinations

Peter Lieven (2):
      Revert "block: complete all IOs before .bdrv_truncate"
      block: complete all IOs before resizing a device

 block.c                   | 143 +++++++++++++++++++++++++++++++++++++++-------
 block/blkdebug.c          |   5 +-
 block/blkverify.c         |   5 +-
 block/cow.c               |   2 +-
 block/curl.c              |   3 +-
 block/dmg.c               |  13 ++++-
 block/gluster.c           |   2 +-
 block/iscsi.c             |   5 +-
 block/nbd.c               | 135 ++++++++++++++++++++++++++++++++-----------
 block/qcow.c              |   2 +-
 block/qcow2.c             |   2 +-
 block/qed.c               |   2 +-
 block/raw-posix.c         |  15 +++--
 block/sheepdog.c          |   7 ++-
 block/vmdk.c              |   2 +-
 block/vvfat.c             |   3 +-
 blockdev.c                |  13 ++++-
 include/block/block.h     |   3 +-
 include/block/block_int.h |   7 ++-
 include/block/nbd.h       |   4 +-
 include/qemu/sockets.h    |   3 +
 nbd.c                     |  13 +----
 qemu-io.c                 |   2 +-
 util/qemu-sockets.c       |  30 +++++-----
 24 files changed, 308 insertions(+), 113 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2016-07-20  0:20 Jeff Cody
  2016-07-20 17:51 ` Peter Maydell
  0 siblings, 1 reply; 27+ messages in thread
From: Jeff Cody @ 2016-07-20  0:20 UTC (permalink / raw)
  To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel

The following changes since commit 5d3217340adcb6c4f0e4af5d2b865331eb2ff63d:

  disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers (2016-07-19 16:40:39 +0100)

are available in the git repository at:

  git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request

for you to fetch changes up to 6c7189bb29de9fa2202f613f3c6caf028f96f261:

  block/gluster: add support for multiple gluster servers (2016-07-19 17:38:50 -0400)

----------------------------------------------------------------
Block pull for 2.7
----------------------------------------------------------------

Denis V. Lunev (9):
  dirty-bitmap: operate with int64_t amount
  mirror: make sectors_in_flight int64_t
  mirror: create mirror_throttle helper
  mirror: create mirror_dirty_init helper for mirror_run
  block: remove extra condition in bdrv_can_write_zeroes_with_unmap
  mirror: optimize dirty bitmap filling in mirror_run a bit
  mirror: efficiently zero out target
  mirror: improve performance of mirroring of empty disk
  mirror: fix request throttling in drive-mirror

Prasanna Kumar Kalever (5):
  block/gluster: rename [server, volname, image] -> [host, volume, path]
  block/gluster: code cleanup
  block/gluster: deprecate rdma support
  block/gluster: using new qapi schema
  block/gluster: add support for multiple gluster servers

 block.c                      |   2 +-
 block/dirty-bitmap.c         |   6 +-
 block/gluster.c              | 631 +++++++++++++++++++++++++++++++++----------
 block/mirror.c               | 152 +++++++----
 include/block/block_int.h    |   2 +-
 include/block/dirty-bitmap.h |   4 +-
 qapi/block-core.json         |  68 ++++-
 7 files changed, 659 insertions(+), 206 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PULL 00/14] Block patches
  2016-07-20  0:20 Jeff Cody
@ 2016-07-20 17:51 ` Peter Maydell
  0 siblings, 0 replies; 27+ messages in thread
From: Peter Maydell @ 2016-07-20 17:51 UTC (permalink / raw)
  To: Jeff Cody; +Cc: Qemu-block, QEMU Developers

On 20 July 2016 at 01:20, Jeff Cody <jcody@redhat.com> wrote:
> The following changes since commit 5d3217340adcb6c4f0e4af5d2b865331eb2ff63d:
>
>   disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers (2016-07-19 16:40:39 +0100)
>
> are available in the git repository at:
>
>   git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request
>
> for you to fetch changes up to 6c7189bb29de9fa2202f613f3c6caf028f96f261:
>
>   block/gluster: add support for multiple gluster servers (2016-07-19 17:38:50 -0400)
>
> ----------------------------------------------------------------
> Block pull for 2.7
> ----------------------------------------------------------------


Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PULL 00/14] Block patches
@ 2017-01-04 13:34 Stefan Hajnoczi
  2017-01-05 13:57 ` Peter Maydell
  0 siblings, 1 reply; 27+ messages in thread
From: Stefan Hajnoczi @ 2017-01-04 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

The following changes since commit dbe2b65566e76d3c3a0c3358285c0336ac61e757:

  Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.9-pull-request' into staging (2016-12-28 17:11:11 +0000)

are available in the git repository at:

  git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 5e5db49953e31689c1c70060870f0a7a6de26fcb:

  iothread: add poll-grow and poll-shrink parameters (2017-01-03 16:38:50 +0000)

----------------------------------------------------------------

----------------------------------------------------------------

Stefan Hajnoczi (14):
  HACKING: document #include order
  aio: add flag to skip fds to aio_dispatch()
  aio: add AioPollFn and io_poll() interface
  aio: add polling mode to AioContext
  virtio: poll virtqueues for new buffers
  linux-aio: poll ring for completions
  iothread: add polling parameters
  virtio-blk: suppress virtqueue kick during processing
  virtio-scsi: suppress virtqueue kick during processing
  virtio: turn vq->notification into a nested counter
  aio: add .io_poll_begin/end() callbacks
  virtio: disable virtqueue notifications during polling
  aio: self-tune polling time
  iothread: add poll-grow and poll-shrink parameters

 include/block/aio.h         |  53 +++++++-
 include/sysemu/iothread.h   |   5 +
 aio-posix.c                 | 308 +++++++++++++++++++++++++++++++++++++++-----
 aio-win32.c                 |  32 ++++-
 async.c                     |  21 ++-
 block/curl.c                |   8 +-
 block/iscsi.c               |   3 +-
 block/linux-aio.c           |  19 ++-
 block/nbd-client.c          |   8 +-
 block/nfs.c                 |   7 +-
 block/sheepdog.c            |  26 ++--
 block/ssh.c                 |   4 +-
 block/win32-aio.c           |   4 +-
 hw/block/virtio-blk.c       |  18 ++-
 hw/scsi/virtio-scsi.c       |  36 +++---
 hw/virtio/virtio.c          |  54 ++++++--
 iohandler.c                 |   2 +-
 iothread.c                  |  84 ++++++++++++
 nbd/server.c                |   9 +-
 stubs/set-fd-handler.c      |   1 +
 tests/test-aio.c            |   4 +-
 util/event_notifier-posix.c |   2 +-
 HACKING                     |  18 +++
 trace-events                |   6 +
 24 files changed, 622 insertions(+), 110 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PULL 00/14] Block patches
  2017-01-04 13:34 Stefan Hajnoczi
@ 2017-01-05 13:57 ` Peter Maydell
  0 siblings, 0 replies; 27+ messages in thread
From: Peter Maydell @ 2017-01-05 13:57 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 4 January 2017 at 13:34, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit dbe2b65566e76d3c3a0c3358285c0336ac61e757:
>
>   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.9-pull-request' into staging (2016-12-28 17:11:11 +0000)
>
> are available in the git repository at:
>
>   git://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to 5e5db49953e31689c1c70060870f0a7a6de26fcb:
>
>   iothread: add poll-grow and poll-shrink parameters (2017-01-03 16:38:50 +0000)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-01-05 13:57 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 14:02 [Qemu-devel] [PULL 00/14] Block patches Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 02/14] qcow2: Avoid direct AIO callback Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 03/14] qcow: " Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 04/14] vdi: " Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 05/14] Replaced tabs with spaces in block.h and block_int.h Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 06/14] qcow2: Fix in-flight list after qcow2_cache_put failure Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 07/14] ide: Split error status from status register Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 08/14] ide: Fix ide_drive_pio_state_needed() Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 09/14] ide: Add forgotten VMSTATE_END_OF_LIST in subsection Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 10/14] make dma_bdrv_io available to drivers Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 11/14] ide: allow other dma comands than read and write Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 12/14] ide: add TRIM support Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flush Kevin Wolf
2011-06-15 14:03 ` [Qemu-devel] [PATCH 14/14] Allow nested qemu_bh_poll() after BH deletion Kevin Wolf
2011-06-15 14:18 ` [Qemu-devel] [PULL 00/14] Block patches Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2017-01-04 13:34 Stefan Hajnoczi
2017-01-05 13:57 ` Peter Maydell
2016-07-20  0:20 Jeff Cody
2016-07-20 17:51 ` Peter Maydell
2013-03-22 17:41 Kevin Wolf
2011-12-15 14:09 Kevin Wolf
2011-12-19 15:44 ` Anthony Liguori
2010-12-09 11:09 Kevin Wolf
2010-12-17 14:48 ` Anthony Liguori
2010-06-22 14:09 Kevin Wolf
2010-05-28 16:45 Kevin Wolf

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).