|
|
9ae3a8 |
From 566788cb4c4f066daf10354edd8d9d497bb0043c Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <566788cb4c4f066daf10354edd8d9d497bb0043c.1389014116.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 9 Dec 2013 14:09:12 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 24/50] block: add flags to BlockRequest
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1386598178-11845-27-git-send-email-pbonzini@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56063
|
|
|
9ae3a8 |
O-Subject: [RHEL 7.0 qemu-kvm PATCH 26/52] block: add flags to BlockRequest
|
|
|
9ae3a8 |
Bugzilla: 1007815
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This lets bdrv_co_do_rw receive flags, so that it can be used for
|
|
|
9ae3a8 |
zero writes.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Peter Lieven <pl@kamp.de>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit d20d9b7c6723d0123b7d60dd5557aa0a6599f471)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block.c | 17 +++++++++++------
|
|
|
9ae3a8 |
include/block/block.h | 1 +
|
|
|
9ae3a8 |
2 files changed, 12 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block.c | 17 +++++++++++------
|
|
|
9ae3a8 |
include/block/block.h | 1 +
|
|
|
9ae3a8 |
2 files changed, 12 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block.c b/block.c
|
|
|
9ae3a8 |
index 8dfc207..1f70913 100644
|
|
|
9ae3a8 |
--- a/block.c
|
|
|
9ae3a8 |
+++ b/block.c
|
|
|
9ae3a8 |
@@ -74,6 +74,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
|
|
|
9ae3a8 |
int64_t sector_num,
|
|
|
9ae3a8 |
QEMUIOVector *qiov,
|
|
|
9ae3a8 |
int nb_sectors,
|
|
|
9ae3a8 |
+ BdrvRequestFlags flags,
|
|
|
9ae3a8 |
BlockDriverCompletionFunc *cb,
|
|
|
9ae3a8 |
void *opaque,
|
|
|
9ae3a8 |
bool is_write);
|
|
|
9ae3a8 |
@@ -3675,7 +3676,7 @@ BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
trace_bdrv_aio_readv(bs, sector_num, nb_sectors, opaque);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- return bdrv_co_aio_rw_vector(bs, sector_num, qiov, nb_sectors,
|
|
|
9ae3a8 |
+ return bdrv_co_aio_rw_vector(bs, sector_num, qiov, nb_sectors, 0,
|
|
|
9ae3a8 |
cb, opaque, false);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -3685,7 +3686,7 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num,
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
trace_bdrv_aio_writev(bs, sector_num, nb_sectors, opaque);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- return bdrv_co_aio_rw_vector(bs, sector_num, qiov, nb_sectors,
|
|
|
9ae3a8 |
+ return bdrv_co_aio_rw_vector(bs, sector_num, qiov, nb_sectors, 0,
|
|
|
9ae3a8 |
cb, opaque, true);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -3857,8 +3858,10 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
|
|
|
9ae3a8 |
/* Run the aio requests. */
|
|
|
9ae3a8 |
mcb->num_requests = num_reqs;
|
|
|
9ae3a8 |
for (i = 0; i < num_reqs; i++) {
|
|
|
9ae3a8 |
- bdrv_aio_writev(bs, reqs[i].sector, reqs[i].qiov,
|
|
|
9ae3a8 |
- reqs[i].nb_sectors, multiwrite_cb, mcb);
|
|
|
9ae3a8 |
+ bdrv_co_aio_rw_vector(bs, reqs[i].sector, reqs[i].qiov,
|
|
|
9ae3a8 |
+ reqs[i].nb_sectors, reqs[i].flags,
|
|
|
9ae3a8 |
+ multiwrite_cb, mcb,
|
|
|
9ae3a8 |
+ true);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
@@ -4163,10 +4166,10 @@ static void coroutine_fn bdrv_co_do_rw(void *opaque)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!acb->is_write) {
|
|
|
9ae3a8 |
acb->req.error = bdrv_co_do_readv(bs, acb->req.sector,
|
|
|
9ae3a8 |
- acb->req.nb_sectors, acb->req.qiov, 0);
|
|
|
9ae3a8 |
+ acb->req.nb_sectors, acb->req.qiov, acb->req.flags);
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
acb->req.error = bdrv_co_do_writev(bs, acb->req.sector,
|
|
|
9ae3a8 |
- acb->req.nb_sectors, acb->req.qiov, 0);
|
|
|
9ae3a8 |
+ acb->req.nb_sectors, acb->req.qiov, acb->req.flags);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);
|
|
|
9ae3a8 |
@@ -4177,6 +4180,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
|
|
|
9ae3a8 |
int64_t sector_num,
|
|
|
9ae3a8 |
QEMUIOVector *qiov,
|
|
|
9ae3a8 |
int nb_sectors,
|
|
|
9ae3a8 |
+ BdrvRequestFlags flags,
|
|
|
9ae3a8 |
BlockDriverCompletionFunc *cb,
|
|
|
9ae3a8 |
void *opaque,
|
|
|
9ae3a8 |
bool is_write)
|
|
|
9ae3a8 |
@@ -4188,6 +4192,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
|
|
|
9ae3a8 |
acb->req.sector = sector_num;
|
|
|
9ae3a8 |
acb->req.nb_sectors = nb_sectors;
|
|
|
9ae3a8 |
acb->req.qiov = qiov;
|
|
|
9ae3a8 |
+ acb->req.flags = flags;
|
|
|
9ae3a8 |
acb->is_write = is_write;
|
|
|
9ae3a8 |
acb->done = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/block/block.h b/include/block/block.h
|
|
|
9ae3a8 |
index b87ed3a..6042e10 100644
|
|
|
9ae3a8 |
--- a/include/block/block.h
|
|
|
9ae3a8 |
+++ b/include/block/block.h
|
|
|
9ae3a8 |
@@ -297,6 +297,7 @@ typedef struct BlockRequest {
|
|
|
9ae3a8 |
/* Fields to be filled by multiwrite caller */
|
|
|
9ae3a8 |
int64_t sector;
|
|
|
9ae3a8 |
int nb_sectors;
|
|
|
9ae3a8 |
+ int flags;
|
|
|
9ae3a8 |
QEMUIOVector *qiov;
|
|
|
9ae3a8 |
BlockDriverCompletionFunc *cb;
|
|
|
9ae3a8 |
void *opaque;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|