yeahuh / rpms / qemu-kvm

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