qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/73] Block patches
@ 2015-03-09 15:41 Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 22/73] qcow2: Helper function for refcount modification Kevin Wolf
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

Hi Peter,

I hope this fixes the build problems in Stefan's pull request. I'm only posting
those patches that are new compared to Stefan's version, or that have actual
differences (the fixed build errors; not reposting for my added Signed-off-by).

Kevin


The following changes since commit 6608c7e9eb65727524f6f590b1e716ec6e7877d4:

  Merge remote-tracking branch 'remotes/xtensa/tags/20150307-xtensa' into staging (2015-03-08 14:32:38 +0000)

are available in the git repository at:


  git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 305a8e96908c89a926438e1c4b738b296ee12061:

  MAINTAINERS: Add jcody as blockjobs, block devices maintainer (2015-03-09 16:33:44 +0100)

----------------------------------------------------------------
Block patches for 2.3

----------------------------------------------------------------
Christian Borntraeger (1):
      Add testcase for scsi-hd devices without drive property

Denis V. Lunev (1):
      block/raw-posix: fix compilation warning on OSX

Ekaterina Tumanova (6):
      block: add bdrv functions for geometry and blocksize
      raw-posix: Factor block size detection out of raw_probe_alignment()
      block: Add driver methods to probe blocksizes and geometry
      block-backend: Add wrappers for blocksizes and geometry probing
      BlockConf: Call backend functions to detect geometry and blocksizes
      scsi-hd: fix property unset case

Fam Zheng (2):
      virtio-blk: Check return value of blk_aio_ioctl
      virtio-blk: Remove the stale FIXME comment

Jeff Cody (1):
      MAINTAINERS: Add jcody as blockjobs, block devices maintainer

John Snow (11):
      blkdebug: fix "once" rule
      ahci: Migrate IDEStatus
      ahci: Recompute cur_cmd on migrate post load
      qtest/ide: Test flush / retry for ISA and PCI
      libqos/ahci: Zero-fill AHCI headers
      qtest/ahci: Add a macro bootup routine
      libqos/ahci: add ahci command helpers
      qtest/ahci: Add DMA test variants
      qtest/ahci: Add PIO and LBA48 tests
      qtest/ahci: add fragmented dma test
      MAINTAINERS: Add jsnow as IDE maintainer

Kevin Wolf (5):
      coroutine: Fix use after free with qemu_coroutine_yield()
      coroutine: Clean up qemu_coroutine_enter()
      vpc: Fix size in fixed image creation
      vpc: Implement bdrv_co_get_block_status()
      qcow2: Remove unused struct QCowCreateState

Liu Yuan (1):
      sheepdog: fix confused return values

Marc Marí (7):
      libqos: Change use of pointers to uint64_t in virtio
      tests: Prepare virtio-blk-test for multi-arch implementation
      libqos: Remove PCI assumptions in constants of virtio driver
      libqos: Add malloc generic
      libqos: Add virtio MMIO support
      libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c
      tests: Check QVIRTIO_F_ANY_LAYOUT flag in virtio-blk test

Markus Armbruster (1):
      sheepdog: Fix misleading error messages in sd_snapshot_create()

Max Reitz (19):
      qcow2: Add two new fields to BDRVQcowState
      qcow2: Add refcount_bits to format-specific info
      qcow2: Do not return new value after refcount update
      qcow2: Only return status from qcow2_get_refcount
      qcow2: Use unsigned addend for update_refcount()
      qcow2: Use 64 bits for refcount values
      qcow2: Helper for refcount array reallocation
      qcow2: Helper function for refcount modification
      qcow2: More helpers for refcount modification
      qcow2: Open images with refcount order != 4
      qcow2: refcount_order parameter for qcow2_create2
      qcow2: Use symbolic macros in qcow2_amend_options
      iotests: Prepare for refcount_bits option
      qcow2: Allow creation with refcount order != 4
      iotests: Add test for different refcount widths
      iotests: Fix 051's reference output
      iotests: Remove 006
      iotests: Drop vpc from 004's and 104's format list
      block/vdi: Add locking for parallel requests

Paolo Bonzini (14):
      ide: start extracting ide_restart_dma out of bmdma_restart_dma
      ide: prepare to move restart to common code
      ide: introduce ide_register_restart_cb
      ide: do not use BMDMA in restart callback
      ide: pass IDEBus to the restart_cb
      ide: move restart callback to common code
      ide: remove restart_cb callback
      ide: replace set_unit callback with more IDEBus state
      ide: place initial state of the current request to IDEBus
      ide: migrate initial request state via IDEBus
      ide: commonize io_buffer_index initialization
      ide: make more functions static
      ide: support PIO restart for the ISA controller
      ahci: add support for restarting non-queued commands

Stefan Hajnoczi (3):
      test-coroutine: Regression test for yield bug
      block/raw-posix: fix launching with failed disks
      iotests: add O_DIRECT alignment probing test

Teruaki Ishizaki (1):
      sheepdog: selectable object size support

 MAINTAINERS                      |  63 ++++-
 block.c                          |  34 +++
 block/blkdebug.c                 |   6 +-
 block/block-backend.c            |  10 +
 block/qcow2-cluster.c            |  11 +-
 block/qcow2-refcount.c           | 545 +++++++++++++++++++++++++++------------
 block/qcow2.c                    | 111 +++++---
 block/qcow2.h                    |  32 ++-
 block/raw-posix.c                | 185 +++++++++++--
 block/raw_bsd.c                  |  12 +
 block/sheepdog.c                 | 171 ++++++++++--
 block/vdi.c                      |  25 ++
 block/vpc.c                      |  60 ++++-
 hw/block/block.c                 |  24 ++
 hw/block/hd-geometry.c           |  10 +-
 hw/block/nvme.c                  |   1 +
 hw/block/virtio-blk.c            |  17 +-
 hw/core/qdev-properties.c        |   3 +-
 hw/ide/ahci.c                    |  43 +--
 hw/ide/atapi.c                   |   3 +-
 hw/ide/cmd646.c                  |   3 +-
 hw/ide/core.c                    | 116 ++++++++-
 hw/ide/internal.h                |  16 +-
 hw/ide/isa.c                     |   3 +-
 hw/ide/macio.c                   |   6 -
 hw/ide/pci.c                     | 109 ++------
 hw/ide/pci.h                     |  12 +-
 hw/ide/piix.c                    |   3 +-
 hw/ide/qdev.c                    |   1 +
 hw/ide/via.c                     |   3 +-
 hw/scsi/scsi-disk.c              |   7 +
 hw/usb/dev-storage.c             |   1 +
 include/block/block.h            |  13 +
 include/block/block_int.h        |  17 ++
 include/block/coroutine_int.h    |   1 +
 include/hw/block/block.h         |   5 +-
 include/hw/qdev-properties.h     |   4 +-
 include/sysemu/block-backend.h   |   2 +
 qapi/block-core.json             |   5 +-
 qemu-coroutine.c                 |  38 ++-
 tests/Makefile                   |   4 +-
 tests/ahci-test.c                | 234 +++++++++++++++--
 tests/ide-test.c                 |  20 +-
 tests/libqos/ahci.c              |  44 +++-
 tests/libqos/ahci.h              |   5 +
 tests/libqos/malloc-generic.c    |  39 +++
 tests/libqos/malloc-generic.h    |  21 ++
 tests/libqos/virtio-mmio.c       | 198 ++++++++++++++
 tests/libqos/virtio-mmio.h       |  46 ++++
 tests/libqos/virtio-pci.c        |  66 +++--
 tests/libqos/virtio-pci.h        |  24 +-
 tests/libqos/virtio.c            |   8 +-
 tests/libqos/virtio.h            |  16 +-
 tests/qemu-iotests/004           |   2 +-
 tests/qemu-iotests/006.out       |   6 -
 tests/qemu-iotests/007           |   3 +
 tests/qemu-iotests/015           |   2 +
 tests/qemu-iotests/026           |   7 +
 tests/qemu-iotests/026.out       |  24 +-
 tests/qemu-iotests/029           |   2 +
 tests/qemu-iotests/049.out       | 108 ++++----
 tests/qemu-iotests/051           |   9 +
 tests/qemu-iotests/051.out       |  17 +-
 tests/qemu-iotests/058           |   2 +
 tests/qemu-iotests/060.out       |   1 +
 tests/qemu-iotests/065           |  23 +-
 tests/qemu-iotests/067           |   2 +
 tests/qemu-iotests/067.out       |   5 +
 tests/qemu-iotests/079           |  10 +-
 tests/qemu-iotests/079.out       |  38 +--
 tests/qemu-iotests/080           |   2 +
 tests/qemu-iotests/082.out       |  48 +++-
 tests/qemu-iotests/085.out       |  38 +--
 tests/qemu-iotests/089           |   2 +
 tests/qemu-iotests/089.out       |   2 +
 tests/qemu-iotests/104           |   2 +-
 tests/qemu-iotests/108           |   2 +
 tests/qemu-iotests/112           | 187 ++++++++++++++
 tests/qemu-iotests/112.out       |  84 ++++++
 tests/qemu-iotests/{006 => 128}  |  46 +++-
 tests/qemu-iotests/128.out       |   5 +
 tests/qemu-iotests/common.filter |   3 +-
 tests/qemu-iotests/group         |   4 +-
 tests/test-coroutine.c           |  26 ++
 tests/virtio-blk-test.c          | 329 +++++++++++++++--------
 85 files changed, 2675 insertions(+), 822 deletions(-)
 create mode 100644 tests/libqos/malloc-generic.c
 create mode 100644 tests/libqos/malloc-generic.h
 create mode 100644 tests/libqos/virtio-mmio.c
 create mode 100644 tests/libqos/virtio-mmio.h
 delete mode 100644 tests/qemu-iotests/006.out
 create mode 100755 tests/qemu-iotests/112
 create mode 100644 tests/qemu-iotests/112.out
 rename tests/qemu-iotests/{006 => 128} (52%)
 create mode 100644 tests/qemu-iotests/128.out

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

* [Qemu-devel] [PULL 22/73] qcow2: Helper function for refcount modification
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 62/73] virtio-blk: Remove the stale FIXME comment Kevin Wolf
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Since refcounts do not always have to be a uint16_t, all refcount blocks
and arrays in memory should not have a specific type (thus they become
pointers to void) and for accessing them, two helper functions are used
(a getter and a setter). Those functions are called indirectly through
function pointers in the BDRVQcowState so they may later be exchanged
for different refcount orders.

With the check and repair functions using this function, the refcount
array they are creating will be in big endian byte order; additionally,
using realloc_refcount_array() makes the size of this refcount array
always cluster-aligned. Both combined allow rebuild_refcount_structure()
to drop the bounce buffer which was used to convert parts of the
refcount array to big endian byte order and store them on disk. Instead,
those parts can now be written directly.

[ kwolf: Fixed a build failure on 32 bit and another with old glib ]

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2-refcount.c | 126 ++++++++++++++++++++++++++++---------------------
 block/qcow2.h          |   8 ++++
 2 files changed, 81 insertions(+), 53 deletions(-)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 497364f..c0c1313 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -32,6 +32,11 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
                             int64_t offset, int64_t length, uint64_t addend,
                             bool decrease, enum qcow2_discard_type type);
 
+static uint64_t get_refcount_ro4(const void *refcount_array, uint64_t index);
+
+static void set_refcount_ro4(void *refcount_array, uint64_t index,
+                             uint64_t value);
+
 
 /*********************************************************/
 /* refcount handling */
@@ -42,6 +47,9 @@ int qcow2_refcount_init(BlockDriverState *bs)
     unsigned int refcount_table_size2, i;
     int ret;
 
+    s->get_refcount = &get_refcount_ro4;
+    s->set_refcount = &set_refcount_ro4;
+
     assert(s->refcount_table_size <= INT_MAX / sizeof(uint64_t));
     refcount_table_size2 = s->refcount_table_size * sizeof(uint64_t);
     s->refcount_table = g_try_malloc(refcount_table_size2);
@@ -72,6 +80,19 @@ void qcow2_refcount_close(BlockDriverState *bs)
 }
 
 
+static uint64_t get_refcount_ro4(const void *refcount_array, uint64_t index)
+{
+    return be16_to_cpu(((const uint16_t *)refcount_array)[index]);
+}
+
+static void set_refcount_ro4(void *refcount_array, uint64_t index,
+                             uint64_t value)
+{
+    assert(!(value >> 16));
+    ((uint16_t *)refcount_array)[index] = cpu_to_be16(value);
+}
+
+
 static int load_refcount_block(BlockDriverState *bs,
                                int64_t refcount_block_offset,
                                void **refcount_block)
@@ -97,7 +118,7 @@ int qcow2_get_refcount(BlockDriverState *bs, int64_t cluster_index,
     uint64_t refcount_table_index, block_index;
     int64_t refcount_block_offset;
     int ret;
-    uint16_t *refcount_block;
+    void *refcount_block;
 
     refcount_table_index = cluster_index >> s->refcount_block_bits;
     if (refcount_table_index >= s->refcount_table_size) {
@@ -119,16 +140,15 @@ int qcow2_get_refcount(BlockDriverState *bs, int64_t cluster_index,
     }
 
     ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset,
-        (void**) &refcount_block);
+                          &refcount_block);
     if (ret < 0) {
         return ret;
     }
 
     block_index = cluster_index & (s->refcount_block_size - 1);
-    *refcount = be16_to_cpu(refcount_block[block_index]);
+    *refcount = s->get_refcount(refcount_block, block_index);
 
-    ret = qcow2_cache_put(bs, s->refcount_block_cache,
-        (void**) &refcount_block);
+    ret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
     if (ret < 0) {
         return ret;
     }
@@ -172,7 +192,7 @@ static int in_same_refcount_block(BDRVQcowState *s, uint64_t offset_a,
  * Returns 0 on success or -errno in error case
  */
 static int alloc_refcount_block(BlockDriverState *bs,
-    int64_t cluster_index, uint16_t **refcount_block)
+                                int64_t cluster_index, void **refcount_block)
 {
     BDRVQcowState *s = bs->opaque;
     unsigned int refcount_table_index;
@@ -199,7 +219,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
             }
 
              return load_refcount_block(bs, refcount_block_offset,
-                 (void**) refcount_block);
+                                        refcount_block);
         }
     }
 
@@ -249,7 +269,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
     if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) {
         /* Zero the new refcount block before updating it */
         ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block,
-            (void**) refcount_block);
+                                    refcount_block);
         if (ret < 0) {
             goto fail_block;
         }
@@ -259,7 +279,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
         /* The block describes itself, need to update the cache */
         int block_index = (new_block >> s->cluster_bits) &
             (s->refcount_block_size - 1);
-        (*refcount_block)[block_index] = cpu_to_be16(1);
+        s->set_refcount(*refcount_block, block_index, 1);
     } else {
         /* Described somewhere else. This can recurse at most twice before we
          * arrive at a block that describes itself. */
@@ -277,7 +297,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
         /* Initialize the new refcount block only after updating its refcount,
          * update_refcount uses the refcount cache itself */
         ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block,
-            (void**) refcount_block);
+                                    refcount_block);
         if (ret < 0) {
             goto fail_block;
         }
@@ -311,7 +331,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
         return -EAGAIN;
     }
 
-    ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) refcount_block);
+    ret = qcow2_cache_put(bs, s->refcount_block_cache, refcount_block);
     if (ret < 0) {
         goto fail_block;
     }
@@ -365,7 +385,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
         s->cluster_size;
     uint64_t table_offset = meta_offset + blocks_clusters * s->cluster_size;
     uint64_t *new_table = g_try_new0(uint64_t, table_size);
-    uint16_t *new_blocks = g_try_malloc0(blocks_clusters * s->cluster_size);
+    void *new_blocks = g_try_malloc0(blocks_clusters * s->cluster_size);
 
     assert(table_size > 0 && blocks_clusters > 0);
     if (new_table == NULL || new_blocks == NULL) {
@@ -387,7 +407,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
     uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t));
     int block = 0;
     for (i = 0; i < table_clusters + blocks_clusters; i++) {
-        new_blocks[block++] = cpu_to_be16(1);
+        s->set_refcount(new_blocks, block++, 1);
     }
 
     /* Write refcount blocks to disk */
@@ -440,7 +460,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
     qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t),
                         QCOW2_DISCARD_OTHER);
 
-    ret = load_refcount_block(bs, new_block, (void**) refcount_block);
+    ret = load_refcount_block(bs, new_block, refcount_block);
     if (ret < 0) {
         return ret;
     }
@@ -455,7 +475,7 @@ fail_table:
     g_free(new_table);
 fail_block:
     if (*refcount_block != NULL) {
-        qcow2_cache_put(bs, s->refcount_block_cache, (void**) refcount_block);
+        qcow2_cache_put(bs, s->refcount_block_cache, refcount_block);
     }
     return ret;
 }
@@ -541,7 +561,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
 {
     BDRVQcowState *s = bs->opaque;
     int64_t start, last, cluster_offset;
-    uint16_t *refcount_block = NULL;
+    void *refcount_block = NULL;
     int64_t old_table_index = -1;
     int ret;
 
@@ -575,7 +595,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
         if (table_index != old_table_index) {
             if (refcount_block) {
                 ret = qcow2_cache_put(bs, s->refcount_block_cache,
-                    (void**) &refcount_block);
+                                      &refcount_block);
                 if (ret < 0) {
                     goto fail;
                 }
@@ -593,7 +613,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
         /* we can update the count and save it */
         block_index = cluster_index & (s->refcount_block_size - 1);
 
-        refcount = be16_to_cpu(refcount_block[block_index]);
+        refcount = s->get_refcount(refcount_block, block_index);
         if (decrease ? (refcount - addend > refcount)
                      : (refcount + addend < refcount ||
                         refcount + addend > s->refcount_max))
@@ -609,7 +629,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
         if (refcount == 0 && cluster_index < s->free_cluster_index) {
             s->free_cluster_index = cluster_index;
         }
-        refcount_block[block_index] = cpu_to_be16(refcount);
+        s->set_refcount(refcount_block, block_index, refcount);
 
         if (refcount == 0 && s->discard_passthrough[type]) {
             update_refcount_discard(bs, cluster_offset, s->cluster_size);
@@ -625,8 +645,7 @@ fail:
     /* Write last changed block to disk */
     if (refcount_block) {
         int wret;
-        wret = qcow2_cache_put(bs, s->refcount_block_cache,
-            (void**) &refcount_block);
+        wret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
         if (wret < 0) {
             return ret < 0 ? ret : wret;
         }
@@ -1118,11 +1137,11 @@ static size_t refcount_array_byte_size(BDRVQcowState *s, uint64_t entries)
  * refcount array buffer will be aligned to a cluster boundary, and the newly
  * allocated area will be zeroed.
  */
-static int realloc_refcount_array(BDRVQcowState *s, uint16_t **array,
+static int realloc_refcount_array(BDRVQcowState *s, void **array,
                                   int64_t *size, int64_t new_size)
 {
     size_t old_byte_size, new_byte_size;
-    uint16_t *new_ptr;
+    void *new_ptr;
 
     /* Round to clusters so the array can be directly written to disk */
     old_byte_size = size_to_clusters(s, refcount_array_byte_size(s, *size))
@@ -1162,12 +1181,12 @@ static int realloc_refcount_array(BDRVQcowState *s, uint16_t **array,
  */
 static int inc_refcounts(BlockDriverState *bs,
                          BdrvCheckResult *res,
-                         uint16_t **refcount_table,
+                         void **refcount_table,
                          int64_t *refcount_table_size,
                          int64_t offset, int64_t size)
 {
     BDRVQcowState *s = bs->opaque;
-    uint64_t start, last, cluster_offset, k;
+    uint64_t start, last, cluster_offset, k, refcount;
     int ret;
 
     if (size <= 0) {
@@ -1188,11 +1207,14 @@ static int inc_refcounts(BlockDriverState *bs,
             }
         }
 
-        if (++(*refcount_table)[k] == 0) {
+        refcount = s->get_refcount(*refcount_table, k);
+        if (refcount == s->refcount_max) {
             fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64
                     "\n", cluster_offset);
             res->corruptions++;
+            continue;
         }
+        s->set_refcount(*refcount_table, k, refcount + 1);
     }
 
     return 0;
@@ -1212,8 +1234,9 @@ enum {
  * error occurred.
  */
 static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
-    uint16_t **refcount_table, int64_t *refcount_table_size, int64_t l2_offset,
-    int flags)
+                              void **refcount_table,
+                              int64_t *refcount_table_size, int64_t l2_offset,
+                              int flags)
 {
     BDRVQcowState *s = bs->opaque;
     uint64_t *l2_table, l2_entry;
@@ -1330,7 +1353,7 @@ fail:
  */
 static int check_refcounts_l1(BlockDriverState *bs,
                               BdrvCheckResult *res,
-                              uint16_t **refcount_table,
+                              void **refcount_table,
                               int64_t *refcount_table_size,
                               int64_t l1_table_offset, int l1_size,
                               int flags)
@@ -1529,7 +1552,7 @@ fail:
  */
 static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res,
                            BdrvCheckMode fix, bool *rebuild,
-                           uint16_t **refcount_table, int64_t *nb_clusters)
+                           void **refcount_table, int64_t *nb_clusters)
 {
     BDRVQcowState *s = bs->opaque;
     int64_t i, size;
@@ -1614,9 +1637,10 @@ resize_fail:
             if (ret < 0) {
                 return ret;
             }
-            if ((*refcount_table)[cluster] != 1) {
+            if (s->get_refcount(*refcount_table, cluster) != 1) {
                 fprintf(stderr, "ERROR refcount block %" PRId64
-                        " refcount=%d\n", i, (*refcount_table)[cluster]);
+                        " refcount=%" PRIu64 "\n", i,
+                        s->get_refcount(*refcount_table, cluster));
                 res->corruptions++;
                 *rebuild = true;
             }
@@ -1631,7 +1655,7 @@ resize_fail:
  */
 static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
                                BdrvCheckMode fix, bool *rebuild,
-                               uint16_t **refcount_table, int64_t *nb_clusters)
+                               void **refcount_table, int64_t *nb_clusters)
 {
     BDRVQcowState *s = bs->opaque;
     int64_t i;
@@ -1695,7 +1719,7 @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
 static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
                               BdrvCheckMode fix, bool *rebuild,
                               int64_t *highest_cluster,
-                              uint16_t *refcount_table, int64_t nb_clusters)
+                              void *refcount_table, int64_t nb_clusters)
 {
     BDRVQcowState *s = bs->opaque;
     int64_t i;
@@ -1711,7 +1735,7 @@ static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
             continue;
         }
 
-        refcount2 = refcount_table[i];
+        refcount2 = s->get_refcount(refcount_table, i);
 
         if (refcount1 > 0 || refcount2 > 0) {
             *highest_cluster = i;
@@ -1770,7 +1794,7 @@ static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
  */
 static int64_t alloc_clusters_imrt(BlockDriverState *bs,
                                    int cluster_count,
-                                   uint16_t **refcount_table,
+                                   void **refcount_table,
                                    int64_t *imrt_nb_clusters,
                                    int64_t *first_free_cluster)
 {
@@ -1787,7 +1811,7 @@ static int64_t alloc_clusters_imrt(BlockDriverState *bs,
          contiguous_free_clusters < cluster_count;
          cluster++)
     {
-        if (!(*refcount_table)[cluster]) {
+        if (!s->get_refcount(*refcount_table, cluster)) {
             contiguous_free_clusters++;
             if (first_gap) {
                 /* If this is the first free cluster found, update
@@ -1825,7 +1849,7 @@ static int64_t alloc_clusters_imrt(BlockDriverState *bs,
     /* Go back to the first free cluster */
     cluster -= contiguous_free_clusters;
     for (i = 0; i < cluster_count; i++) {
-        (*refcount_table)[cluster + i] = 1;
+        s->set_refcount(*refcount_table, cluster + i, 1);
     }
 
     return cluster << s->cluster_bits;
@@ -1841,7 +1865,7 @@ static int64_t alloc_clusters_imrt(BlockDriverState *bs,
  */
 static int rebuild_refcount_structure(BlockDriverState *bs,
                                       BdrvCheckResult *res,
-                                      uint16_t **refcount_table,
+                                      void **refcount_table,
                                       int64_t *nb_clusters)
 {
     BDRVQcowState *s = bs->opaque;
@@ -1849,8 +1873,8 @@ static int rebuild_refcount_structure(BlockDriverState *bs,
     int64_t refblock_offset, refblock_start, refblock_index;
     uint32_t reftable_size = 0;
     uint64_t *on_disk_reftable = NULL;
-    uint16_t *on_disk_refblock;
-    int i, ret = 0;
+    void *on_disk_refblock;
+    int ret = 0;
     struct {
         uint64_t reftable_offset;
         uint32_t reftable_clusters;
@@ -1860,7 +1884,7 @@ static int rebuild_refcount_structure(BlockDriverState *bs,
 
 write_refblocks:
     for (; cluster < *nb_clusters; cluster++) {
-        if (!(*refcount_table)[cluster]) {
+        if (!s->get_refcount(*refcount_table, cluster)) {
             continue;
         }
 
@@ -1933,17 +1957,13 @@ write_refblocks:
             goto fail;
         }
 
-        on_disk_refblock = qemu_blockalign0(bs->file, s->cluster_size);
-        for (i = 0; i < s->refcount_block_size &&
-                    refblock_start + i < *nb_clusters; i++)
-        {
-            on_disk_refblock[i] =
-                cpu_to_be16((*refcount_table)[refblock_start + i]);
-        }
+        /* The size of *refcount_table is always cluster-aligned, therefore the
+         * write operation will not overflow */
+        on_disk_refblock = (void *)((char *) *refcount_table +
+                                    refblock_index * s->cluster_size);
 
         ret = bdrv_write(bs->file, refblock_offset / BDRV_SECTOR_SIZE,
-                         (void *)on_disk_refblock, s->cluster_sectors);
-        qemu_vfree(on_disk_refblock);
+                         on_disk_refblock, s->cluster_sectors);
         if (ret < 0) {
             fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret));
             goto fail;
@@ -2038,7 +2058,7 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
     BDRVQcowState *s = bs->opaque;
     BdrvCheckResult pre_compare_res;
     int64_t size, highest_cluster, nb_clusters;
-    uint16_t *refcount_table = NULL;
+    void *refcount_table = NULL;
     bool rebuild = false;
     int ret;
 
@@ -2087,7 +2107,7 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
         /* Because the old reftable has been exchanged for a new one the
          * references have to be recalculated */
         rebuild = false;
-        memset(refcount_table, 0, nb_clusters * sizeof(uint16_t));
+        memset(refcount_table, 0, refcount_array_byte_size(s, nb_clusters));
         ret = calculate_refcounts(bs, res, 0, &rebuild, &refcount_table,
                                   &nb_clusters);
         if (ret < 0) {
diff --git a/block/qcow2.h b/block/qcow2.h
index a9108f5..aa6d367 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -213,6 +213,11 @@ typedef struct Qcow2DiscardRegion {
     QTAILQ_ENTRY(Qcow2DiscardRegion) next;
 } Qcow2DiscardRegion;
 
+typedef uint64_t Qcow2GetRefcountFunc(const void *refcount_array,
+                                      uint64_t index);
+typedef void Qcow2SetRefcountFunc(void *refcount_array,
+                                  uint64_t index, uint64_t value);
+
 typedef struct BDRVQcowState {
     int cluster_bits;
     int cluster_size;
@@ -261,6 +266,9 @@ typedef struct BDRVQcowState {
     int refcount_bits;
     uint64_t refcount_max;
 
+    Qcow2GetRefcountFunc *get_refcount;
+    Qcow2SetRefcountFunc *set_refcount;
+
     bool discard_passthrough[QCOW2_DISCARD_MAX];
 
     int overlap_check; /* bitmask of Qcow2MetadataOverlap values */
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 62/73] virtio-blk: Remove the stale FIXME comment
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 22/73] qcow2: Helper function for refcount modification Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 63/73] iotests: Fix 051's reference output Kevin Wolf
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Fam Zheng <famz@redhat.com>

By default, we have ioeventfd enabled, so the IO request processing is
in IO thread; in the vcpu thread, guest mode is returned to as quickly
as possible, and completion is delivered via irqfd. Therefore this
comment from the initial implementation is barely relevant.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/virtio-blk.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 7b0b653..24ada67 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -597,12 +597,6 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
     if (mrb.num_reqs) {
         virtio_blk_submit_multireq(s->blk, &mrb);
     }
-
-    /*
-     * FIXME: Want to check for completions before returning to guest mode,
-     * so cached reads and writes are reported as quickly as possible. But
-     * that should be done in the generic block layer.
-     */
 }
 
 static void virtio_blk_dma_restart_bh(void *opaque)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 63/73] iotests: Fix 051's reference output
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 22/73] qcow2: Helper function for refcount modification Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 62/73] virtio-blk: Remove the stale FIXME comment Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 64/73] iotests: Remove 006 Kevin Wolf
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Commit c4bacafb717de55538311b80a185ce9166b8daa2 changed (improved)
qdev_init_nofail()'s error reporting, which affects iotest 051. Fix the
reference output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/051.out | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index bf52bf0..88add8f 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -115,8 +115,7 @@ QEMU X.Y.Z monitor - type 'help' for more information
 Testing: -drive if=ide
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: Device needs media, but drive is empty
-QEMU_PROG: Device initialization failed.
-QEMU_PROG: Initialization of device ide-hd failed
+QEMU_PROG: Initialization of device ide-hd failed: Device initialization failed.
 
 Testing: -drive if=virtio
 QEMU X.Y.Z monitor - type 'help' for more information
@@ -127,8 +126,7 @@ QEMU_PROG: -drive if=virtio: Device 'virtio-blk-pci' could not be initialized
 Testing: -drive if=scsi
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: -drive if=scsi: Device needs media, but drive is empty
-QEMU_PROG: Device initialization failed.
-QEMU_PROG: Initialization of device lsi53c895a failed
+QEMU_PROG: Initialization of device lsi53c895a failed: Device initialization failed.
 
 Testing: -drive if=none,id=disk -device ide-cd,drive=disk
 QEMU X.Y.Z monitor - type 'help' for more information
@@ -178,8 +176,7 @@ QEMU X.Y.Z monitor - type 'help' for more information
 Testing: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) QEMU_PROG: Can't use a read-only drive
-QEMU_PROG: Device initialization failed.
-QEMU_PROG: Initialization of device ide-hd failed
+QEMU_PROG: Initialization of device ide-hd failed: Device initialization failed.
 
 Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on
 QEMU X.Y.Z monitor - type 'help' for more information
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 64/73] iotests: Remove 006
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 63/73] iotests: Fix 051's reference output Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 65/73] iotests: Drop vpc from 004's and 104's format list Kevin Wolf
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Max Reitz <mreitz@redhat.com>

vpc does support images > 127 GB if done correctly. qemu does it
correctly. Remove the test pretending otherwise.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/006     | 54 ----------------------------------------------
 tests/qemu-iotests/006.out |  6 ------
 tests/qemu-iotests/group   |  2 +-
 3 files changed, 1 insertion(+), 61 deletions(-)
 delete mode 100755 tests/qemu-iotests/006
 delete mode 100644 tests/qemu-iotests/006.out

diff --git a/tests/qemu-iotests/006 b/tests/qemu-iotests/006
deleted file mode 100755
index 0c0cf5d..0000000
--- a/tests/qemu-iotests/006
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# Make sure qemu-img rejects > 127GB images for the vpc format as the format
-# doesn't support this.
-#
-# Copyright (C) 2009 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-# creator
-owner=hch@lst.de
-
-seq=`basename $0`
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-
-_cleanup()
-{
-	_cleanup_test_img
-}
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
-# get standard environment, filters and checks
-. ./common.rc
-. ./common.filter
-
-_supported_fmt vpc
-_supported_proto generic
-_supported_os Linux
-
-
-echo
-echo "creating 128GB image"
-_make_test_img 128G
-
-# success, all done
-echo "*** done"
-rm -f $seq.full
-status=0
diff --git a/tests/qemu-iotests/006.out b/tests/qemu-iotests/006.out
deleted file mode 100644
index d135841..0000000
--- a/tests/qemu-iotests/006.out
+++ /dev/null
@@ -1,6 +0,0 @@
-QA output created by 006
-
-creating 128GB image
-qemu-img: The image size is too large for file format 'vpc'
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=137438953472
-*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 93a0250..87eec39 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -12,7 +12,7 @@
 003 rw auto
 004 rw auto quick
 005 img auto quick
-006 img auto
+# 006 was removed, do not reuse
 007 snapshot auto
 008 rw auto quick
 009 rw auto quick
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 65/73] iotests: Drop vpc from 004's and 104's format list
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 64/73] iotests: Remove 006 Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 66/73] block/vdi: Add locking for parallel requests Kevin Wolf
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Both tests require the test image to have a specific size; this cannot
be guaranteed by vpc (unless tuning the test specifically for that
format).

It is safe to exclude vpc from 004 because what is tested there is
implemented in a generic part in the block layer and not
format-specific.

It is safe to exclude vpc from 104 because for vpc basically every image
size is "unaligned", so if that would break at some point in time, we
would quickly notice just by running the generic tests.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/004 | 2 +-
 tests/qemu-iotests/104 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004
index 651072e..2ad77ed 100755
--- a/tests/qemu-iotests/004
+++ b/tests/qemu-iotests/004
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 . ./common.rc
 . ./common.filter
 
-_supported_fmt generic
+_supported_fmt raw qcow qcow2 qed vdi vmdk vhdx
 _supported_proto generic
 _supported_os Linux
 
diff --git a/tests/qemu-iotests/104 b/tests/qemu-iotests/104
index f32752b..2e35ea8 100755
--- a/tests/qemu-iotests/104
+++ b/tests/qemu-iotests/104
@@ -34,7 +34,7 @@ trap "exit \$status" 0 1 2 3 15
 . ./common.rc
 . ./common.filter
 
-_supported_fmt generic
+_supported_fmt raw qcow qcow2 qed vdi vmdk vhdx
 _supported_proto generic
 _supported_os Linux
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 66/73] block/vdi: Add locking for parallel requests
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 65/73] iotests: Drop vpc from 004's and 104's format list Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 67/73] scsi-hd: fix property unset case Kevin Wolf
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Max Reitz <mreitz@redhat.com>

When allocating a new cluster, the first write to it must be the one
doing the allocation, because that one pads its write request to the
cluster size; if another write to that cluster is executed before it,
that write will be overwritten due to the padding.

See https://bugs.launchpad.net/qemu/+bug/1422307 for what can go wrong
without this patch.

Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vdi.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/block/vdi.c b/block/vdi.c
index 74030c6..53bd02f 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -53,6 +53,7 @@
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "migration/migration.h"
+#include "block/coroutine.h"
 
 #if defined(CONFIG_UUID)
 #include <uuid/uuid.h>
@@ -196,6 +197,8 @@ typedef struct {
     /* VDI header (converted to host endianness). */
     VdiHeader header;
 
+    CoMutex write_lock;
+
     Error *migration_blocker;
 } BDRVVdiState;
 
@@ -504,6 +507,8 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
               "vdi", bdrv_get_device_name(bs), "live migration");
     migrate_add_blocker(s->migration_blocker);
 
+    qemu_co_mutex_init(&s->write_lock);
+
     return 0;
 
  fail_free_bmap:
@@ -639,11 +644,31 @@ static int vdi_co_write(BlockDriverState *bs,
                    buf, n_sectors * SECTOR_SIZE);
             memset(block + (sector_in_block + n_sectors) * SECTOR_SIZE, 0,
                    (s->block_sectors - n_sectors - sector_in_block) * SECTOR_SIZE);
+
+            /* Note that this coroutine does not yield anywhere from reading the
+             * bmap entry until here, so in regards to all the coroutines trying
+             * to write to this cluster, the one doing the allocation will
+             * always be the first to try to acquire the lock.
+             * Therefore, it is also the first that will actually be able to
+             * acquire the lock and thus the padded cluster is written before
+             * the other coroutines can write to the affected area. */
+            qemu_co_mutex_lock(&s->write_lock);
             ret = bdrv_write(bs->file, offset, block, s->block_sectors);
+            qemu_co_mutex_unlock(&s->write_lock);
         } else {
             uint64_t offset = s->header.offset_data / SECTOR_SIZE +
                               (uint64_t)bmap_entry * s->block_sectors +
                               sector_in_block;
+            qemu_co_mutex_lock(&s->write_lock);
+            /* This lock is only used to make sure the following write operation
+             * is executed after the write issued by the coroutine allocating
+             * this cluster, therefore we do not need to keep it locked.
+             * As stated above, the allocating coroutine will always try to lock
+             * the mutex before all the other concurrent accesses to that
+             * cluster, therefore at this point we can be absolutely certain
+             * that that write operation has returned (there may be other writes
+             * in flight, but they do not concern this very operation). */
+            qemu_co_mutex_unlock(&s->write_lock);
             ret = bdrv_write(bs->file, offset, buf, n_sectors);
         }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 67/73] scsi-hd: fix property unset case
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (5 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 66/73] block/vdi: Add locking for parallel requests Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 68/73] Add testcase for scsi-hd devices without drive property Kevin Wolf
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>

Commit c53659f0 ("BlockConf: Call backend functions to detect geometry
and blocksizes") causes a segmentation fault on the invalid
configuration of a scsi device without a drive.

Let's check for conf.blk before calling blkconf_blocksizes. The error
will be handled later on in scsi_realize anyway.

Reported-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/scsi/scsi-disk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 2921728..54d71f4 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2291,7 +2291,12 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
 static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
 {
     SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
-    blkconf_blocksizes(&s->qdev.conf);
+    /* can happen for devices without drive. The error message for missing
+     * backend will be issued in scsi_realize
+     */
+    if (s->qdev.conf.blk) {
+        blkconf_blocksizes(&s->qdev.conf);
+    }
     s->qdev.blocksize = s->qdev.conf.logical_block_size;
     s->qdev.type = TYPE_DISK;
     if (!s->product) {
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 68/73] Add testcase for scsi-hd devices without drive property
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (6 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 67/73] scsi-hd: fix property unset case Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 69/73] sheepdog: Fix misleading error messages in sd_snapshot_create() Kevin Wolf
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Christian Borntraeger <borntraeger@de.ibm.com>

Lets add a test for scsi devices without a drive. This was broken
by a recent block patch, thus indicating that we need a testcase.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/051     | 6 ++++++
 tests/qemu-iotests/051.out | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 2274d18..0360f37 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -99,6 +99,12 @@ run_qemu -drive file="$TEST_IMG",driver=raw,format=qcow2
 run_qemu -drive file="$TEST_IMG",driver=qcow2,format=qcow2
 
 echo
+echo === Device without drive ===
+echo
+
+run_qemu -device virtio-scsi-pci -device scsi-hd
+
+echo
 echo === Overriding backing file ===
 echo
 
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index 88add8f..09895e6 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -47,6 +47,14 @@ Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2
 QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specify both 'driver' and 'format'
 
 
+=== Device without drive ===
+
+Testing: -device virtio-scsi-pci -device scsi-hd
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) QEMU_PROG: -device scsi-hd: drive property not set
+QEMU_PROG: -device scsi-hd: Device 'scsi-hd' could not be initialized
+
+
 === Overriding backing file ===
 
 Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig -nodefaults
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 69/73] sheepdog: Fix misleading error messages in sd_snapshot_create()
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (7 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 68/73] Add testcase for scsi-hd devices without drive property Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 70/73] MAINTAINERS: Add jsnow as IDE maintainer Kevin Wolf
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Markus Armbruster <armbru@redhat.com>

If do_sd_create() fails, it first reports the error returned, then
reports a another one with strerror(errno).  errno is meaningless at
that point.

Report just one error combining the valid information from both
messages.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/sheepdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 60a4853..c14172c 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2339,9 +2339,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
 
     ret = do_sd_create(s, &new_vid, 1, &local_err);
     if (ret < 0) {
-        error_report_err(local_err);
-        error_report("failed to create inode for snapshot. %s",
-                     strerror(errno));
+        error_report("failed to create inode for snapshot: %s",
+                     error_get_pretty(local_err));
         goto cleanup;
     }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 70/73] MAINTAINERS: Add jsnow as IDE maintainer
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (8 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 69/73] sheepdog: Fix misleading error messages in sd_snapshot_create() Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 71/73] block/raw-posix: fix launching with failed disks Kevin Wolf
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: John Snow <jsnow@redhat.com>

It has been proposed that the block layer be split up into smaller,
more manageable portions to help speed up the review and merging of
block layer patches.

As part of this process, I propose that I take over the IDE, ATA, ATAPI
and FD devices.

As we split out the block layer, we will begin using the qemu-block
mailing list as a catchall for all of the block layer subcomponents.
Please CC qemu-block@nongnu.org for all block layer patches, including
any that touch the IDE/Floppy devices.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 MAINTAINERS | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8c06739..d7c55b9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -605,11 +605,25 @@ S: Maintained
 F: hw/misc/edu.c
 
 IDE
-M: Kevin Wolf <kwolf@redhat.com>
-M: Stefan Hajnoczi <stefanha@redhat.com>
-S: Odd Fixes
+M: John Snow <jsnow@redhat.com>
+L: qemu-block@nongnu.org
+S: Supported
 F: include/hw/ide.h
 F: hw/ide/
+F: hw/block/block.c
+F: hw/block/cdrom.c
+F: hw/block/hd-geometry.c
+F: tests/ide-test.c
+F: tests/ahci-test.c
+T: git git://github.com/jnsnow/qemu.git ide
+
+Floppy
+M: John Snow <jsnow@redhat.com>
+L: qemu-block@nongnu.org
+S: Supported
+F: hw/block/fdc.c
+F: include/hw/block/fdc.h
+T: git git://github.com/jnsnow/qemu.git ide
 
 OMAP
 M: Peter Maydell <peter.maydell@linaro.org>
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 71/73] block/raw-posix: fix launching with failed disks
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (9 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 70/73] MAINTAINERS: Add jsnow as IDE maintainer Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 72/73] iotests: add O_DIRECT alignment probing test Kevin Wolf
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Stefan Hajnoczi <stefanha@redhat.com>

Since commit c25f53b06eba1575d5d0e92a0132455c97825b83 ("raw: Probe
required direct I/O alignment") QEMU has failed to launch if image files
produce I/O errors.

Previously, QEMU would launch successfully and the guest would see the
errors when attempting I/O.

This is a regression and may prevent multipath I/O inside the guest,
where QEMU must launch and let the guest figure out by itself which
disks are online.

Tweak the alignment probing code in raw-posix.c to explicitly look for
EINVAL on Linux instead of bailing.  The kernel refuses misaligned
requests with this error code and other error codes can be ignored.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw-posix.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 3263d2b..f0b4488 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -272,6 +272,31 @@ static int probe_physical_blocksize(int fd, unsigned int *blk_size)
 #endif
 }
 
+/* Check if read is allowed with given memory buffer and length.
+ *
+ * This function is used to check O_DIRECT memory buffer and request alignment.
+ */
+static bool raw_is_io_aligned(int fd, void *buf, size_t len)
+{
+    ssize_t ret = pread(fd, buf, len, 0);
+
+    if (ret >= 0) {
+        return true;
+    }
+
+#ifdef __linux__
+    /* The Linux kernel returns EINVAL for misaligned O_DIRECT reads.  Ignore
+     * other errors (e.g. real I/O error), which could happen on a failed
+     * drive, since we only care about probing alignment.
+     */
+    if (errno != EINVAL) {
+        return true;
+    }
+#endif
+
+    return false;
+}
+
 static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
 {
     BDRVRawState *s = bs->opaque;
@@ -307,7 +332,7 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
         size_t align;
         buf = qemu_memalign(MAX_BLOCKSIZE, 2 * MAX_BLOCKSIZE);
         for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) {
-            if (pread(fd, buf + align, MAX_BLOCKSIZE, 0) >= 0) {
+            if (raw_is_io_aligned(fd, buf + align, MAX_BLOCKSIZE)) {
                 s->buf_align = align;
                 break;
             }
@@ -319,7 +344,7 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
         size_t align;
         buf = qemu_memalign(s->buf_align, MAX_BLOCKSIZE);
         for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) {
-            if (pread(fd, buf, align, 0) >= 0) {
+            if (raw_is_io_aligned(fd, buf, align)) {
                 bs->request_alignment = align;
                 break;
             }
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 72/73] iotests: add O_DIRECT alignment probing test
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (10 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 71/73] block/raw-posix: fix launching with failed disks Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-09 15:41 ` [Qemu-devel] [PULL 73/73] MAINTAINERS: Add jcody as blockjobs, block devices maintainer Kevin Wolf
  2015-03-10 10:49 ` [Qemu-devel] [PULL 00/73] Block patches Peter Maydell
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Stefan Hajnoczi <stefanha@redhat.com>

This test case checks that image files can be opened even if I/O
produces EIO errors.  QEMU should not refuse opening failed disks since
the guest may be configured for multipath I/O where accessing failed
disks is expected.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/128     | 82 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/128.out |  5 +++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/qemu-iotests/128
 create mode 100644 tests/qemu-iotests/128.out

diff --git a/tests/qemu-iotests/128 b/tests/qemu-iotests/128
new file mode 100755
index 0000000..249a865
--- /dev/null
+++ b/tests/qemu-iotests/128
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# Test that opening O_DIRECT succeeds when image file I/O produces EIO
+#
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=stefanha@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+
+devname="eiodev$$"
+
+_setup_eiodev()
+{
+	# This test should either be run as root or with passwordless sudo
+	for cmd in "" "sudo -n"; do
+		echo "0 $((1024 * 1024 * 1024 / 512)) error" | \
+			$cmd dmsetup create "$devname" 2>/dev/null
+		if [ "$?" -eq 0 ]; then
+			return
+		fi
+	done
+	_notrun "root privileges required to run dmsetup"
+}
+
+_cleanup_eiodev()
+{
+	for cmd in "" "sudo -n"; do
+		$cmd dmsetup remove "$devname" 2>/dev/null
+		if [ "$?" -eq 0 ]; then
+			return
+		fi
+	done
+}
+
+_cleanup()
+{
+	_cleanup_eiodev
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt raw
+_supported_proto file
+_supported_os Linux
+
+_setup_eiodev
+
+TEST_IMG="/dev/mapper/$devname"
+
+echo
+echo "== reading from error device =="
+# Opening image should succeed but the read operation should fail
+$QEMU_IO --format "$IMGFMT" --nocache -c "read 0 65536" "$TEST_IMG" | _filter_qemu_io
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/128.out b/tests/qemu-iotests/128.out
new file mode 100644
index 0000000..4e43f5f
--- /dev/null
+++ b/tests/qemu-iotests/128.out
@@ -0,0 +1,5 @@
+QA output created by 128
+
+== reading from error device ==
+read failed: Input/output error
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 87eec39..71f19d4 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -121,3 +121,4 @@
 114 rw auto quick
 116 rw auto quick
 123 rw auto quick
+128 rw auto quick
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 73/73] MAINTAINERS: Add jcody as blockjobs, block devices maintainer
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (11 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 72/73] iotests: add O_DIRECT alignment probing test Kevin Wolf
@ 2015-03-09 15:41 ` Kevin Wolf
  2015-03-10 10:49 ` [Qemu-devel] [PULL 00/73] Block patches Peter Maydell
  13 siblings, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2015-03-09 15:41 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Jeff Cody <jcody@redhat.com>

The block layer maintainership is being split up into smaller, more
manageable pieces.

I propose that I take over / assist with the following areas:

    * blockjobs
    * archipelago
    * curl
    * gluster
    * nfs
    * rbd
    * sheepdog
    * ssh
    * vhdx

As John Snow noted in a different patch:

As we split out the block layer, we will begin using the qemu-block
mailing list as a catchall for all of the block layer subcomponents.
Please CC qemu-block@nongnu.org for all block layer patches, including
any that touch the above listed areas.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 MAINTAINERS | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d7c55b9..08443c2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -784,6 +784,18 @@ F: tests/qemu-iotests/
 T: git git://repo.or.cz/qemu/kevin.git block
 T: git git://github.com/stefanha/qemu.git block
 
+Block Jobs
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
+S: Supported
+F: blockjob.c
+F: include/block/blockjob.h
+F: block/backup.c
+F: block/commit.c
+F: block/stream.h
+F: block/mirror.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
+
 Character Devices
 M: Anthony Liguori <aliguori@amazon.com>
 M: Paolo Bonzini <pbonzini@redhat.com>
@@ -1093,20 +1105,28 @@ F: block/vmdk.c
 
 RBD
 M: Josh Durgin <josh.durgin@inktank.com>
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
 S: Supported
 F: block/rbd.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
 Sheepdog
 M: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
 M: Liu Yuan <namei.unix@gmail.com>
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
 L: sheepdog@lists.wpkg.org
 S: Supported
 F: block/sheepdog.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
 VHDX
 M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
 S: Supported
 F: block/vhdx*
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
 VDI
 M: Stefan Weil <sw@weilnetz.de>
@@ -1121,19 +1141,42 @@ S: Supported
 F: block/iscsi.c
 
 NFS
+M: Jeff Cody <jcody@redhat.com>
 M: Peter Lieven <pl@kamp.de>
+L: qemu-block@nongnu.org
 S: Maintained
 F: block/nfs.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
 SSH
 M: Richard W.M. Jones <rjones@redhat.com>
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
 S: Supported
 F: block/ssh.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
 ARCHIPELAGO
 M: Chrysostomos Nanakos <chris@include.gr>
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
 S: Maintained
 F: block/archipelago.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
+
+CURL
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
+S: Supported
+F: block/curl.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
+
+GLUSTER
+M: Jeff Cody <jcody@redhat.com>
+L: qemu-block@nongnu.org
+S: Supported
+F: block/gluster.c
+T: git git://github.com/codyprime/qemu-kvm-jtc.git block
 
 Bootdevice
 M: Gonglei <arei.gonglei@huawei.com>
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 00/73] Block patches
  2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
                   ` (12 preceding siblings ...)
  2015-03-09 15:41 ` [Qemu-devel] [PULL 73/73] MAINTAINERS: Add jcody as blockjobs, block devices maintainer Kevin Wolf
@ 2015-03-10 10:49 ` Peter Maydell
  2015-03-10 11:00   ` Fam Zheng
  13 siblings, 1 reply; 16+ messages in thread
From: Peter Maydell @ 2015-03-10 10:49 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: QEMU Developers, qemu-block

On 9 March 2015 at 15:41, Kevin Wolf <kwolf@redhat.com> wrote:
> Hi Peter,
>
> I hope this fixes the build problems in Stefan's pull request. I'm only posting
> those patches that are new compared to Stefan's version, or that have actual
> differences (the fixed build errors; not reposting for my added Signed-off-by).
>
> Kevin
>
>
> The following changes since commit 6608c7e9eb65727524f6f590b1e716ec6e7877d4:
>
>   Merge remote-tracking branch 'remotes/xtensa/tags/20150307-xtensa' into staging (2015-03-08 14:32:38 +0000)
>
> are available in the git repository at:
>
>
>   git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 305a8e96908c89a926438e1c4b738b296ee12061:
>
>   MAINTAINERS: Add jcody as blockjobs, block devices maintainer (2015-03-09 16:33:44 +0100)
>
> ----------------------------------------------------------------
> Block patches for 2.3

Build failure, OSX:
/Users/pm215/src/qemu/tests/libqos/ahci.c:777:6: error: conflicting
types for 'ahci_command_adjust'
void ahci_command_adjust(AHCICommand *cmd, uint64_t offset, uint64_t buffer,
     ^
/Users/pm215/src/qemu/tests/libqos/ahci.h:548:6: note: previous
declaration is here
void ahci_command_adjust(AHCICommand *cmd, uint64_t lba_sect, uint64_t gbuffer,
     ^
1 error generated.

Build failure, Win32:

/home/petmay01/linaro/qemu-for-merges/hw/block/virtio-blk.c: In
function 'virtio_blk_handle_scsi_req':
/home/petmay01/linaro/qemu-for-merges/hw/block/virtio-blk.c:200:
warning: unused variable 'acb'

-- PMM

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

* Re: [Qemu-devel] [PULL 00/73] Block patches
  2015-03-10 10:49 ` [Qemu-devel] [PULL 00/73] Block patches Peter Maydell
@ 2015-03-10 11:00   ` Fam Zheng
  0 siblings, 0 replies; 16+ messages in thread
From: Fam Zheng @ 2015-03-10 11:00 UTC (permalink / raw)
  To: Kevin Wolf, Peter Maydell; +Cc: QEMU Developers, qemu-block

On Tue, 03/10 10:49, Peter Maydell wrote:
> Build failure, Win32:
> 
> /home/petmay01/linaro/qemu-for-merges/hw/block/virtio-blk.c: In
> function 'virtio_blk_handle_scsi_req':
> /home/petmay01/linaro/qemu-for-merges/hw/block/virtio-blk.c:200:
> warning: unused variable 'acb'

The variable definition should be moved into #ifdef. Kevin, could you squash
this to "[PULL 09/69] virtio-blk: Check return value of blk_aio_ioctl"?:

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index a2e7684..c12d2eb 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -197,11 +197,11 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req)
     VirtIODevice *vdev = VIRTIO_DEVICE(req->dev);
     VirtQueueElement *elem = &req->elem;
     VirtIOBlock *blk = req->dev;
-    BlockAIOCB *acb;

 #ifdef __linux__
     int i;
     VirtIOBlockIoctlReq *ioctl_req;
+    BlockAIOCB *acb;
 #endif

     /*

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

end of thread, other threads:[~2015-03-10 11:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 15:41 [Qemu-devel] [PULL 00/73] Block patches Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 22/73] qcow2: Helper function for refcount modification Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 62/73] virtio-blk: Remove the stale FIXME comment Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 63/73] iotests: Fix 051's reference output Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 64/73] iotests: Remove 006 Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 65/73] iotests: Drop vpc from 004's and 104's format list Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 66/73] block/vdi: Add locking for parallel requests Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 67/73] scsi-hd: fix property unset case Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 68/73] Add testcase for scsi-hd devices without drive property Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 69/73] sheepdog: Fix misleading error messages in sd_snapshot_create() Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 70/73] MAINTAINERS: Add jsnow as IDE maintainer Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 71/73] block/raw-posix: fix launching with failed disks Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 72/73] iotests: add O_DIRECT alignment probing test Kevin Wolf
2015-03-09 15:41 ` [Qemu-devel] [PULL 73/73] MAINTAINERS: Add jcody as blockjobs, block devices maintainer Kevin Wolf
2015-03-10 10:49 ` [Qemu-devel] [PULL 00/73] Block patches Peter Maydell
2015-03-10 11:00   ` Fam Zheng

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