qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 33/43] block: Convert bdrv_co_do_readv/writev to BdrvChild
Date: Tue,  5 Jul 2016 17:50:42 +0200	[thread overview]
Message-ID: <1467733852-27097-34-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1467733852-27097-1-git-send-email-kwolf@redhat.com>

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/io.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/block/io.c b/block/io.c
index e929521..d8b3c96 100644
--- a/block/io.c
+++ b/block/io.c
@@ -33,7 +33,7 @@
 
 #define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
 
-static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
+static BlockAIOCB *bdrv_co_aio_rw_vector(BdrvChild *child,
                                          int64_t sector_num,
                                          QEMUIOVector *qiov,
                                          int nb_sectors,
@@ -1129,7 +1129,7 @@ int coroutine_fn bdrv_co_preadv(BlockDriverState *bs,
     return ret;
 }
 
-static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
+static int coroutine_fn bdrv_co_do_readv(BdrvChild *child,
     int64_t sector_num, int nb_sectors, QEMUIOVector *qiov,
     BdrvRequestFlags flags)
 {
@@ -1137,7 +1137,7 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
         return -EINVAL;
     }
 
-    return bdrv_co_preadv(bs, sector_num << BDRV_SECTOR_BITS,
+    return bdrv_co_preadv(child->bs, sector_num << BDRV_SECTOR_BITS,
                           nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
 }
 
@@ -1146,7 +1146,7 @@ int coroutine_fn bdrv_co_readv(BdrvChild *child, int64_t sector_num,
 {
     trace_bdrv_co_readv(child->bs, sector_num, nb_sectors);
 
-    return bdrv_co_do_readv(child->bs, sector_num, nb_sectors, qiov, 0);
+    return bdrv_co_do_readv(child, sector_num, nb_sectors, qiov, 0);
 }
 
 /* Maximum buffer for write zeroes fallback, in bytes */
@@ -1535,7 +1535,7 @@ out:
     return ret;
 }
 
-static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
+static int coroutine_fn bdrv_co_do_writev(BdrvChild *child,
     int64_t sector_num, int nb_sectors, QEMUIOVector *qiov,
     BdrvRequestFlags flags)
 {
@@ -1543,7 +1543,7 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
         return -EINVAL;
     }
 
-    return bdrv_co_pwritev(bs, sector_num << BDRV_SECTOR_BITS,
+    return bdrv_co_pwritev(child->bs, sector_num << BDRV_SECTOR_BITS,
                            nb_sectors << BDRV_SECTOR_BITS, qiov, flags);
 }
 
@@ -1552,7 +1552,7 @@ int coroutine_fn bdrv_co_writev(BdrvChild *child, int64_t sector_num,
 {
     trace_bdrv_co_writev(child->bs, sector_num, nb_sectors);
 
-    return bdrv_co_do_writev(child->bs, sector_num, nb_sectors, qiov, 0);
+    return bdrv_co_do_writev(child, sector_num, nb_sectors, qiov, 0);
 }
 
 int coroutine_fn bdrv_co_pwrite_zeroes(BlockDriverState *bs,
@@ -1968,7 +1968,7 @@ BlockAIOCB *bdrv_aio_readv(BdrvChild *child, int64_t sector_num,
 {
     trace_bdrv_aio_readv(child->bs, sector_num, nb_sectors, opaque);
 
-    return bdrv_co_aio_rw_vector(child->bs, sector_num, qiov, nb_sectors, 0,
+    return bdrv_co_aio_rw_vector(child, sector_num, qiov, nb_sectors, 0,
                                  cb, opaque, false);
 }
 
@@ -1978,7 +1978,7 @@ BlockAIOCB *bdrv_aio_writev(BdrvChild *child, int64_t sector_num,
 {
     trace_bdrv_aio_writev(child->bs, sector_num, nb_sectors, opaque);
 
-    return bdrv_co_aio_rw_vector(child->bs, sector_num, qiov, nb_sectors, 0,
+    return bdrv_co_aio_rw_vector(child, sector_num, qiov, nb_sectors, 0,
                                  cb, opaque, true);
 }
 
@@ -2034,6 +2034,7 @@ typedef struct BlockRequest {
 
 typedef struct BlockAIOCBCoroutine {
     BlockAIOCB common;
+    BdrvChild *child;
     BlockRequest req;
     bool is_write;
     bool need_bh;
@@ -2077,20 +2078,19 @@ static void bdrv_co_maybe_schedule_bh(BlockAIOCBCoroutine *acb)
 static void coroutine_fn bdrv_co_do_rw(void *opaque)
 {
     BlockAIOCBCoroutine *acb = opaque;
-    BlockDriverState *bs = acb->common.bs;
 
     if (!acb->is_write) {
-        acb->req.error = bdrv_co_do_readv(bs, acb->req.sector,
+        acb->req.error = bdrv_co_do_readv(acb->child, acb->req.sector,
             acb->req.nb_sectors, acb->req.qiov, acb->req.flags);
     } else {
-        acb->req.error = bdrv_co_do_writev(bs, acb->req.sector,
+        acb->req.error = bdrv_co_do_writev(acb->child, acb->req.sector,
             acb->req.nb_sectors, acb->req.qiov, acb->req.flags);
     }
 
     bdrv_co_complete(acb);
 }
 
-static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
+static BlockAIOCB *bdrv_co_aio_rw_vector(BdrvChild *child,
                                          int64_t sector_num,
                                          QEMUIOVector *qiov,
                                          int nb_sectors,
@@ -2102,7 +2102,8 @@ static BlockAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
     Coroutine *co;
     BlockAIOCBCoroutine *acb;
 
-    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
+    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, child->bs, cb, opaque);
+    acb->child = child;
     acb->need_bh = true;
     acb->req.error = -EINPROGRESS;
     acb->req.sector = sector_num;
-- 
1.8.3.1

  parent reply	other threads:[~2016-07-05 15:51 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 15:50 [Qemu-devel] [PULL 00/43] Block layer patches Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 01/43] qemu-img: fix failed autotests Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 02/43] block: Tighter assertions on bdrv_aligned_pwritev() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 03/43] block: Document supported flags during bdrv_aligned_preadv() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 04/43] block: Fix harmless off-by-one in bdrv_aligned_preadv() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 05/43] nbd: Allow larger requests Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 06/43] nbd: Advertise realistic limits to block layer Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 07/43] iscsi: " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 08/43] scsi: Advertise limits by blocksize, not 512 Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 09/43] block: Give nonzero result to blk_get_max_transfer_length() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 10/43] blkdebug: Set request_alignment during .bdrv_refresh_limits() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 11/43] iscsi: " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 12/43] qcow2: " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 13/43] raw-win32: " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 14/43] block: " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 15/43] block: Set default request_alignment during bdrv_refresh_limits() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 16/43] block: Switch transfer length bounds to byte-based Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 17/43] block: Wording tweaks to write zeroes limits Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 18/43] block: Switch discard length bounds to byte-based Kevin Wolf
2016-07-06  2:14   ` Eric Blake
2016-07-06  8:27     ` Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 19/43] block: Drop raw_refresh_limits() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 20/43] block: Split bdrv_merge_limits() from bdrv_refresh_limits() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 21/43] block: Move request_alignment into BlockLimit Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 22/43] block: Fix error message style Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 23/43] block: Use bool as appropriate for BDS members Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 24/43] block: fix return code for partial write for Linux AIO Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 25/43] block/qdev: Fix NULL access when using BB twice Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 26/43] vvfat: Use BdrvChild for s->qcow Kevin Wolf
2016-07-11 14:02   ` Paolo Bonzini
2016-07-05 15:50 ` [Qemu-devel] [PULL 27/43] blkreplay: Convert to byte-based I/O Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 28/43] vhdx: Some more BlockBackend use in vhdx_create() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 29/43] block: Convert bdrv_co_readv() to BdrvChild Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 30/43] block: Convert bdrv_co_writev() " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 31/43] block: Convert bdrv_aio_readv() " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 32/43] block: Convert bdrv_aio_writev() " Kevin Wolf
2016-07-05 15:50 ` Kevin Wolf [this message]
2016-07-05 15:50 ` [Qemu-devel] [PULL 34/43] block: Move bdrv_commit() to block/commit.c Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 35/43] block: Use BlockBackend for I/O in bdrv_commit() Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 36/43] block: Convert bdrv_read() to BdrvChild Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 37/43] block: Convert bdrv_write() " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 38/43] block: Convert bdrv_pread(v) " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 39/43] block: Convert bdrv_pwrite(v/_sync) " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 40/43] block: Convert bdrv_pwrite_zeroes() " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 41/43] block: Convert bdrv_prwv_co() " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 42/43] block: Convert bdrv_co_preadv/pwritev " Kevin Wolf
2016-07-05 15:50 ` [Qemu-devel] [PULL 43/43] block/qcow2: Don't use cpu_to_*w() Kevin Wolf
2016-07-06  9:23 ` [Qemu-devel] [PULL 00/43] Block layer patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467733852-27097-34-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).