All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, eblake@redhat.com, mreitz@redhat.com,
	qemu-devel@nongnu.org, famz@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 1/6] block: Introduce bdrv_preadv()
Date: Fri, 10 Jun 2016 18:05:17 +0200	[thread overview]
Message-ID: <1465574722-27656-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1465574722-27656-1-git-send-email-kwolf@redhat.com>

We already have a byte-based bdrv_pwritev(), but the read counterpart
was still missing. This commit adds it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c            | 20 +++++++++++++-------
 include/block/block.h |  1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/block/io.c b/block/io.c
index b3d6228..11510cf 100644
--- a/block/io.c
+++ b/block/io.c
@@ -700,6 +700,18 @@ int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags)
     }
 }
 
+int bdrv_preadv(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov)
+{
+    int ret;
+
+    ret = bdrv_prwv_co(bs, offset, qiov, false, 0);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return qiov->size;
+}
+
 int bdrv_pread(BlockDriverState *bs, int64_t offset, void *buf, int bytes)
 {
     QEMUIOVector qiov;
@@ -707,19 +719,13 @@ int bdrv_pread(BlockDriverState *bs, int64_t offset, void *buf, int bytes)
         .iov_base = (void *)buf,
         .iov_len = bytes,
     };
-    int ret;
 
     if (bytes < 0) {
         return -EINVAL;
     }
 
     qemu_iovec_init_external(&qiov, &iov, 1);
-    ret = bdrv_prwv_co(bs, offset, &qiov, false, 0);
-    if (ret < 0) {
-        return ret;
-    }
-
-    return bytes;
+    return bdrv_preadv(bs, offset, &qiov);
 }
 
 int bdrv_pwritev(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov)
diff --git a/include/block/block.h b/include/block/block.h
index fb0078f..aca7f23 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -232,6 +232,7 @@ int bdrv_pwrite_zeroes(BlockDriverState *bs, int64_t offset,
 int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags);
 int bdrv_pread(BlockDriverState *bs, int64_t offset,
                void *buf, int count);
+int bdrv_preadv(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov);
 int bdrv_pwrite(BlockDriverState *bs, int64_t offset,
                 const void *buf, int count);
 int bdrv_pwritev(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov);
-- 
1.8.3.1

  reply	other threads:[~2016-06-10 16:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 16:05 [Qemu-devel] [PATCH 0/6] block: bdrv_load/save_vmstate() cleanups Kevin Wolf
2016-06-10 16:05 ` Kevin Wolf [this message]
2016-06-10 20:50   ` [Qemu-devel] [PATCH 1/6] block: Introduce bdrv_preadv() Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 2/6] block: Make .bdrv_load_vmstate() vectored Kevin Wolf
2016-06-10 21:25   ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 3/6] block: Allow .bdrv_load/save_vmstate() to return 0/-errno Kevin Wolf
2016-06-10 21:29   ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 4/6] block: Make bdrv_load/save_vmstate coroutine_fns Kevin Wolf
2016-06-10 22:33   ` Eric Blake
2016-06-16  8:49   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-10 16:05 ` [Qemu-devel] [PATCH 5/6] qcow2: Let vmstate call qcow2_co_preadv/pwrite directly Kevin Wolf
2016-06-10 22:39   ` Eric Blake
2016-06-12  2:58     ` Fam Zheng
2016-06-13 12:36       ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 6/6] block: Remove bs->zero_beyond_eof Kevin Wolf
2016-06-10 22:41   ` Eric Blake
2016-06-12  2:59 ` [Qemu-devel] [PATCH 0/6] block: bdrv_load/save_vmstate() cleanups Fam Zheng
2016-06-16  8:54 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-16  9:33 ` [Qemu-devel] " Kevin Wolf

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=1465574722-27656-2-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.