From patchwork Tue Jul 5 15:50:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 644921 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 3rkVw70p9Jz9sXy for ; Wed, 6 Jul 2016 03:18:31 +1000 (AEST) Received: from localhost ([::1]:56481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKTzQ-0005ve-Ut for incoming@patchwork.ozlabs.org; Tue, 05 Jul 2016 13:18:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSdT-0001HE-Md for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSdS-0006fZ-Ok for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSdQ-0006eG-DA; Tue, 05 Jul 2016 11:51:40 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E89653B741; Tue, 5 Jul 2016 15:51:39 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u65Fp6fc006758; Tue, 5 Jul 2016 11:51:39 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 5 Jul 2016 17:50:36 +0200 Message-Id: <1467733852-27097-28-git-send-email-kwolf@redhat.com> In-Reply-To: <1467733852-27097-1-git-send-email-kwolf@redhat.com> References: <1467733852-27097-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 05 Jul 2016 15:51:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 27/43] blkreplay: Convert to byte-based I/O X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The blkreplay driver only forwards the requests it gets, so converting it to byte granularity is trivial. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Acked-by: Stefan Hajnoczi --- block/blkreplay.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/block/blkreplay.c b/block/blkreplay.c index 525c2d5..196b8d0 100755 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -81,22 +81,22 @@ static void block_request_create(uint64_t reqid, BlockDriverState *bs, replay_block_event(req->bh, reqid); } -static int coroutine_fn blkreplay_co_readv(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) +static int coroutine_fn blkreplay_co_preadv(BlockDriverState *bs, + uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; - int ret = bdrv_co_readv(bs->file->bs, sector_num, nb_sectors, qiov); + int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; } -static int coroutine_fn blkreplay_co_writev(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) +static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs, + uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; - int ret = bdrv_co_writev(bs->file->bs, sector_num, nb_sectors, qiov); + int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); @@ -144,8 +144,8 @@ static BlockDriver bdrv_blkreplay = { .bdrv_close = blkreplay_close, .bdrv_getlength = blkreplay_getlength, - .bdrv_co_readv = blkreplay_co_readv, - .bdrv_co_writev = blkreplay_co_writev, + .bdrv_co_preadv = blkreplay_co_preadv, + .bdrv_co_pwritev = blkreplay_co_pwritev, .bdrv_co_pwrite_zeroes = blkreplay_co_pwrite_zeroes, .bdrv_co_discard = blkreplay_co_discard,