]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
mirror: Use DIV_ROUND_UP
authorFam Zheng <famz@redhat.com>
Mon, 28 Apr 2014 02:59:28 +0000 (10:59 +0800)
committerKevin Wolf <kwolf@redhat.com>
Mon, 28 Apr 2014 15:36:30 +0000 (17:36 +0200)
Although bdrv_getlength() was just called above this, and checked for
error, it is better to just use the value we already get, and use
DIV_ROUND_UP.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c

index 36f4f8e8bd86479f4db0ee93a5511d43f346daec..95366adb3a553e6da582d33daf4c1faf4f300622 100644 (file)
@@ -329,7 +329,7 @@ static void coroutine_fn mirror_run(void *opaque)
         return;
     }
 
-    length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
+    length = DIV_ROUND_UP(s->common.len, s->granularity);
     s->in_flight_bitmap = bitmap_new(length);
 
     /* If we have no backing file yet in the destination, we cannot let