diff mbox

drive-mirror: Change the amount of data base on granularity

Message ID 530B4AF8.9000605@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Feb. 24, 2014, 1:36 p.m. UTC
Il 24/02/2014 14:20, Stefan Hajnoczi ha scritto:
>> Now, I change the amount of data in an iteration, it base on
>> granularity. We can set the granularity to 1M,so it can send
>> 
>> 10 times read request, and then send write request. Once a write
>> request is done, it will have 1M free buffer to send next read
>> request.
>> 
>> So this way can allow read/write to be parallelized.

This also means that in the dirty phase you have to send chunks of 1M 
instead of say 64K.  64K is a common value of the granularity.

Try plotting the I/O rate against the granularity, you'll see that you
will not get top utilization at 10M, but you will not get it at 64K
either.  What you need is probably as simple as this:

$ git diff block/mirror.c

for some value of MAX_SECTORS_PER_MIRROR_OP.  You will need to run
some benchmarks in order to find the right value.

Paolo
diff mbox

Patch

diff --git a/block/mirror.c b/block/mirror.c
index e683959..66093da 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -231,7 +231,7 @@  static void coroutine_fn mirror_iteration(MirrorBlockJob *s)
         nb_chunks += added_chunks;
         next_sector += added_sectors;
         next_chunk += added_chunks;
-    } while (next_sector < end);
+    } while (nb_sectors < MAX_SECTORS_PER_MIRROR_OP && next_sector < end);
 
     /* Allocate a MirrorOp that is used as an AIO callback.  */
     op = g_slice_new(MirrorOp);