Patchwork [v4,0/4] Drive mirroring performance improvements

login
register
mail settings
Submitter Paolo Bonzini
Date Jan. 22, 2013, 8:03 a.m.
Message ID <1358841795-24478-1-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/214425/
State New
Headers show

Comments

Paolo Bonzini - Jan. 22, 2013, 8:03 a.m.
Here are the remaining patches.  Interdiff at the end of this cover
letter.

Thanks,

Paolo

Paolo Bonzini (4):
  mirror: switch mirror_iteration to AIO
  mirror: add buf-size argument to drive-mirror
  mirror: support more than one in-flight AIO operation
  mirror: support arbitrarily-sized iterations

 block/mirror.c             | 326 ++++++++++++++++++++++++++++++++++++---------
 blockdev.c                 |   9 +-
 hmp.c                      |   2 +-
 include/block/block_int.h  |   5 +-
 qapi-schema.json           |   5 +-
 qmp-commands.hx            |   4 +-
 tests/qemu-iotests/041     |  31 +++++
 tests/qemu-iotests/041.out |   4 +-
 trace-events               |   5 +
 9 files changed, 321 insertions(+), 70 deletions(-)
Kevin Wolf - Jan. 22, 2013, 9:27 a.m.
Am 22.01.2013 09:03, schrieb Paolo Bonzini:
> Here are the remaining patches.  Interdiff at the end of this cover
> letter.
> 
> Thanks,
> 
> Paolo
> 
> Paolo Bonzini (4):
>   mirror: switch mirror_iteration to AIO
>   mirror: add buf-size argument to drive-mirror
>   mirror: support more than one in-flight AIO operation
>   mirror: support arbitrarily-sized iterations
> 
>  block/mirror.c             | 326 ++++++++++++++++++++++++++++++++++++---------
>  blockdev.c                 |   9 +-
>  hmp.c                      |   2 +-
>  include/block/block_int.h  |   5 +-
>  qapi-schema.json           |   5 +-
>  qmp-commands.hx            |   4 +-
>  tests/qemu-iotests/041     |  31 +++++
>  tests/qemu-iotests/041.out |   4 +-
>  trace-events               |   5 +
>  9 files changed, 321 insertions(+), 70 deletions(-)

Thanks, applied all to the block branch.

Kevin

Patch

diff --git a/block/mirror.c b/block/mirror.c
index 59df89c..9347533 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -69,13 +69,15 @@  static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read,
     }
 }
 
-static void mirror_iteration_done(MirrorOp *op)
+static void mirror_iteration_done(MirrorOp *op, int ret)
 {
     MirrorBlockJob *s = op->s;
     struct iovec *iov;
     int64_t chunk_num;
     int i, nb_chunks, sectors_per_chunk;
 
+    trace_mirror_iteration_done(s, op->sector_num, op->nb_sectors, ret);
+
     s->in_flight--;
     iov = op->qiov.iov;
     for (i = 0; i < op->qiov.niov; i++) {
@@ -88,11 +90,10 @@  static void mirror_iteration_done(MirrorOp *op)
     chunk_num = op->sector_num / sectors_per_chunk;
     nb_chunks = op->nb_sectors / sectors_per_chunk;
     bitmap_clear(s->in_flight_bitmap, chunk_num, nb_chunks);
-    if (s->cow_bitmap) {
+    if (s->cow_bitmap && ret >= 0) {
         bitmap_set(s->cow_bitmap, chunk_num, nb_chunks);
     }
 
-    trace_mirror_iteration_done(s, op->sector_num, op->nb_sectors);
     g_slice_free(MirrorOp, op);
     qemu_coroutine_enter(s->common.co, NULL);
 }
@@ -111,7 +112,7 @@  static void mirror_write_complete(void *opaque, int ret)
             s->ret = ret;
         }
     }
-    mirror_iteration_done(op);
+    mirror_iteration_done(op, ret);
 }
 
 static void mirror_read_complete(void *opaque, int ret)
@@ -128,7 +129,7 @@  static void mirror_read_complete(void *opaque, int ret)
             s->ret = ret;
         }
 
-        mirror_iteration_done(op);
+        mirror_iteration_done(op, ret);
         return;
     }
     bdrv_aio_writev(s->target, op->sector_num, &op->qiov, op->nb_sectors,
diff --git a/trace-events b/trace-events
index 9d9860c..64d67f9 100644
--- a/trace-events
+++ b/trace-events
@@ -85,7 +85,7 @@  mirror_before_drain(void *s, int64_t cnt) "s %p dirty count %"PRId64
 mirror_before_sleep(void *s, int64_t cnt, int synced) "s %p dirty count %"PRId64" synced %d"
 mirror_one_iteration(void *s, int64_t sector_num, int nb_sectors) "s %p sector_num %"PRId64" nb_sectors %d"
 mirror_cow(void *s, int64_t sector_num) "s %p sector_num %"PRId64
-mirror_iteration_done(void *s, int64_t sector_num, int nb_sectors) "s %p sector_num %"PRId64" nb_sectors %d"
+mirror_iteration_done(void *s, int64_t sector_num, int nb_sectors, int ret) "s %p sector_num %"PRId64" nb_sectors %d ret %d"
 mirror_yield(void *s, int64_t cnt, int buf_free_count, int in_flight) "s %p dirty count %"PRId64" free buffers %d in_flight %d"
 mirror_yield_in_flight(void *s, int64_t sector_num, int in_flight) "s %p sector_num %"PRId64" in_flight %d"
 mirror_yield_buf_busy(void *s, int nb_chunks, int in_flight) "s %p requested chunks %d in_flight %d"