qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] mirror: improve io performance


From: arei.gonglei
Subject: [Qemu-devel] [PATCH] mirror: improve io performance
Date: Fri, 22 Aug 2014 16:17:57 +0800

From: ChenLiang <address@hidden>

Mirror buffer is split into two pieces to improve io performance.
In this way, one piece of buffer can read data from source disk
when another one is writing data to dest disk.

previous:
io bandwidth: 41MB/s
migration time: 8min15s

now:
io bandwidth: 67MB/s
migration time: 5min3s

The size of vm image is 20G.

Signed-off-by: ChenLiang <address@hidden>
Signed-off-by: Gonglei  <address@hidden>
---
 block/mirror.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/mirror.c b/block/mirror.c
index 5e7a166..6596e92 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -51,6 +51,7 @@ typedef struct MirrorBlockJob {
     uint8_t *buf;
     QSIMPLEQ_HEAD(, MirrorBuffer) buf_free;
     int buf_free_count;
+    int buf_total_count;
 
     unsigned long *in_flight_bitmap;
     int in_flight;
@@ -238,6 +239,10 @@ static uint64_t coroutine_fn 
mirror_iteration(MirrorBlockJob *s)
             break;
         }
 
+        if (s->buf_total_count / 2 < nb_chunks + added_chunks) {
+            break;
+        }
+
         /* We have enough free space to copy these sectors.  */
         bitmap_set(s->in_flight_bitmap, next_chunk, added_chunks);
 
@@ -307,6 +312,7 @@ static void mirror_free_init(MirrorBlockJob *s)
         buf_size -= granularity;
         buf += granularity;
     }
+    s->buf_total_count = s->buf_free_count;
 }
 
 static void mirror_drain(MirrorBlockJob *s)
-- 
1.7.12.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]