From patchwork Wed Apr 15 09:27:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 461437 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 7D3F41401E7 for ; Wed, 15 Apr 2015 19:28:01 +1000 (AEST) Received: from localhost ([::1]:59399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiJbz-0007aJ-Me for incoming@patchwork.ozlabs.org; Wed, 15 Apr 2015 05:27:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiJbd-00073x-T7 for qemu-devel@nongnu.org; Wed, 15 Apr 2015 05:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YiJbd-0000qY-0Z for qemu-devel@nongnu.org; Wed, 15 Apr 2015 05:27:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiJbY-0000oz-3s; Wed, 15 Apr 2015 05:27:32 -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 (8.14.4/8.14.4) with ESMTP id t3F9RVSM025081 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 15 Apr 2015 05:27:31 -0400 Received: from noname.redhat.com (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3F9RRAv009721; Wed, 15 Apr 2015 05:27:30 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 15 Apr 2015 11:27:25 +0200 Message-Id: <1429090046-6359-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1429090046-6359-1-git-send-email-kwolf@redhat.com> References: <1429090046-6359-1-git-send-email-kwolf@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, jcody@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate() 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 This is, amongst others, required for qemu-iotests 033 to run as intended on VHDX, which uses explicit bdrv_truncate() calls to bs->file when allocating new blocks. Signed-off-by: Kevin Wolf Reviewed-by: Jeff Cody --- block/blkdebug.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/blkdebug.c b/block/blkdebug.c index 63611e0..3c30edb 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -721,6 +721,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs) return bdrv_getlength(bs->file); } +static int blkdebug_truncate(BlockDriverState *bs, int64_t offset) +{ + return bdrv_truncate(bs->file, offset); +} + static void blkdebug_refresh_filename(BlockDriverState *bs) { QDict *opts; @@ -779,6 +784,7 @@ static BlockDriver bdrv_blkdebug = { .bdrv_file_open = blkdebug_open, .bdrv_close = blkdebug_close, .bdrv_getlength = blkdebug_getlength, + .bdrv_truncate = blkdebug_truncate, .bdrv_refresh_filename = blkdebug_refresh_filename, .bdrv_aio_readv = blkdebug_aio_readv,