qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 00/23] Block patches
@ 2011-07-20 10:34 Kevin Wolf
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 05/23] scsi: Add 'hba_private' to SCSIRequest Kevin Wolf
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-07-20 10:34 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

(Reposting only changed or new patches)

The following changes since commit 89b9ba661bd2d6155308f895ec075d813f0e129b:

  Fix signal handling of SIG_IPI when io-thread is enabled (2011-07-16 19:43:00 +0000)

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

Devin Nakamura (2):
      qemu-io: Fix formatting
      qemu-io: Fix if scoping bug

Fam Zheng (12):
      VMDK: introduce VmdkExtent
      VMDK: bugfix, align offset to cluster in get_whole_cluster
      VMDK: probe for monolithicFlat images
      VMDK: separate vmdk_open by format version
      VMDK: add field BDRVVmdkState.desc_offset
      VMDK: flush multiple extents
      VMDK: move 'static' cid_update flag to bs field
      VMDK: change get_cluster_offset return type
      VMDK: open/read/write for monolithicFlat image
      VMDK: create different subformats
      VMDK: fix coding style
      block: add bdrv_get_allocated_file_size() operation

Hannes Reinecke (4):
      iov: Update parameter usage in iov_(to|from)_buf()
      scsi: Add 'hba_private' to SCSIRequest
      scsi-disk: Fixup debugging statement
      scsi-disk: Mask out serial number EVPD

Jes Sorensen (1):
      Add missing documentation for qemu-img -p

Kevin Wolf (1):
      qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm

Luiz Capitulino (2):
      qemu-options.hx: Document missing -drive options
      qemu-config: Document -drive options

MORITA Kazutaka (1):
      sheepdog: add full data preallocation support

 block.c                |   19 +
 block.h                |    1 +
 block/qcow2-cache.c    |   12 +
 block/qcow2-refcount.c |   38 +-
 block/qcow2.h          |    2 +
 block/raw-posix.c      |   21 +
 block/raw-win32.c      |   29 +
 block/sheepdog.c       |   71 ++-
 block/vmdk.c           | 1297 ++++++++++++++++--------
 block_int.h            |    2 +
 hw/esp.c               |    2 +-
 hw/lsi53c895a.c        |   22 +-
 hw/scsi-bus.c          |    9 +-
 hw/scsi-disk.c         |   21 +-
 hw/scsi-generic.c      |    5 +-
 hw/scsi.h              |   10 +-
 hw/spapr_vscsi.c       |   28 +-
 hw/usb-msd.c           |    9 +-
 hw/virtio-net.c        |    2 +-
 hw/virtio-serial-bus.c |    2 +-
 iov.c                  |   49 +-
 iov.h                  |   10 +-
 qemu-config.c          |    6 +
 qemu-img-cmds.hx       |    4 +-
 qemu-img.c             |   31 +-
 qemu-img.texi          |    6 +-
 qemu-io.c              | 2653 ++++++++++++++++++++++++------------------------
 qemu-options.hx        |    8 +
 28 files changed, 2509 insertions(+), 1860 deletions(-)

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

* [Qemu-devel] [PATCH 05/23] scsi: Add 'hba_private' to SCSIRequest
  2011-07-20 10:34 [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
@ 2011-07-20 10:34 ` Kevin Wolf
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 22/23] qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm Kevin Wolf
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-07-20 10:34 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hannes Reinecke <hare@suse.de>

'tag' is just an abstraction to identify the command
from the driver. So we should make that explicit by
replacing 'tag' with a driver-defined pointer 'hba_private'.
This saves the lookup for driver handling several commands
in parallel.
'tag' is still being kept for tracing purposes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/esp.c          |    2 +-
 hw/lsi53c895a.c   |   22 ++++++++--------------
 hw/scsi-bus.c     |    9 ++++++---
 hw/scsi-disk.c    |    4 ++--
 hw/scsi-generic.c |    5 +++--
 hw/scsi.h         |   10 +++++++---
 hw/spapr_vscsi.c  |   28 +++++++++-------------------
 hw/usb-msd.c      |    9 +--------
 8 files changed, 37 insertions(+), 52 deletions(-)

diff --git a/hw/esp.c b/hw/esp.c
index aa50800..9ddd637 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -244,7 +244,7 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)
 
     DPRINTF("do_busid_cmd: busid 0x%x\n", busid);
     lun = busid & 7;
-    s->current_req = scsi_req_new(s->current_dev, 0, lun);
+    s->current_req = scsi_req_new(s->current_dev, 0, lun, NULL);
     datalen = scsi_req_enqueue(s->current_req, buf);
     s->ti_size = datalen;
     if (datalen != 0) {
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 940b43a..69eec1d 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -661,7 +661,7 @@ static lsi_request *lsi_find_by_tag(LSIState *s, uint32_t tag)
 static void lsi_request_cancelled(SCSIRequest *req)
 {
     LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
-    lsi_request *p;
+    lsi_request *p = req->hba_private;
 
     if (s->current && req == s->current->req) {
         scsi_req_unref(req);
@@ -670,7 +670,6 @@ static void lsi_request_cancelled(SCSIRequest *req)
         return;
     }
 
-    p = lsi_find_by_tag(s, req->tag);
     if (p) {
         QTAILQ_REMOVE(&s->queue, p, next);
         scsi_req_unref(req);
@@ -680,18 +679,12 @@ static void lsi_request_cancelled(SCSIRequest *req)
 
 /* Record that data is available for a queued command.  Returns zero if
    the device was reselected, nonzero if the IO is deferred.  */
-static int lsi_queue_tag(LSIState *s, uint32_t tag, uint32_t len)
+static int lsi_queue_req(LSIState *s, SCSIRequest *req, uint32_t len)
 {
-    lsi_request *p;
-
-    p = lsi_find_by_tag(s, tag);
-    if (!p) {
-        BADF("IO with unknown tag %d\n", tag);
-        return 1;
-    }
+    lsi_request *p = req->hba_private;
 
     if (p->pending) {
-        BADF("Multiple IO pending for tag %d\n", tag);
+        BADF("Multiple IO pending for request %p\n", p);
     }
     p->pending = len;
     /* Reselect if waiting for it, or if reselection triggers an IRQ
@@ -743,9 +736,9 @@ static void lsi_transfer_data(SCSIRequest *req, uint32_t len)
     LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
     int out;
 
-    if (s->waiting == 1 || !s->current || req->tag != s->current->tag ||
+    if (s->waiting == 1 || !s->current || req->hba_private != s->current ||
         (lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON))) {
-        if (lsi_queue_tag(s, req->tag, len)) {
+        if (lsi_queue_req(s, req, len)) {
             return;
         }
     }
@@ -789,7 +782,8 @@ static void lsi_do_command(LSIState *s)
     assert(s->current == NULL);
     s->current = qemu_mallocz(sizeof(lsi_request));
     s->current->tag = s->select_tag;
-    s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun);
+    s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun,
+                                   s->current);
 
     n = scsi_req_enqueue(s->current->req, buf);
     if (n) {
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index ad6a730..8b1a412 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -131,7 +131,8 @@ int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
     return res;
 }
 
-SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun)
+SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag,
+                            uint32_t lun, void *hba_private)
 {
     SCSIRequest *req;
 
@@ -141,14 +142,16 @@ SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t l
     req->dev = d;
     req->tag = tag;
     req->lun = lun;
+    req->hba_private = hba_private;
     req->status = -1;
     trace_scsi_req_alloc(req->dev->id, req->lun, req->tag);
     return req;
 }
 
-SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun)
+SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun,
+                          void *hba_private)
 {
-    return d->info->alloc_req(d, tag, lun);
+    return d->info->alloc_req(d, tag, lun, hba_private);
 }
 
 uint8_t *scsi_req_get_buf(SCSIRequest *req)
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index a8c7372..c2a99fe 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -81,13 +81,13 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type);
 static int scsi_disk_emulate_command(SCSIDiskReq *r, uint8_t *outbuf);
 
 static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag,
-        uint32_t lun)
+                                     uint32_t lun, void *hba_private)
 {
     SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);
     SCSIRequest *req;
     SCSIDiskReq *r;
 
-    req = scsi_req_alloc(sizeof(SCSIDiskReq), &s->qdev, tag, lun);
+    req = scsi_req_alloc(sizeof(SCSIDiskReq), &s->qdev, tag, lun, hba_private);
     r = DO_UPCAST(SCSIDiskReq, req, req);
     r->iov.iov_base = qemu_blockalign(s->bs, SCSI_DMA_BUF_SIZE);
     return req;
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 8e59c7e..90345a7 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -96,11 +96,12 @@ static int scsi_get_sense(SCSIRequest *req, uint8_t *outbuf, int len)
     return size;
 }
 
-static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun)
+static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
+                                     void *hba_private)
 {
     SCSIRequest *req;
 
-    req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun);
+    req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun, hba_private);
     return req;
 }
 
diff --git a/hw/scsi.h b/hw/scsi.h
index c1dca35..6b15bbc 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -43,6 +43,7 @@ struct SCSIRequest {
     } cmd;
     BlockDriverAIOCB  *aiocb;
     bool enqueued;
+    void *hba_private;
     QTAILQ_ENTRY(SCSIRequest) next;
 };
 
@@ -67,7 +68,8 @@ struct SCSIDeviceInfo {
     DeviceInfo qdev;
     scsi_qdev_initfn init;
     void (*destroy)(SCSIDevice *s);
-    SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun);
+    SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun,
+                              void *hba_private);
     void (*free_req)(SCSIRequest *req);
     int32_t (*send_command)(SCSIRequest *req, uint8_t *buf);
     void (*read_data)(SCSIRequest *req);
@@ -138,8 +140,10 @@ extern const struct SCSISense sense_code_LUN_FAILURE;
 int scsi_build_sense(SCSISense sense, uint8_t *buf, int len, int fixed);
 int scsi_sense_valid(SCSISense sense);
 
-SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun);
-SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun);
+SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag,
+                            uint32_t lun, void *hba_private);
+SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun,
+                          void *hba_private);
 int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf);
 void scsi_req_free(SCSIRequest *req);
 SCSIRequest *scsi_req_ref(SCSIRequest *req);
diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index 1c901ef..646b1e3 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -121,7 +121,7 @@ static struct vscsi_req *vscsi_get_req(VSCSIState *s)
     return NULL;
 }
 
-static void vscsi_put_req(VSCSIState *s, vscsi_req *req)
+static void vscsi_put_req(vscsi_req *req)
 {
     if (req->sreq != NULL) {
         scsi_req_unref(req->sreq);
@@ -130,15 +130,6 @@ static void vscsi_put_req(VSCSIState *s, vscsi_req *req)
     req->active = 0;
 }
 
-static vscsi_req *vscsi_find_req(VSCSIState *s, SCSIRequest *req)
-{
-    uint32_t tag = req->tag;
-    if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {
-        return NULL;
-    }
-    return &s->reqs[tag];
-}
-
 static void vscsi_decode_id_lun(uint64_t srp_lun, int *id, int *lun)
 {
     /* XXX Figure that one out properly ! This is crackpot */
@@ -454,7 +445,7 @@ static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req)
     if (n) {
         req->senselen = n;
         vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);
-        vscsi_put_req(s, req);
+        vscsi_put_req(req);
         return;
     }
 
@@ -483,7 +474,7 @@ static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req)
 static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)
 {
     VSCSIState *s = DO_UPCAST(VSCSIState, vdev.qdev, sreq->bus->qbus.parent);
-    vscsi_req *req = vscsi_find_req(s, sreq);
+    vscsi_req *req = sreq->hba_private;
     uint8_t *buf;
     int rc = 0;
 
@@ -531,7 +522,7 @@ static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)
 static void vscsi_command_complete(SCSIRequest *sreq, uint32_t status)
 {
     VSCSIState *s = DO_UPCAST(VSCSIState, vdev.qdev, sreq->bus->qbus.parent);
-    vscsi_req *req = vscsi_find_req(s, sreq);
+    vscsi_req *req = sreq->hba_private;
     int32_t res_in = 0, res_out = 0;
 
     dprintf("VSCSI: SCSI cmd complete, r=0x%x tag=0x%x status=0x%x, req=%p\n",
@@ -563,15 +554,14 @@ static void vscsi_command_complete(SCSIRequest *sreq, uint32_t status)
         }
     }
     vscsi_send_rsp(s, req, 0, res_in, res_out);
-    vscsi_put_req(s, req);
+    vscsi_put_req(req);
 }
 
 static void vscsi_request_cancelled(SCSIRequest *sreq)
 {
-    VSCSIState *s = DO_UPCAST(VSCSIState, vdev.qdev, sreq->bus->qbus.parent);
-    vscsi_req *req = vscsi_find_req(s, sreq);
+    vscsi_req *req = sreq->hba_private;
 
-    vscsi_put_req(s, req);
+    vscsi_put_req(req);
 }
 
 static void vscsi_process_login(VSCSIState *s, vscsi_req *req)
@@ -659,7 +649,7 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req)
     }
 
     req->lun = lun;
-    req->sreq = scsi_req_new(sdev, req->qtag, lun);
+    req->sreq = scsi_req_new(sdev, req->qtag, lun, req);
     n = scsi_req_enqueue(req->sreq, srp->cmd.cdb);
 
     dprintf("VSCSI: Queued command tag 0x%x CMD 0x%x ID %d LUN %d ret: %d\n",
@@ -858,7 +848,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
     }
 
     if (done) {
-        vscsi_put_req(s, req);
+        vscsi_put_req(req);
     }
 }
 
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 86582cc..bfea096 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -216,10 +216,6 @@ static void usb_msd_transfer_data(SCSIRequest *req, uint32_t len)
     MSDState *s = DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent);
     USBPacket *p = s->packet;
 
-    if (req->tag != s->tag) {
-        fprintf(stderr, "usb-msd: Unexpected SCSI Tag 0x%x\n", req->tag);
-    }
-
     assert((s->mode == USB_MSDM_DATAOUT) == (req->cmd.mode == SCSI_XFER_TO_DEV));
     s->scsi_len = len;
     s->scsi_buf = scsi_req_get_buf(req);
@@ -241,9 +237,6 @@ static void usb_msd_command_complete(SCSIRequest *req, uint32_t status)
     MSDState *s = DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent);
     USBPacket *p = s->packet;
 
-    if (req->tag != s->tag) {
-        fprintf(stderr, "usb-msd: Unexpected SCSI Tag 0x%x\n", req->tag);
-    }
     DPRINTF("Command complete %d\n", status);
     s->residue = s->data_len;
     s->result = status != 0;
@@ -387,7 +380,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
                     s->tag, cbw.flags, cbw.cmd_len, s->data_len);
             s->residue = 0;
             s->scsi_len = 0;
-            s->req = scsi_req_new(s->scsi_dev, s->tag, 0);
+            s->req = scsi_req_new(s->scsi_dev, s->tag, 0, NULL);
             scsi_req_enqueue(s->req, cbw.cmd);
             /* ??? Should check that USB and SCSI data transfer
                directions match.  */
-- 
1.7.6

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

* [Qemu-devel] [PATCH 22/23] qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm
  2011-07-20 10:34 [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 05/23] scsi: Add 'hba_private' to SCSIRequest Kevin Wolf
@ 2011-07-20 10:34 ` Kevin Wolf
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 23/23] Add missing documentation for qemu-img -p Kevin Wolf
  2011-07-22 10:48 ` [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-07-20 10:34 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

In snapshotting there is no guest involved, so we can safely use a writeback
mode and do the flushes in the right place (i.e. at the very end). This
improves the time that creating/restoring an internal snapshot takes with an
image in writethrough mode.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2-cache.c    |   12 ++++++++++++
 block/qcow2-refcount.c |   38 +++++++++++++++++++++++++++-----------
 block/qcow2.h          |    2 ++
 3 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index 3824739..8408847 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -312,3 +312,15 @@ found:
     c->entries[i].dirty = true;
 }
 
+bool qcow2_cache_set_writethrough(BlockDriverState *bs, Qcow2Cache *c,
+    bool enable)
+{
+    bool old = c->writethrough;
+
+    if (!old && enable) {
+        qcow2_cache_flush(bs, c);
+    }
+
+    c->writethrough = enable;
+    return old;
+}
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index ac95b88..14b2f67 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -705,8 +705,15 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
     BDRVQcowState *s = bs->opaque;
     uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, l1_allocated;
     int64_t old_offset, old_l2_offset;
-    int i, j, l1_modified, nb_csectors, refcount;
+    int i, j, l1_modified = 0, nb_csectors, refcount;
     int ret;
+    bool old_l2_writethrough, old_refcount_writethrough;
+
+    /* Switch caches to writeback mode during update */
+    old_l2_writethrough =
+        qcow2_cache_set_writethrough(bs, s->l2_table_cache, false);
+    old_refcount_writethrough =
+        qcow2_cache_set_writethrough(bs, s->refcount_block_cache, false);
 
     l2_table = NULL;
     l1_table = NULL;
@@ -720,7 +727,11 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
         l1_allocated = 1;
         if (bdrv_pread(bs->file, l1_table_offset,
                        l1_table, l1_size2) != l1_size2)
+        {
+            ret = -EIO;
             goto fail;
+        }
+
         for(i = 0;i < l1_size; i++)
             be64_to_cpus(&l1_table[i]);
     } else {
@@ -729,7 +740,6 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
         l1_allocated = 0;
     }
 
-    l1_modified = 0;
     for(i = 0; i < l1_size; i++) {
         l2_offset = l1_table[i];
         if (l2_offset) {
@@ -773,6 +783,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
                         }
 
                         if (refcount < 0) {
+                            ret = -EIO;
                             goto fail;
                         }
                     }
@@ -803,6 +814,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
                 refcount = get_refcount(bs, l2_offset >> s->cluster_bits);
             }
             if (refcount < 0) {
+                ret = -EIO;
                 goto fail;
             } else if (refcount == 1) {
                 l2_offset |= QCOW_OFLAG_COPIED;
@@ -813,6 +825,18 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
             }
         }
     }
+
+    ret = 0;
+fail:
+    if (l2_table) {
+        qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
+    }
+
+    /* Enable writethrough cache mode again */
+    qcow2_cache_set_writethrough(bs, s->l2_table_cache, old_l2_writethrough);
+    qcow2_cache_set_writethrough(bs, s->refcount_block_cache,
+        old_refcount_writethrough);
+
     if (l1_modified) {
         for(i = 0; i < l1_size; i++)
             cpu_to_be64s(&l1_table[i]);
@@ -824,15 +848,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
     }
     if (l1_allocated)
         qemu_free(l1_table);
-    return 0;
- fail:
-    if (l2_table) {
-        qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
-    }
-
-    if (l1_allocated)
-        qemu_free(l1_table);
-    return -EIO;
+    return ret;
 }
 
 
diff --git a/block/qcow2.h b/block/qcow2.h
index e1ae3e8..6a0a21b 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -228,6 +228,8 @@ int qcow2_read_snapshots(BlockDriverState *bs);
 Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables,
     bool writethrough);
 int qcow2_cache_destroy(BlockDriverState* bs, Qcow2Cache *c);
+bool qcow2_cache_set_writethrough(BlockDriverState *bs, Qcow2Cache *c,
+    bool enable);
 
 void qcow2_cache_entry_mark_dirty(Qcow2Cache *c, void *table);
 int qcow2_cache_flush(BlockDriverState *bs, Qcow2Cache *c);
-- 
1.7.6

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

* [Qemu-devel] [PATCH 23/23] Add missing documentation for qemu-img -p
  2011-07-20 10:34 [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 05/23] scsi: Add 'hba_private' to SCSIRequest Kevin Wolf
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 22/23] qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm Kevin Wolf
@ 2011-07-20 10:34 ` Kevin Wolf
  2011-07-22 10:48 ` [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-07-20 10:34 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

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

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img-cmds.hx |    4 ++--
 qemu-img.texi    |    6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index 2b70618..1299e83 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -30,7 +30,7 @@ ETEXI
 DEF("convert", img_convert,
     "convert [-c] [-p] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_name] filename [filename2 [...]] output_filename")
 STEXI
-@item convert [-c] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-p] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] @var{filename} [@var{filename2} [...]] @var{output_filename}
 ETEXI
 
 DEF("info", img_info,
@@ -48,7 +48,7 @@ ETEXI
 DEF("rebase", img_rebase,
     "rebase [-f fmt] [-t cache] [-p] [-u] -b backing_file [-F backing_fmt] filename")
 STEXI
-@item rebase [-f @var{fmt}] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
+@item rebase [-f @var{fmt}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
 ETEXI
 
 DEF("resize", img_resize,
diff --git a/qemu-img.texi b/qemu-img.texi
index 526474c..495a1b6 100644
--- a/qemu-img.texi
+++ b/qemu-img.texi
@@ -38,6 +38,8 @@ by the used format or see the format descriptions below for details.
 indicates that target image must be compressed (qcow format only)
 @item -h
 with or without a command shows help and lists the supported formats
+@item -p
+display progress bar (convert and rebase commands only)
 @end table
 
 Parameters to snapshot subcommand:
@@ -84,7 +86,7 @@ it doesn't need to be specified separately in this case.
 
 Commit the changes recorded in @var{filename} in its base image.
 
-@item convert [-c] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-p] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] @var{filename} [@var{filename2} [...]] @var{output_filename}
 
 Convert the disk image @var{filename} or a snapshot @var{snapshot_name} to disk image @var{output_filename}
 using format @var{output_fmt}. It can be optionally compressed (@code{-c}
@@ -114,7 +116,7 @@ they are displayed too.
 
 List, apply, create or delete snapshots in image @var{filename}.
 
-@item rebase [-f @var{fmt}] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
+@item rebase [-f @var{fmt}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
 
 Changes the backing file of an image. Only the formats @code{qcow2} and
 @code{qed} support changing the backing file.
-- 
1.7.6

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

* Re: [Qemu-devel] [PULL v2 00/23] Block patches
  2011-07-20 10:34 [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2011-07-20 10:34 ` [Qemu-devel] [PATCH 23/23] Add missing documentation for qemu-img -p Kevin Wolf
@ 2011-07-22 10:48 ` Kevin Wolf
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2011-07-22 10:48 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

Am 20.07.2011 12:34, schrieb Kevin Wolf:
> (Reposting only changed or new patches)
> 
> The following changes since commit 89b9ba661bd2d6155308f895ec075d813f0e129b:
> 
>   Fix signal handling of SIG_IPI when io-thread is enabled (2011-07-16 19:43:00 +0000)
> 
> are available in the git repository at:
>   git://repo.or.cz/qemu/kevin.git for-anthony
> 
> Devin Nakamura (2):
>       qemu-io: Fix formatting
>       qemu-io: Fix if scoping bug
> 
> Fam Zheng (12):
>       VMDK: introduce VmdkExtent
>       VMDK: bugfix, align offset to cluster in get_whole_cluster
>       VMDK: probe for monolithicFlat images
>       VMDK: separate vmdk_open by format version
>       VMDK: add field BDRVVmdkState.desc_offset
>       VMDK: flush multiple extents
>       VMDK: move 'static' cid_update flag to bs field
>       VMDK: change get_cluster_offset return type
>       VMDK: open/read/write for monolithicFlat image
>       VMDK: create different subformats
>       VMDK: fix coding style
>       block: add bdrv_get_allocated_file_size() operation
> 
> Hannes Reinecke (4):
>       iov: Update parameter usage in iov_(to|from)_buf()
>       scsi: Add 'hba_private' to SCSIRequest
>       scsi-disk: Fixup debugging statement
>       scsi-disk: Mask out serial number EVPD
> 
> Jes Sorensen (1):
>       Add missing documentation for qemu-img -p
> 
> Kevin Wolf (1):
>       qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm
> 
> Luiz Capitulino (2):
>       qemu-options.hx: Document missing -drive options
>       qemu-config: Document -drive options
> 
> MORITA Kazutaka (1):
>       sheepdog: add full data preallocation support
> 
>  block.c                |   19 +
>  block.h                |    1 +
>  block/qcow2-cache.c    |   12 +
>  block/qcow2-refcount.c |   38 +-
>  block/qcow2.h          |    2 +
>  block/raw-posix.c      |   21 +
>  block/raw-win32.c      |   29 +
>  block/sheepdog.c       |   71 ++-
>  block/vmdk.c           | 1297 ++++++++++++++++--------
>  block_int.h            |    2 +
>  hw/esp.c               |    2 +-
>  hw/lsi53c895a.c        |   22 +-
>  hw/scsi-bus.c          |    9 +-
>  hw/scsi-disk.c         |   21 +-
>  hw/scsi-generic.c      |    5 +-
>  hw/scsi.h              |   10 +-
>  hw/spapr_vscsi.c       |   28 +-
>  hw/usb-msd.c           |    9 +-
>  hw/virtio-net.c        |    2 +-
>  hw/virtio-serial-bus.c |    2 +-
>  iov.c                  |   49 +-
>  iov.h                  |   10 +-
>  qemu-config.c          |    6 +
>  qemu-img-cmds.hx       |    4 +-
>  qemu-img.c             |   31 +-
>  qemu-img.texi          |    6 +-
>  qemu-io.c              | 2653 ++++++++++++++++++++++++------------------------
>  qemu-options.hx        |    8 +
>  28 files changed, 2509 insertions(+), 1860 deletions(-)

Ping?

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

* [Qemu-devel] [PULL v2 00/23] Block patches
@ 2017-12-19 15:11 Stefan Hajnoczi
  2017-12-20 13:20 ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2017-12-19 15:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

The following changes since commit eaefea537b476cb853e2edbdc68e969ec777e4bb:

  Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging (2017-12-18 14:17:42 +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 7a9dda0d7f9831c2432620dcfefdadbb7ae888dc:

  qemu-iotests: add 203 savevm with IOThreads test (2017-12-19 10:25:09 +0000)

----------------------------------------------------------------
Pull request

v2:
 * Fixed incorrect virtio_blk_data_plane_create() local_err refactoring in
   "hw/block: Use errp directly rather than local_err" that broke virtio-blk
   over virtio-mmio [Peter]

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

Mao Zhongyi (4):
  hw/block/nvme: Convert to realize
  hw/block: Fix the return type
  hw/block: Use errp directly rather than local_err
  dev-storage: Fix the unusual function name

Mark Kanda (2):
  virtio-blk: make queue size configurable
  virtio-blk: reject configs with logical block size > physical block
    size

Paolo Bonzini (1):
  block: avoid recursive AioContext acquire in bdrv_inactivate_all()

Stefan Hajnoczi (16):
  coroutine: simplify co_aio_sleep_ns() prototype
  qdev: drop unused #include "sysemu/iothread.h"
  blockdev: hold AioContext for bdrv_unref() in
    external_snapshot_clean()
  block: don't keep AioContext acquired after
    external_snapshot_prepare()
  block: don't keep AioContext acquired after drive_backup_prepare()
  block: don't keep AioContext acquired after blockdev_backup_prepare()
  block: don't keep AioContext acquired after
    internal_snapshot_prepare()
  block: drop unused BlockDirtyBitmapState->aio_context field
  iothread: add iothread_by_id() API
  blockdev: add x-blockdev-set-iothread testing command
  qemu-iotests: add 202 external snapshots IOThread test
  docs: mark nested AioContext locking as a legacy API
  blockdev: add x-blockdev-set-iothread force boolean
  iotests: add VM.add_object()
  iothread: fix iothread_stop() race condition
  qemu-iotests: add 203 savevm with IOThreads test

 docs/devel/multiple-iothreads.txt |   7 +-
 qapi/block-core.json              |  40 ++++++
 hw/block/dataplane/virtio-blk.h   |   2 +-
 include/hw/block/block.h          |   4 +-
 include/hw/virtio/virtio-blk.h    |   1 +
 include/qemu/coroutine.h          |   6 +-
 include/sysemu/iothread.h         |   4 +-
 block.c                           |  14 ++-
 block/null.c                      |   3 +-
 block/sheepdog.c                  |   3 +-
 blockdev.c                        | 259 +++++++++++++++++++++++++++-----------
 hw/block/block.c                  |  15 ++-
 hw/block/dataplane/virtio-blk.c   |  12 +-
 hw/block/fdc.c                    |  17 +--
 hw/block/nvme.c                   |  23 ++--
 hw/block/virtio-blk.c             |  30 +++--
 hw/core/qdev-properties-system.c  |   1 -
 hw/ide/qdev.c                     |  12 +-
 hw/scsi/scsi-disk.c               |  13 +-
 hw/usb/dev-storage.c              |  29 ++---
 iothread.c                        |  27 +++-
 util/qemu-coroutine-sleep.c       |   4 +-
 tests/qemu-iotests/202            |  95 ++++++++++++++
 tests/qemu-iotests/202.out        |  11 ++
 tests/qemu-iotests/203            |  59 +++++++++
 tests/qemu-iotests/203.out        |   6 +
 tests/qemu-iotests/group          |   2 +
 tests/qemu-iotests/iotests.py     |   5 +
 28 files changed, 531 insertions(+), 173 deletions(-)
 create mode 100755 tests/qemu-iotests/202
 create mode 100644 tests/qemu-iotests/202.out
 create mode 100755 tests/qemu-iotests/203
 create mode 100644 tests/qemu-iotests/203.out

-- 
2.14.3

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

* Re: [Qemu-devel] [PULL v2 00/23] Block patches
  2017-12-19 15:11 Stefan Hajnoczi
@ 2017-12-20 13:20 ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2017-12-20 13:20 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 19 December 2017 at 15:11, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit eaefea537b476cb853e2edbdc68e969ec777e4bb:
>
>   Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging (2017-12-18 14:17:42 +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 7a9dda0d7f9831c2432620dcfefdadbb7ae888dc:
>
>   qemu-iotests: add 203 savevm with IOThreads test (2017-12-19 10:25:09 +0000)
>
> ----------------------------------------------------------------
> Pull request
>
> v2:
>  * Fixed incorrect virtio_blk_data_plane_create() local_err refactoring in
>    "hw/block: Use errp directly rather than local_err" that broke virtio-blk
>    over virtio-mmio [Peter]
>

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2017-12-20 13:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20 10:34 [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
2011-07-20 10:34 ` [Qemu-devel] [PATCH 05/23] scsi: Add 'hba_private' to SCSIRequest Kevin Wolf
2011-07-20 10:34 ` [Qemu-devel] [PATCH 22/23] qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm Kevin Wolf
2011-07-20 10:34 ` [Qemu-devel] [PATCH 23/23] Add missing documentation for qemu-img -p Kevin Wolf
2011-07-22 10:48 ` [Qemu-devel] [PULL v2 00/23] Block patches Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2017-12-19 15:11 Stefan Hajnoczi
2017-12-20 13:20 ` Peter Maydell

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