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, mreitz@redhat.com, jcody@redhat.com,
	jsnow@redhat.com, berto@igalia.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 11/14] block: Add blk_co_readv/writev()
Date: Wed,  4 May 2016 11:39:22 +0200	[thread overview]
Message-ID: <1462354765-14037-12-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1462354765-14037-1-git-send-email-kwolf@redhat.com>

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c          | 26 ++++++++++++++++++++++++++
 include/sysemu/block-backend.h |  4 ++++
 trace-events                   |  2 ++
 3 files changed, 32 insertions(+)

diff --git a/block/block-backend.c b/block/block-backend.c
index 25bb5ca..8dc3aa5 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -794,6 +794,19 @@ static int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
     return bdrv_co_pwritev(blk_bs(blk), offset, bytes, qiov, flags);
 }
 
+int coroutine_fn blk_co_readv(BlockBackend *blk, int64_t sector_num,
+                              int nb_sectors, QEMUIOVector *qiov)
+{
+    trace_blk_co_readv(blk, blk_bs(blk), sector_num, nb_sectors);
+
+    if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
+        return -EINVAL;
+    }
+
+    return blk_co_preadv(blk, sector_num << BDRV_SECTOR_BITS,
+                         nb_sectors << BDRV_SECTOR_BITS, qiov, 0);
+}
+
 int coroutine_fn blk_co_copy_on_readv(BlockBackend *blk,
     int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
 {
@@ -808,6 +821,19 @@ int coroutine_fn blk_co_copy_on_readv(BlockBackend *blk,
                          BDRV_REQ_COPY_ON_READ);
 }
 
+int coroutine_fn blk_co_writev(BlockBackend *blk, int64_t sector_num,
+                               int nb_sectors, QEMUIOVector *qiov)
+{
+    trace_blk_co_writev(blk, blk_bs(blk), sector_num, nb_sectors);
+
+    if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
+        return -EINVAL;
+    }
+
+    return blk_co_pwritev(blk, sector_num << BDRV_SECTOR_BITS,
+                          nb_sectors << BDRV_SECTOR_BITS, qiov, 0);
+}
+
 typedef struct BlkRwCo {
     BlockBackend *blk;
     int64_t offset;
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index eac4d88..d98552c 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -116,8 +116,12 @@ int blk_read(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
              int nb_sectors);
 int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
                          int nb_sectors);
+int coroutine_fn blk_co_readv(BlockBackend *blk, int64_t sector_num,
+                              int nb_sectors, QEMUIOVector *qiov);
 int coroutine_fn blk_co_copy_on_readv(BlockBackend *blk,
     int64_t sector_num, int nb_sectors, QEMUIOVector *qiov);
+int coroutine_fn blk_co_writev(BlockBackend *blk, int64_t sector_num,
+                               int nb_sectors, QEMUIOVector *qiov);
 int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
               int nb_sectors);
 int blk_write_zeroes(BlockBackend *blk, int64_t sector_num,
diff --git a/trace-events b/trace-events
index 9beb588..3b5cce3 100644
--- a/trace-events
+++ b/trace-events
@@ -62,6 +62,8 @@ bdrv_open_common(void *bs, const char *filename, int flags, const char *format_n
 bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
 
 # block/block-backend.c
+blk_co_readv(void *blk, void *bs, int64_t sector_num, int nb_sector) "blk %p bs %p sector_num %"PRId64" nb_sectors %d"
+blk_co_writev(void *blk, void *bs, int64_t sector_num, int nb_sector) "blk %p bs %p sector_num %"PRId64" nb_sectors %d"
 blk_co_copy_on_readv(void *blk, void *bs, int64_t sector_num, int nb_sector) "blk %p bs %p sector_num %"PRId64" nb_sectors %d"
 
 # block/io.c
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-04  9:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  9:39 [Qemu-devel] [PATCH 00/14] block jobs: Convert I/O to BlockBackend Kevin Wolf
2016-05-04  9:39 ` [Qemu-devel] [PATCH 01/14] block: keep a list of block jobs Kevin Wolf
2016-05-13 13:09   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 02/14] block: Cancel jobs first in bdrv_close_all() Kevin Wolf
2016-05-06  9:17   ` Alberto Garcia
2016-05-13 13:14   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 03/14] block: Default to enabled write cache in blk_new() Kevin Wolf
2016-05-13 13:24   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 04/14] block: Convert block job core to BlockBackend Kevin Wolf
2016-05-13 13:45   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 05/14] stream: Use BlockBackend for I/O Kevin Wolf
2016-05-13 14:03   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 06/14] mirror: Allow target that already has a BlockBackend Kevin Wolf
2016-05-13 14:18   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 07/14] mirror: Use BlockBackend for I/O Kevin Wolf
2016-05-13 14:38   ` Max Reitz
2016-05-13 14:38   ` Max Reitz
2016-05-13 14:57     ` Eric Blake
2016-05-04  9:39 ` [Qemu-devel] [PATCH 08/14] backup: Don't leak BackupBlockJob in error path Kevin Wolf
2016-05-09 13:21   ` Alberto Garcia
2016-05-13 14:46   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 09/14] backup: Pack Notifier within BackupBlockJob Kevin Wolf
2016-05-13 15:01   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 10/14] backup: Remove bs parameter from backup_do_cow() Kevin Wolf
2016-05-13 15:06   ` Max Reitz
2016-05-04  9:39 ` Kevin Wolf [this message]
2016-05-13 15:12   ` [Qemu-devel] [PATCH 11/14] block: Add blk_co_readv/writev() Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 12/14] backup: Use BlockBackend for I/O Kevin Wolf
2016-05-13 15:25   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 13/14] commit: " Kevin Wolf
2016-05-13 15:36   ` Max Reitz
2016-05-04  9:39 ` [Qemu-devel] [PATCH 14/14] blockjob: Remove BlockJob.bs Kevin Wolf
2016-05-13 15:37   ` Max Reitz

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=1462354765-14037-12-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=mreitz@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 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.