From patchwork Wed Jun 5 13:17:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 249044 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E5F4E2C00A0 for ; Wed, 5 Jun 2013 23:18:48 +1000 (EST) Received: from localhost ([::1]:39938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDby-0001bf-Uo for incoming@patchwork.ozlabs.org; Wed, 05 Jun 2013 09:18:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDbP-0001Wy-RY for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkDbJ-0000rB-Uo for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:18:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDbJ-0000r4-MN for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:18:05 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r55DI5E6022860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Jun 2013 09:18:05 -0400 Received: from dhcp-200-207.str.redhat.com (dhcp-192-246.str.redhat.com [10.33.192.246]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r55DI2A4025881; Wed, 5 Jun 2013 09:18:04 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2013 15:17:55 +0200 Message-Id: <1370438278-1703-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1370438278-1703-1-git-send-email-kwolf@redhat.com> References: <1370438278-1703-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, afaerber@suse.de, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2 1/4] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events 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 Signed-off-by: Kevin Wolf --- block.c | 8 ++++---- block/blkdebug.c | 3 +++ include/block/block.h | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 3f616de..79ad33d 100644 --- a/block.c +++ b/block.c @@ -3186,13 +3186,11 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf, void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event) { - BlockDriver *drv = bs->drv; - - if (!drv || !drv->bdrv_debug_event) { + if (!bs || !bs->drv || !bs->drv->bdrv_debug_event) { return; } - drv->bdrv_debug_event(bs, event); + bs->drv->bdrv_debug_event(bs, event); } int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, @@ -4024,6 +4022,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) } /* Write back cached data to the OS even with cache=unsafe */ + BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS); if (bs->drv->bdrv_co_flush_to_os) { ret = bs->drv->bdrv_co_flush_to_os(bs); if (ret < 0) { @@ -4036,6 +4035,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) goto flush_parent; } + BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK); if (bs->drv->bdrv_co_flush_to_disk) { ret = bs->drv->bdrv_co_flush_to_disk(bs); } else if (bs->drv->bdrv_aio_flush) { diff --git a/block/blkdebug.c b/block/blkdebug.c index 71f99e4..ccb627a 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -182,6 +182,9 @@ static const char *event_names[BLKDBG_EVENT_MAX] = { [BLKDBG_CLUSTER_ALLOC] = "cluster_alloc", [BLKDBG_CLUSTER_ALLOC_BYTES] = "cluster_alloc_bytes", [BLKDBG_CLUSTER_FREE] = "cluster_free", + + [BLKDBG_FLUSH_TO_OS] = "flush_to_os", + [BLKDBG_FLUSH_TO_DISK] = "flush_to_disk", }; static int get_event_by_name(const char *name, BlkDebugEvent *event) diff --git a/include/block/block.h b/include/block/block.h index dc5b388..2307f67 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -424,6 +424,9 @@ typedef enum { BLKDBG_CLUSTER_ALLOC_BYTES, BLKDBG_CLUSTER_FREE, + BLKDBG_FLUSH_TO_OS, + BLKDBG_FLUSH_TO_DISK, + BLKDBG_EVENT_MAX, } BlkDebugEvent;