From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhznw-0006xd-BO for qemu-devel@nongnu.org; Fri, 02 Oct 2015 08:51:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhznt-0003Oy-3z for qemu-devel@nongnu.org; Fri, 02 Oct 2015 08:51:16 -0400 From: Kevin Wolf Date: Fri, 2 Oct 2015 14:50:57 +0200 Message-Id: <1443790258-23305-5-git-send-email-kwolf@redhat.com> In-Reply-To: <1443790258-23305-1-git-send-email-kwolf@redhat.com> References: <1443790258-23305-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 4/5] block: disable I/O limits at the beginning of bdrv_close() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Alberto Garcia Disabling I/O limits from a BDS also drains all pending throttled requests, so it should be done at the beginning of bdrv_close() with the rest of the bdrv_drain() calls before the BlockDriver is closed. Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 6268e37..1f90b47 100644 --- a/block.c +++ b/block.c @@ -1907,6 +1907,12 @@ void bdrv_close(BlockDriverState *bs) if (bs->job) { block_job_cancel_sync(bs->job); } + + /* Disable I/O limits and drain all pending throttled requests */ + if (bs->io_limits_enabled) { + bdrv_io_limits_disable(bs); + } + bdrv_drain(bs); /* complete I/O */ bdrv_flush(bs); bdrv_drain(bs); /* in case flush left pending I/O */ @@ -1958,11 +1964,6 @@ void bdrv_close(BlockDriverState *bs) blk_dev_change_media_cb(bs->blk, false); } - /*throttling disk I/O limits*/ - if (bs->io_limits_enabled) { - bdrv_io_limits_disable(bs); - } - QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) { g_free(ban); } -- 1.8.3.1