Patchwork [RFC,3/4] block: drop duplicated slice extension code

login
register
mail settings
Submitter Stefan Hajnoczi
Date March 21, 2013, 2:49 p.m.
Message ID <1363877399-16339-4-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/229721/
State New
Headers show

Comments

Stefan Hajnoczi - March 21, 2013, 2:49 p.m.
The current slice is extended when an I/O request exceeds the limit.
There is no need to extend the slice every time we check a request.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Patch

diff --git a/block.c b/block.c
index 712f544..fed3b4d 100644
--- a/block.c
+++ b/block.c
@@ -3766,10 +3766,7 @@  static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors,
     int      bps_ret, iops_ret;
 
     now = qemu_get_clock_ns(vm_clock);
-    if ((bs->slice_start < now)
-        && (bs->slice_end > now)) {
-        bs->slice_end = now + BLOCK_IO_SLICE_TIME;
-    } else {
+    if (now > bs->slice_end) {
         bs->slice_start = now;
         bs->slice_end   = now + BLOCK_IO_SLICE_TIME;
         memset(&bs->slice_submitted, 0, sizeof(bs->slice_submitted));