From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCqDt-0007Mg-39 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 11:25:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCqDr-0003Uv-Vq for qemu-devel@nongnu.org; Tue, 14 Jun 2016 11:25:49 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:34244 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCqDr-0003UU-JG for qemu-devel@nongnu.org; Tue, 14 Jun 2016 11:25:47 -0400 From: "Denis V. Lunev" Date: Tue, 14 Jun 2016 18:25:13 +0300 Message-Id: <1465917916-22348-7-git-send-email-den@openvz.org> In-Reply-To: <1465917916-22348-1-git-send-email-den@openvz.org> References: <1465917916-22348-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 6/9] block: pass qiov into before_write notifier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: vsementsov@virtuozzo.com, "Denis V. Lunev" , Stefan Hajnoczi , Fam Zheng , Kevin Wolf , Max Reitz , Jeff Cody , Eric Blake Signed-off-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy CC: Stefan Hajnoczi CC: Fam Zheng CC: Kevin Wolf CC: Max Reitz CC: Jeff Cody CC: Eric Blake --- block/io.c | 12 +++++++----- include/block/block_int.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/block/io.c b/block/io.c index 2d832aa..d2ad09c 100644 --- a/block/io.c +++ b/block/io.c @@ -368,12 +368,14 @@ static void tracked_request_end(BdrvTrackedRequest *req) */ static void tracked_request_begin(BdrvTrackedRequest *req, BlockDriverState *bs, + QEMUIOVector *qiov, int64_t offset, unsigned int bytes, enum BdrvTrackedRequestType type) { *req = (BdrvTrackedRequest){ .bs = bs, + .qiov = qiov, .offset = offset, .bytes = bytes, .type = type, @@ -1073,7 +1075,7 @@ int coroutine_fn bdrv_co_preadv(BlockDriverState *bs, bytes = ROUND_UP(bytes, align); } - tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ); + tracked_request_begin(&req, bs, NULL, offset, bytes, BDRV_TRACKED_READ); ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align, use_local_qiov ? &local_qiov : qiov, flags); @@ -1391,7 +1393,7 @@ int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs, * Pad qiov with the read parts and be sure to have a tracked request not * only for bdrv_aligned_pwritev, but also for the reads of the RMW cycle. */ - tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_WRITE); + tracked_request_begin(&req, bs, qiov, offset, bytes, BDRV_TRACKED_WRITE); if (!qiov) { ret = bdrv_co_do_zero_pwritev(bs, offset, bytes, flags, &req); @@ -2098,7 +2100,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) return 0; } - tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH); + tracked_request_begin(&req, bs, NULL, 0, 0, BDRV_TRACKED_FLUSH); /* Write back all layers by calling one driver function */ if (bs->drv->bdrv_co_flush) { @@ -2228,7 +2230,7 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, return 0; } - tracked_request_begin(&req, bs, sector_num, nb_sectors, + tracked_request_begin(&req, bs, NULL, sector_num, nb_sectors, BDRV_TRACKED_DISCARD); bdrv_set_dirty(bs, sector_num, nb_sectors); @@ -2331,7 +2333,7 @@ static int bdrv_co_do_ioctl(BlockDriverState *bs, int req, void *buf) }; BlockAIOCB *acb; - tracked_request_begin(&tracked_req, bs, 0, 0, BDRV_TRACKED_IOCTL); + tracked_request_begin(&tracked_req, bs, NULL, 0, 0, BDRV_TRACKED_IOCTL); if (!drv || !drv->bdrv_aio_ioctl) { co.ret = -ENOTSUP; goto out; diff --git a/include/block/block_int.h b/include/block/block_int.h index 30a9717..72f463a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -69,6 +69,7 @@ enum BdrvTrackedRequestType { typedef struct BdrvTrackedRequest { BlockDriverState *bs; + QEMUIOVector *qiov; int64_t offset; unsigned int bytes; enum BdrvTrackedRequestType type; -- 2.5.0