From patchwork Tue Oct 20 05:17:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 532794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9358014018C for ; Tue, 20 Oct 2015 16:49:08 +1100 (AEDT) Received: from localhost ([::1]:43903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoPnG-0008DC-H8 for incoming@patchwork.ozlabs.org; Tue, 20 Oct 2015 01:49:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoPJ5-0003Gr-VZ for qemu-devel@nongnu.org; Tue, 20 Oct 2015 01:17:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoPJ5-00069Q-3x for qemu-devel@nongnu.org; Tue, 20 Oct 2015 01:17:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoPJ2-00068M-MR; Tue, 20 Oct 2015 01:17:52 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 463FE2E2424; Tue, 20 Oct 2015 05:17:52 +0000 (UTC) Received: from fam-t430.nay.redhat.com. (dhcp-14-147.nay.redhat.com [10.66.14.147]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9K5H4Rp019373; Tue, 20 Oct 2015 01:17:49 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 20 Oct 2015 13:17:02 +0800 Message-Id: <1445318223-30055-12-git-send-email-famz@redhat.com> In-Reply-To: <1445318223-30055-1-git-send-email-famz@redhat.com> References: <1445318223-30055-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Subject: [Qemu-devel] [PATCH v4 11/12] qed: Implement .bdrv_drain X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The "need_check_timer" is used to clear the "NEED_CHECK" flag in the image header after a grace period once metadata update has finished. In compliance to the bdrv_drain semantics we should make sure it remains deleted once .bdrv_drain is called. Call the qed_need_check_timer_cb manually to update the header immediately. Signed-off-by: Fam Zheng --- block/qed.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block/qed.c b/block/qed.c index 5ea05d4..e9dcb4d 100644 --- a/block/qed.c +++ b/block/qed.c @@ -375,6 +375,12 @@ static void bdrv_qed_attach_aio_context(BlockDriverState *bs, } } +static void bdrv_qed_drain(BlockDriverState *bs) +{ + qed_cancel_need_check_timer(bs->opaque); + qed_need_check_timer_cb(bs->opaque); +} + static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -1676,6 +1682,7 @@ static BlockDriver bdrv_qed = { .bdrv_check = bdrv_qed_check, .bdrv_detach_aio_context = bdrv_qed_detach_aio_context, .bdrv_attach_aio_context = bdrv_qed_attach_aio_context, + .bdrv_drain = bdrv_qed_drain, }; static void bdrv_qed_init(void)