From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RERb9-0007HG-M8 for qemu-devel@nongnu.org; Thu, 13 Oct 2011 16:09:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RERb8-0002P4-Hu for qemu-devel@nongnu.org; Thu, 13 Oct 2011 16:09:47 -0400 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:40374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RERb8-0002Of-AM for qemu-devel@nongnu.org; Thu, 13 Oct 2011 16:09:46 -0400 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p9DK9jwt001350 for ; Thu, 13 Oct 2011 20:09:45 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9DK9jsD2510854 for ; Thu, 13 Oct 2011 21:09:45 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9DK9j31005402 for ; Thu, 13 Oct 2011 14:09:45 -0600 From: Stefan Hajnoczi Date: Thu, 13 Oct 2011 21:09:30 +0100 Message-Id: <1318536572-23771-4-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1318536572-23771-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1318536572-23771-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 3/5] block: use coroutine interface for raw format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi The raw format delegates all operations to bs->file (the protocol). Previously this block driver exposed both sync and aio interfaces. Since the block layer now works in terms of coroutines, expose the coroutine interfaces and drop the others. This avoids unnecessary emulation of sync and aio interfaces. Signed-off-by: Stefan Hajnoczi --- block/raw.c | 32 ++++++++------------------------ 1 files changed, 8 insertions(+), 24 deletions(-) diff --git a/block/raw.c b/block/raw.c index 63cf2d3..5ca606b 100644 --- a/block/raw.c +++ b/block/raw.c @@ -9,30 +9,16 @@ static int raw_open(BlockDriverState *bs, int flags) return 0; } -static int raw_read(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) +static int coroutine_fn raw_co_readv(BlockDriverState *bs, int64_t sector_num, + int nb_sectors, QEMUIOVector *qiov) { - return bdrv_read(bs->file, sector_num, buf, nb_sectors); + return bdrv_co_readv(bs->file, sector_num, nb_sectors, qiov); } -static int raw_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) +static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t sector_num, + int nb_sectors, QEMUIOVector *qiov) { - return bdrv_write(bs->file, sector_num, buf, nb_sectors); -} - -static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque); -} - -static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, - int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque); + return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov); } static void raw_close(BlockDriverState *bs) @@ -129,15 +115,13 @@ static BlockDriver bdrv_raw = { .bdrv_open = raw_open, .bdrv_close = raw_close, - .bdrv_read = raw_read, - .bdrv_write = raw_write, + .bdrv_co_readv = raw_co_readv, + .bdrv_co_writev = raw_co_writev, .bdrv_flush = raw_flush, .bdrv_probe = raw_probe, .bdrv_getlength = raw_getlength, .bdrv_truncate = raw_truncate, - .bdrv_aio_readv = raw_aio_readv, - .bdrv_aio_writev = raw_aio_writev, .bdrv_aio_flush = raw_aio_flush, .bdrv_discard = raw_discard, -- 1.7.6.3