@@ -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;
@@ -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,
@@ -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
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(+)