block: local qiov helper
v4 cover block: local qiov helper
Hi all!
Here is a new simple helper for a very often patter around qemu_iovec_init_external, when we need simple qiov with only one iov, initialized from external buffer.
v4:
01: tiny improvements by Eric
+ fix bug: s/niov/nalloc in assertion
+ rename s/qemu_iovec_get_buf/qemu_iovec_buf,
to don't look like getter, which in turn should not return pointer to something internal to be freed separately.
So, no r-b's in 01
07,10,16
- rebase on new function name qemu_iovec_buf
- save r-b's by Eric and Stefan
others unchanged, add r-b's by Eric and Stefan
v3:
01-02: tiny improvements, described in patch-emails 03-17: new patches
Note: only hw/scsi/scsi-disk.c not updated, as it has too tricky
logic around @iov fields of structures. So, it is simpler to keep it as is.
v2 was "[PATCH v2 0/2] block: local qiov helper: part I"
https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg01610.html
Vladimir Sementsov-Ogievskiy (17):
block: enhance QEMUIOVector structure
block/io: use qemu_iovec_init_buf
block/block-backend: use QEMU_IOVEC_INIT_BUF
block/backup: use qemu_iovec_init_buf
block/commit: use QEMU_IOVEC_INIT_BUF
block/stream: use QEMU_IOVEC_INIT_BUF
block/parallels: use QEMU_IOVEC_INIT_BUF
block/qcow: use qemu_iovec_init_buf
block/qcow2: use qemu_iovec_init_buf
block/qed: use qemu_iovec_init_buf
block/vmdk: use qemu_iovec_init_buf
qemu-img: use qemu_iovec_init_buf
migration/block: use qemu_iovec_init_buf
tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF
hw/ide: drop iov field from IDEState
hw/ide: drop iov field from IDEBufferedRequest
hw/ide: drop iov field from IDEDMA
include/hw/ide/internal.h | 3 -- include/qemu/iov.h | 64 +++++++++++++++++++++++++++- block/backup.c | 5 +-- block/block-backend.c | 13 +----- block/commit.c | 7 +-- block/io.c | 89 +++++++++------------------------------ block/parallels.c | 13 +++--- block/qcow.c | 21 ++------- block/qcow2.c | 12 +----- block/qed-table.c | 16 ++----- block/qed.c | 31 ++++---------- block/stream.c | 7 +-- block/vmdk.c | 7 +-- hw/ide/atapi.c | 14 +++--- hw/ide/core.c | 19 ++++----- migration/block.c | 10 ++--- qemu-img.c | 10 +---- tests/test-bdrv-drain.c | 29 ++----------- 18 files changed, 134 insertions(+), 236 deletions(-)
Signature · 1 line
2.18.0
PATCH v4 1/17 block: enhance QEMUIOVector structure
Add a possibility of embedded iovec, for cases when we need only one local iov.
--- include/qemu/iov.h | 64 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-)
include/qemu/iov.h +62 -2
@@ -133,10 +133,70 @@ size_t iov_discard_back(struct iovec *iov, unsigned int *iov_cnt,typedef struct QEMUIOVector {struct iovec *iov;int niov; -int nalloc; -size_t size; + +/* +* For external @iov (qemu_iovec_init_external()) or allocated @iov +* (qemu_iovec_init()), @size is the cumulative size of iovecs and +* @local_iov is invalid and unused. +* +* For embedded @iov (QEMU_IOVEC_INIT_BUF() or qemu_iovec_init_buf()), +* @iov is equal to &@local_iov, and @size is valid, as it has same +* offset and type as @local_iov.iov_len, which is guaranteed by +* static assertion below. +* +* @nalloc is always valid and is -1 both for embedded and external +* cases. It is included in the union only to ensure the padding prior +* to the @size field will not result in a 0-length array. +*/ +union { +struct { +int nalloc; +struct iovec local_iov; + }; +struct { +char __pad[sizeof (int ) + offsetof(struct iovec , iov_len)]; +size_t size; + }; + }; }QEMUIOVector ; +QEMU_BUILD_BUG_ON (offsetof(QEMUIOVector , size) != + offsetof(QEMUIOVector, local_iov.iov_len)); + +#define QEMU_IOVEC_INIT_BUF(self, buf, len) \ +{ \ + .iov = &(self).local_iov, \ + .niov = 1, \ + .nalloc = -1, \ + .local_iov = { \ + .iov_base = (void *)(buf), /* cast away const */ \ + .iov_len = (len), \ + }, \ +} + +/* +* qemu_iovec_init_buf +* +* Initialize embedded QEMUIOVector. +* +* Note: "const" is used over @buf pointer to make it simple to pass +* const pointers, appearing in read functions. Then this "const" is +* cast away by QEMU_IOVEC_INIT_BUF(). +*/ +static inline void qemu_iovec_init_buf (QEMUIOVector *qiov, +const void *buf,size_t len) +{ + *qiov = (QEMUIOVector )QEMU_IOVEC_INIT_BUF (*qiov, buf, len); +} + +static inline void *qemu_iovec_buf (QEMUIOVector *qiov) +{ +/* Only supports embedded iov */ +assert (qiov->nalloc ==-1 && qiov->iov == &qiov->local_iov); + +return qiov->local_iov.iov_base; +} +void qemu_iovec_init (QEMUIOVector *qiov,int alloc_hint);void qemu_iovec_init_external (QEMUIOVector *qiov,struct iovec *iov,int niov);void qemu_iovec_add (QEMUIOVector *qiov,void *base,size_t len);
Signature · 1 line
2.18.0
Re: [Qemu-devel] [PATCH v4 01/17] block: enhance QEMUIOVector structure
Quoted 8 lines · Vladimir Sementsov-Ogievskiy
Add a possibility of embedded iovec, for cases when we need only one local iov.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- include/qemu/iov.h | 64 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
PATCH v4 2/17 block/io: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
While being here, use qemu_try_blockalign0 as well.
--- block/io.c | 89 ++++++++++++------------------------------------------ 1 file changed, 20 insertions(+), 69 deletions(-)
block/io.c +20 -69
@@ -843,17 +843,13 @@ static int bdrv_prwv_co(BdrvChild *child, int64_t offset,static int bdrv_rw_co (BdrvChild *child,int64_t sector_num,uint8_t *buf,int nb_sectors,bool is_write,BdrvRequestFlags flags) { -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = (void *)buf, - .iov_len = nb_sectors *BDRV_SECTOR_SIZE , - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buf, + nb_sectors *BDRV_SECTOR_SIZE );if (nb_sectors <0 || nb_sectors >BDRV_REQUEST_MAX_SECTORS ) {return -EINVAL ; } -qemu_iovec_init_external (&qiov, &iov,1 );return bdrv_prwv_co (child, sector_num <<BDRV_SECTOR_BITS , &qiov, is_write, flags); }
@@ -880,13 +876,8 @@ int bdrv_write(BdrvChild *child, int64_t sector_num,int bdrv_pwrite_zeroes (BdrvChild *child,int64_t offset,int bytes,BdrvRequestFlags flags) { -QEMUIOVector qiov; -struct iovec iov = { - .iov_base =NULL , - .iov_len = bytes, - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov,NULL , bytes); -qemu_iovec_init_external (&qiov, &iov,1 );return bdrv_prwv_co (child, offset, &qiov, true,BDRV_REQ_ZERO_WRITE | flags); }
@@ -950,17 +941,12 @@ int bdrv_preadv(BdrvChild *child, int64_t offset, QEMUIOVector *qiov)int bdrv_pread (BdrvChild *child,int64_t offset,void *buf,int bytes) { -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = (void *)buf, - .iov_len = bytes, - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buf, bytes);if (bytes <0 ) {return -EINVAL ; } -qemu_iovec_init_external (&qiov, &iov,1 );return bdrv_preadv (child, offset, &qiov); }
@@ -978,17 +964,12 @@ int bdrv_pwritev(BdrvChild *child, int64_t offset, QEMUIOVector *qiov)int bdrv_pwrite (BdrvChild *child,int64_t offset,const void *buf,int bytes) { -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = (void *) buf, - .iov_len = bytes, - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buf, bytes);if (bytes <0 ) {return -EINVAL ; } -qemu_iovec_init_external (&qiov, &iov,1 );return bdrv_pwritev (child, offset, &qiov); }
@@ -1165,7 +1146,6 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,void *bounce_buffer;BlockDriver *drv = bs->drv; -struct iovec iov;QEMUIOVector local_qiov;int64_t cluster_offset;int64_t cluster_bytes;
@@ -1230,9 +1210,8 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,if (ret <=0 ) {/* Must copy-on-read; use the bounce buffer */ - iov.iov_base = bounce_buffer; - iov.iov_len = pnum =MIN (pnum,MAX_BOUNCE_BUFFER ); -qemu_iovec_init_external (&local_qiov, &iov,1 ); + pnum =MIN (pnum,MAX_BOUNCE_BUFFER ); +qemu_iovec_init_buf (&local_qiov, bounce_buffer, pnum); ret =bdrv_driver_preadv (bs, cluster_offset, pnum, &local_qiov,0 );
@@ -1477,7 +1456,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, {BlockDriver *drv = bs->drv;QEMUIOVector qiov; -struct iovec iov = {0 }; +void *buf =NULL ;int ret =0 ;bool need_flush = false;int head =0 ;
@@ -1547,16 +1526,14 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, need_flush = true; } num =MIN (num, max_transfer); - iov.iov_len = num; -if (iov.iov_base ==NULL ) { - iov.iov_base =qemu_try_blockalign (bs, num); -if (iov.iov_base ==NULL ) { +if (buf ==NULL ) { + buf =qemu_try_blockalign0 (bs, num); +if (buf ==NULL ) { ret = -ENOMEM ; goto fail; } -memset (iov.iov_base,0 , num); } -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov, buf, num); ret =bdrv_driver_pwritev (bs, offset, num, &qiov, write_flags);
@@ -1564,8 +1541,8 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,* all future requests. */ if (num < max_transfer) { -qemu_vfree (iov.iov_base); - iov.iov_base =NULL ; +qemu_vfree (buf); + buf =NULL ; } }
@@ -1577,7 +1554,7 @@ fail:if (ret ==0 && need_flush) { ret =bdrv_co_flush (bs); } -qemu_vfree (iov.iov_base); +qemu_vfree (buf);return ret; }
@@ -1763,7 +1740,6 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild *child,BlockDriverState *bs = child->bs;uint8_t *buf =NULL ;QEMUIOVector local_qiov; -struct iovec iov;uint64_t align = bs->bl.request_alignment;unsigned int head_padding_bytes, tail_padding_bytes;int ret =0 ;
@@ -1775,11 +1751,7 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild *child,assert (flags &BDRV_REQ_ZERO_WRITE );if (head_padding_bytes || tail_padding_bytes) { buf =qemu_blockalign (bs, align); - iov = (struct iovec ) { - .iov_base = buf, - .iov_len = align, - }; -qemu_iovec_init_external (&local_qiov, &iov,1 ); +qemu_iovec_init_buf (&local_qiov, buf, align); }if (head_padding_bytes) {uint64_t zero_bytes =MIN (bytes, align - head_padding_bytes);
@@ -1885,17 +1857,12 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child,if (offset & (align -1 )) {QEMUIOVector head_qiov; -struct iovec head_iov;mark_request_serialising (&req, align);wait_serialising_requests (&req); head_buf =qemu_blockalign (bs, align); - head_iov = (struct iovec ) { - .iov_base = head_buf, - .iov_len = align, - }; -qemu_iovec_init_external (&head_qiov, &head_iov,1 ); +qemu_iovec_init_buf (&head_qiov, head_buf, align);bdrv_debug_event (bs,BLKDBG_PWRITEV_RMW_HEAD ); ret = bdrv_aligned_preadv(child, &req, offset & ~(align - 1), align,
@@ -1924,7 +1891,6 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child,if ((offset + bytes) & (align -1 )) {QEMUIOVector tail_qiov; -struct iovec tail_iov;size_t tail_bytes;bool waited;
@@ -1933,11 +1899,7 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child,assert (!waited || !use_local_qiov); tail_buf =qemu_blockalign (bs, align); - tail_iov = (struct iovec ) { - .iov_base = tail_buf, - .iov_len = align, - }; -qemu_iovec_init_external (&tail_qiov, &tail_iov,1 ); +qemu_iovec_init_buf (&tail_qiov, tail_buf, align);bdrv_debug_event (bs,BLKDBG_PWRITEV_RMW_TAIL ); ret = bdrv_aligned_preadv(child, &req, (offset + bytes) & ~(align - 1),
@@ -2468,15 +2430,9 @@ bdrv_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos,int bdrv_save_vmstate (BlockDriverState *bs,const uint8_t *buf,int64_t pos,int size) { -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = (void *) buf, - .iov_len = size, - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buf, size);int ret; -qemu_iovec_init_external (&qiov, &iov,1 ); - ret =bdrv_writev_vmstate (bs, &qiov, pos);if (ret <0 ) {return ret;
@@ -2493,14 +2449,9 @@ int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)int bdrv_load_vmstate (BlockDriverState *bs,uint8_t *buf,int64_t pos,int size) { -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = buf, - .iov_len = size, - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buf, size);int ret; -qemu_iovec_init_external (&qiov, &iov,1 ); ret =bdrv_readv_vmstate (bs, &qiov, pos);if (ret <0 ) {return ret;
Signature · 1 line
2.18.0
PATCH v4 3/17 block/block-backend: use QEMU_IOVEC_INIT_BUF
In reply to Vladimir Sementsov-OgievskiyUse new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/block-backend.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
block/block-backend.c +2 -11
@@ -1204,17 +1204,8 @@ static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf, int64_t bytes, CoroutineEntry co_entry, BdrvRequestFlags flags) { - QEMUIOVector qiov; -struct iovec iov; -BlkRwCo rwco; - - iov = (struct iovec ) { - .iov_base = buf, - .iov_len = bytes, - }; -qemu_iovec_init_external (&qiov, &iov,1 ); - - rwco = (BlkRwCo) { + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + BlkRwCo rwco = { .blk = blk, .offset = offset, .iobuf = &qiov,
Signature · 1 line
2.18.0
PATCH v4 4/17 block/backup: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/backup.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
block/backup.c +1 -4
@@ -107,7 +107,6 @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, void **bounce_buffer) {int ret; -struct iovec iov;QEMUIOVector qiov;BlockBackend *blk = job->common.blk;int nbytes;
@@ -119,9 +118,7 @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job,if (!*bounce_buffer) { *bounce_buffer =blk_blockalign (blk, job->cluster_size); } - iov.iov_base = *bounce_buffer; - iov.iov_len = nbytes; -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov, *bounce_buffer, nbytes); ret =blk_co_preadv (blk, start, qiov.size, &qiov, read_flags);if (ret <0 ) {
Signature · 1 line
2.18.0
PATCH v4 5/17 block/commit: use QEMU_IOVEC_INIT_BUF
In reply to Vladimir Sementsov-OgievskiyUse new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/commit.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
block/commit.c +1 -6
@@ -47,14 +47,9 @@ static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base, void *buf) {int ret =0 ; -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = buf, - .iov_len = bytes, - }; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buf, bytes);assert (bytes <SIZE_MAX ); -qemu_iovec_init_external (&qiov, &iov,1 ); ret =blk_co_preadv (bs, offset, qiov.size, &qiov,0 );if (ret <0 ) {
Signature · 1 line
2.18.0
PATCH v4 6/17 block/stream: use QEMU_IOVEC_INIT_BUF
In reply to Vladimir Sementsov-OgievskiyUse new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/stream.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
block/stream.c +1 -6
@@ -41,14 +41,9 @@ static int coroutine_fn stream_populate(BlockBackend *blk, int64_t offset, uint64_t bytes, void *buf) { - struct iovec iov = { - .iov_base = buf, - .iov_len = bytes, - }; -QEMUIOVector qiov; + QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);assert (bytes <SIZE_MAX ); -qemu_iovec_init_external (&qiov, &iov,1 );/* Copy-on-read the unallocated clusters */ return blk_co_preadv (blk, offset, qiov.size, &qiov,BDRV_REQ_COPY_ON_READ );
Signature · 1 line
2.18.0
PATCH v4 7/17 block/parallels: use QEMU_IOVEC_INIT_BUF
In reply to Vladimir Sementsov-OgievskiyUse new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/parallels.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
block/parallels.c +5 -8
@@ -220,23 +220,20 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,if (bs->backing) {int64_t nb_cow_sectors = to_allocate * s->tracks;int64_t nb_cow_bytes = nb_cow_sectors <<BDRV_SECTOR_BITS ; -QEMUIOVector qiov; -struct iovec iov = { - .iov_len = nb_cow_bytes, - .iov_base =qemu_blockalign (bs, nb_cow_bytes) - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +QEMUIOVector qiov = +QEMU_IOVEC_INIT_BUF (qiov,qemu_blockalign (bs, nb_cow_bytes), + nb_cow_bytes); ret =bdrv_co_preadv (bs->backing, idx * s->tracks *BDRV_SECTOR_SIZE , nb_cow_bytes, &qiov,0 );if (ret <0 ) { -qemu_vfree (iov.iov_base); +qemu_vfree (qemu_iovec_buf (&qiov));return ret; } ret =bdrv_co_pwritev (bs->file, s->data_end *BDRV_SECTOR_SIZE , nb_cow_bytes, &qiov,0 ); -qemu_vfree (iov.iov_base); +qemu_vfree (qemu_iovec_buf (&qiov));if (ret <0 ) {return ret; }
Signature · 1 line
2.18.0
PATCH v4 8/17 block/qcow: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/qcow.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
block/qcow.c +4 -17
@@ -628,7 +628,6 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset,int offset_in_cluster;int ret =0 , n;uint64_t cluster_offset; -struct iovec hd_iov;QEMUIOVector hd_qiov;uint8_t *buf;void *orig_buf;
@@ -661,9 +660,7 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset,if (!cluster_offset) {if (bs->backing) {/* read from the base image */ - hd_iov.iov_base = (void *)buf; - hd_iov.iov_len = n; -qemu_iovec_init_external (&hd_qiov, &hd_iov,1 ); +qemu_iovec_init_buf (&hd_qiov, buf, n);qemu_co_mutex_unlock (&s->lock);/* qcow2 emits this on bs->file instead of bs->backing */ BLKDBG_EVENT (bs->file,BLKDBG_READ_BACKING_AIO );
@@ -688,9 +685,7 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset, ret = -EIO ;break ; } - hd_iov.iov_base = (void *)buf; - hd_iov.iov_len = n; -qemu_iovec_init_external (&hd_qiov, &hd_iov,1 ); +qemu_iovec_init_buf (&hd_qiov, buf, n);qemu_co_mutex_unlock (&s->lock);BLKDBG_EVENT (bs->file,BLKDBG_READ_AIO ); ret = bdrv_co_preadv(bs->file, cluster_offset + offset_in_cluster,
@@ -733,7 +728,6 @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset,int offset_in_cluster;uint64_t cluster_offset;int ret =0 , n; -struct iovec hd_iov;QEMUIOVector hd_qiov;uint8_t *buf;void *orig_buf;
@@ -779,9 +773,7 @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t offset, } } - hd_iov.iov_base = (void *)buf; - hd_iov.iov_len = n; -qemu_iovec_init_external (&hd_qiov, &hd_iov,1 ); +qemu_iovec_init_buf (&hd_qiov, buf, n);qemu_co_mutex_unlock (&s->lock);BLKDBG_EVENT (bs->file,BLKDBG_WRITE_AIO ); ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster,
@@ -1062,7 +1054,6 @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, {BDRVQcowState *s = bs->opaque;QEMUIOVector hd_qiov; -struct iovec iov;z_stream strm;int ret, out_len;uint8_t *buf, *out_buf;
@@ -1128,11 +1119,7 @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, } cluster_offset &= s->cluster_offset_mask; - iov = (struct iovec ) { - .iov_base = out_buf, - .iov_len = out_len, - }; -qemu_iovec_init_external (&hd_qiov, &iov,1 ); +qemu_iovec_init_buf (&hd_qiov, out_buf, out_len);BLKDBG_EVENT (bs->file,BLKDBG_WRITE_COMPRESSED ); ret =bdrv_co_pwritev (bs->file, cluster_offset, out_len, &hd_qiov,0 );if (ret <0 ) {
Signature · 1 line
2.18.0
PATCH v4 9/17 block/qcow2: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/qcow2.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
block/qcow2.c +2 -10
@@ -3894,7 +3894,6 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, {BDRVQcow2State *s = bs->opaque;QEMUIOVector hd_qiov; -struct iovec iov;int ret;size_t out_len;uint8_t *buf, *out_buf;
@@ -3960,11 +3959,7 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, goto fail; } - iov = (struct iovec ) { - .iov_base = out_buf, - .iov_len = out_len, - }; -qemu_iovec_init_external (&hd_qiov, &iov,1 ); +qemu_iovec_init_buf (&hd_qiov, out_buf, out_len);BLKDBG_EVENT (bs->file,BLKDBG_WRITE_COMPRESSED ); ret =bdrv_co_pwritev (bs->file, cluster_offset, out_len, &hd_qiov,0 );
@@ -3990,7 +3985,6 @@ qcow2_co_preadv_compressed(BlockDriverState *bs,int ret =0 , csize, nb_csectors;uint64_t coffset;uint8_t *buf, *out_buf; -struct iovec iov;QEMUIOVector local_qiov;int offset_in_cluster =offset_into_cluster (s, offset);
@@ -4002,9 +3996,7 @@ qcow2_co_preadv_compressed(BlockDriverState *bs,if (!buf) {return -ENOMEM ; } - iov.iov_base = buf; - iov.iov_len = csize; -qemu_iovec_init_external (&local_qiov, &iov,1 ); +qemu_iovec_init_buf (&local_qiov, buf, csize); out_buf =qemu_blockalign (bs, s->cluster_size);
Signature · 1 line
2.18.0
PATCH v4 10/17 block/qed: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/qed-table.c | 16 +++------------- block/qed.c | 31 +++++++++---------------------- 2 files changed, 12 insertions(+), 35 deletions(-)
block/qed-table.c +3 -13
@@ -21,16 +21,11 @@/* Called with table_lock held. */ static int qed_read_table (BDRVQEDState *s,uint64_t offset,QEDTable *table) { -QEMUIOVector qiov; +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF ( + qiov, table->offsets, s->header.cluster_size * s->header.table_size);int noffsets;int i, ret; -struct iovec iov = { - .iov_base = table->offsets, - .iov_len = s->header.cluster_size * s->header.table_size, - }; -qemu_iovec_init_external (&qiov, &iov,1 ); -trace_qed_read_table (s, offset, table);qemu_co_mutex_unlock (&s->table_lock);
@@ -71,7 +66,6 @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table,unsigned int sector_mask =BDRV_SECTOR_SIZE /sizeof (uint64_t ) -1 ;unsigned int start, end, i;QEDTable *new_table; -struct iovec iov;QEMUIOVector qiov;size_t len_bytes;int ret;
@@ -85,11 +79,7 @@ static int qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, len_bytes = (end - start) *sizeof (uint64_t ); new_table =qemu_blockalign (s->bs, len_bytes); - iov = (struct iovec ) { - .iov_base = new_table->offsets, - .iov_len = len_bytes, - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov, new_table->offsets, len_bytes);/* Byteswap table */ for (i = start; i < end; i++) {
block/qed.c +9 -22
@@ -113,18 +113,13 @@ static int coroutine_fn qed_write_header(BDRVQEDState *s)int nsectors =DIV_ROUND_UP (sizeof (QEDHeader),BDRV_SECTOR_SIZE );size_t len = nsectors *BDRV_SECTOR_SIZE ;uint8_t *buf; -struct iovec iov;QEMUIOVector qiov;int ret;assert (s->allocating_acb || s->allocating_write_reqs_plugged); buf =qemu_blockalign (s->bs, len); - iov = (struct iovec ) { - .iov_base = buf, - .iov_len = len, - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov, buf, len); ret =bdrv_co_preadv (s->bs->file,0 , qiov.size, &qiov,0 );if (ret <0 ) {
@@ -913,7 +908,6 @@ static int coroutine_fn qed_copy_from_backing_file(BDRVQEDState *s, {QEMUIOVector qiov;QEMUIOVector *backing_qiov =NULL ; -struct iovec iov;int ret;/* Skip copy entirely if there is no work to do */
@@ -921,11 +915,7 @@ static int coroutine_fn qed_copy_from_backing_file(BDRVQEDState *s,return 0 ; } - iov = (struct iovec ) { - .iov_base =qemu_blockalign (s->bs, len), - .iov_len = len, - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov,qemu_blockalign (s->bs, len), len); ret =qed_read_backing_file (s, pos, &qiov, &backing_qiov);
@@ -946,7 +936,7 @@ static int coroutine_fn qed_copy_from_backing_file(BDRVQEDState *s, } ret =0 ; out: -qemu_vfree (iov.iov_base); +qemu_vfree (qemu_iovec_buf (&qiov));return ret; }
@@ -1447,8 +1437,12 @@ static int coroutine_fn bdrv_qed_co_pwrite_zeroes(BlockDriverState *bs, BdrvRequestFlags flags) {BDRVQEDState *s = bs->opaque; -QEMUIOVector qiov; -struct iovec iov; + +/* +* Zero writes start without an I/O buffer. If a buffer becomes necessary +* then it will be allocated during request processing. +*/ +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov,NULL , bytes);/* Fall back if the request is not aligned */ if (qed_offset_into_cluster(s, offset) ||
@@ -1456,13 +1450,6 @@ static int coroutine_fn bdrv_qed_co_pwrite_zeroes(BlockDriverState *bs,return -ENOTSUP ; } -/* Zero writes start without an I/O buffer. If a buffer becomes necessary -* then it will be allocated during request processing. -*/ - iov.iov_base =NULL ; - iov.iov_len = bytes; - -qemu_iovec_init_external (&qiov, &iov,1 );return qed_co_request (bs, offset >>BDRV_SECTOR_BITS , &qiov, bytes >>BDRV_SECTOR_BITS ,QED_AIOCB_WRITE |QED_AIOCB_ZERO );
Signature · 1 line
2.18.0
PATCH v4 11/17 block/vmdk: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- block/vmdk.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
block/vmdk.c +1 -6
@@ -1371,7 +1371,6 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,VmdkGrainMarker *data =NULL ;uLongf buf_len;QEMUIOVector local_qiov; -struct iovec iov;int64_t write_offset;int64_t write_end_sector;
@@ -1399,11 +1398,7 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, data->size =cpu_to_le32 (buf_len); n_bytes = buf_len +sizeof (VmdkGrainMarker); - iov = (struct iovec ) { - .iov_base = data, - .iov_len = n_bytes, - }; -qemu_iovec_init_external (&local_qiov, &iov,1 ); +qemu_iovec_init_buf (&local_qiov, data, n_bytes);BLKDBG_EVENT (extent->file,BLKDBG_WRITE_COMPRESSED ); }else {
Signature · 1 line
2.18.0
PATCH v4 12/17 qemu-img: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- qemu-img.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
qemu-img.c +2 -8
@@ -1670,7 +1670,6 @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, {int n, ret;QEMUIOVector qiov; -struct iovec iov;assert (nb_sectors <= s->buf_sectors);while (nb_sectors >0 ) {
@@ -1686,9 +1685,7 @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, bs_sectors = s->src_sectors[src_cur]; n =MIN (nb_sectors, bs_sectors - (sector_num - src_cur_offset)); - iov.iov_base = buf; - iov.iov_len = n <<BDRV_SECTOR_BITS ; -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov, buf, n <<BDRV_SECTOR_BITS ); ret = blk_co_preadv( blk, (sector_num - src_cur_offset) << BDRV_SECTOR_BITS,
@@ -1712,7 +1709,6 @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, {int ret;QEMUIOVector qiov; -struct iovec iov;while (nb_sectors >0 ) {int n = nb_sectors;
@@ -1740,9 +1736,7 @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, (s->compressed && !buffer_is_zero(buf, n * BDRV_SECTOR_SIZE))) { - iov.iov_base = buf; - iov.iov_len = n <<BDRV_SECTOR_BITS ; -qemu_iovec_init_external (&qiov, &iov,1 ); +qemu_iovec_init_buf (&qiov, buf, n <<BDRV_SECTOR_BITS ); ret =blk_co_pwritev (s->target, sector_num <<BDRV_SECTOR_BITS , n <<BDRV_SECTOR_BITS , &qiov, flags);
Signature · 1 line
2.18.0
PATCH v4 13/17 migration/block: use qemu_iovec_init_buf
In reply to Vladimir Sementsov-OgievskiyUse new qemu_iovec_init_buf() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- migration/block.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
migration/block.c +3 -7
@@ -83,7 +83,6 @@ typedef struct BlkMigBlock {BlkMigDevState *bmds;int64_t sector;int nr_sectors; -struct iovec iov;QEMUIOVector qiov;BlockAIOCB *aiocb;
@@ -314,9 +313,7 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds) blk->sector = cur_sector; blk->nr_sectors = nr_sectors; - blk->iov.iov_base = blk->buf; - blk->iov.iov_len = nr_sectors *BDRV_SECTOR_SIZE ; -qemu_iovec_init_external (&blk->qiov, &blk->iov,1 ); +qemu_iovec_init_buf (&blk->qiov, blk->buf, nr_sectors *BDRV_SECTOR_SIZE );blk_mig_lock (); block_mig_state.submitted++;
@@ -556,9 +553,8 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, blk->nr_sectors = nr_sectors;if (is_async) { - blk->iov.iov_base = blk->buf; - blk->iov.iov_len = nr_sectors *BDRV_SECTOR_SIZE ; -qemu_iovec_init_external (&blk->qiov, &blk->iov,1 ); +qemu_iovec_init_buf (&blk->qiov, blk->buf, + nr_sectors *BDRV_SECTOR_SIZE ); blk->aiocb = blk_aio_preadv(bmds->blk, sector * BDRV_SECTOR_SIZE,
Signature · 1 line
2.18.0
PATCH v4 14/17 tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF
In reply to Vladimir Sementsov-OgievskiyUse new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code.
--- tests/test-bdrv-drain.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-)
tests/test-bdrv-drain.c +4 -25
@@ -204,12 +204,7 @@ static void test_drv_cb_common(enum drain_type drain_type, bool recursive)BlockAIOCB *acb;int aio_ret; -QEMUIOVector qiov; -struct iovec iov = { - .iov_base =NULL , - .iov_len =0 , - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov,NULL ,0 ); blk =blk_new (BLK_PERM_ALL ,BLK_PERM_ALL ); bs = bdrv_new_open_driver(&bdrv_test, "test-node", BDRV_O_RDWR,
@@ -670,12 +665,7 @@ static void test_iothread_common(enum drain_type drain_type, int drain_thread)AioContext *ctx_a =iothread_get_aio_context (a);AioContext *ctx_b =iothread_get_aio_context (b); -QEMUIOVector qiov; -struct iovec iov = { - .iov_base =NULL , - .iov_len =0 , - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov,NULL ,0 );/* bdrv_drain_all() may only be called from the main loop thread */ if (drain_type ==BDRV_DRAIN_ALL && drain_thread !=0 ) {
@@ -1148,13 +1138,7 @@ static void coroutine_fn test_co_delete_by_drain(void *opaque)BlockDriverState *bs =blk_bs (blk);BDRVTestTopState *tts = bs->opaque;void *buffer =g_malloc (65536 ); -QEMUIOVector qiov; -struct iovec iov = { - .iov_base = buffer, - .iov_len =65536 , - }; - -qemu_iovec_init_external (&qiov, &iov,1 ); +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov, buffer,65536 );/* Pretend some internal write operation from parent to child. * Important: We have to read from the child, not from the parent!
@@ -1365,12 +1349,7 @@ static void test_detach_indirect(bool by_parent_cb)BdrvChild *child_a, *child_b;BlockAIOCB *acb; -QEMUIOVector qiov; -struct iovec iov = { - .iov_base =NULL , - .iov_len =0 , - }; -qemu_iovec_init_external (&qiov, &iov,1 ); +QEMUIOVector qiov =QEMU_IOVEC_INIT_BUF (qiov,NULL ,0 );if (!by_parent_cb) { detach_by_driver_cb_role = child_file;
Signature · 1 line
2.18.0
PATCH v4 15/17 hw/ide: drop iov field from IDEState
In reply to Vladimir Sementsov-Ogievskiy@iov is used only to initialize @qiov. Let's use new qemu_iovec_init_buf() instead, which simplifies the code.
--- include/hw/ide/internal.h | 1 - hw/ide/atapi.c | 9 ++++----- hw/ide/core.c | 8 ++------ 3 files changed, 6 insertions(+), 12 deletions(-)
include/hw/ide/internal.h +0 -1
@@ -405,7 +405,6 @@ struct IDEState {int atapi_dma;/* true if dma is requested for the packet cmd */ BlockAcctCookie acct;BlockAIOCB *pio_aiocb; -struct iovec iov;QEMUIOVector qiov; QLIST_HEAD(, IDEBufferedRequest) buffered_requests;/* ATA DMA state */
hw/ide/atapi.c +4 -5
@@ -174,16 +174,15 @@ static void cd_read_sector_cb(void *opaque, int ret)static int cd_read_sector (IDEState *s) { +void *buf; +if (s->cd_sector_size !=2048 && s->cd_sector_size !=2352 ) {block_acct_invalid (blk_get_stats (s->blk),BLOCK_ACCT_READ );return -EINVAL ; } - s->iov.iov_base = (s->cd_sector_size ==2352 ) ? - s->io_buffer +16 : s->io_buffer; - - s->iov.iov_len =ATAPI_SECTOR_SIZE ; -qemu_iovec_init_external (&s->qiov, &s->iov,1 ); + buf = (s->cd_sector_size ==2352 ) ? s->io_buffer +16 : s->io_buffer; +qemu_iovec_init_buf (&s->qiov, buf,ATAPI_SECTOR_SIZE );trace_cd_read_sector (s->lba);
hw/ide/core.c +2 -6
@@ -774,9 +774,7 @@ static void ide_sector_read(IDEState *s)return ; } - s->iov.iov_base = s->io_buffer; - s->iov.iov_len = n *BDRV_SECTOR_SIZE ; -qemu_iovec_init_external (&s->qiov, &s->iov,1 ); +qemu_iovec_init_buf (&s->qiov, s->io_buffer, n *BDRV_SECTOR_SIZE );block_acct_start (blk_get_stats (s->blk), &s->acct, n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_READ );
@@ -1045,9 +1043,7 @@ static void ide_sector_write(IDEState *s)return ; } - s->iov.iov_base = s->io_buffer; - s->iov.iov_len = n *BDRV_SECTOR_SIZE ; -qemu_iovec_init_external (&s->qiov, &s->iov,1 ); +qemu_iovec_init_buf (&s->qiov, s->io_buffer, n *BDRV_SECTOR_SIZE );block_acct_start (blk_get_stats (s->blk), &s->acct, n *BDRV_SECTOR_SIZE ,BLOCK_ACCT_WRITE );
Signature · 1 line
2.18.0
PATCH v4 16/17 hw/ide: drop iov field from IDEBufferedRequest
In reply to Vladimir Sementsov-Ogievskiy@iov is used only to initialize @qiov. Let's use new qemu_iovec_init_buf() instead, which simplifies the code.
--- include/hw/ide/internal.h | 1 - hw/ide/core.c | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/ide/internal.h +0 -1
@@ -346,7 +346,6 @@ extern const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT]; typedef struct IDEBufferedRequest { QLIST_ENTRY(IDEBufferedRequest) list; - struct iovec iov; QEMUIOVector qiov; QEMUIOVector *original_qiov; BlockCompletionFunc *original_cb;
hw/ide/core.c +6 -5
@@ -629,13 +629,15 @@ static void ide_buffered_readv_cb(void *opaque, int ret)IDEBufferedRequest *req = opaque;if (!req->orphaned) {if (!ret) { -qemu_iovec_from_buf (req->original_qiov,0 , req->iov.iov_base, +assert (req->qiov.size == req->original_qiov->size); +qemu_iovec_from_buf (req->original_qiov,0 , + req->qiov.local_iov.iov_base, req->original_qiov->size); } req->original_cb (req->original_opaque, ret); }QLIST_REMOVE (req, list); -qemu_vfree (req->iov.iov_base); +qemu_vfree (qemu_iovec_buf (&req->qiov));g_free (req); }
@@ -660,9 +662,8 @@ BlockAIOCB *ide_buffered_readv(IDEState *s, int64_t sector_num, req->original_qiov = iov; req->original_cb = cb; req->original_opaque = opaque; - req->iov.iov_base =qemu_blockalign (blk_bs (s->blk), iov->size); - req->iov.iov_len = iov->size; -qemu_iovec_init_external (&req->qiov, &req->iov,1 ); +qemu_iovec_init_buf (&req->qiov,blk_blockalign (s->blk, iov->size), + iov->size); aioreq =blk_aio_preadv (s->blk, sector_num <<BDRV_SECTOR_BITS , &req->qiov,0 , ide_buffered_readv_cb, req);
Signature · 1 line
2.18.0
PATCH v4 17/17 hw/ide: drop iov field from IDEDMA
In reply to Vladimir Sementsov-Ogievskiy@iov is used only to initialize @qiov. Let's use new qemu_iovec_init_buf() instead, which simplifies the code.
--- include/hw/ide/internal.h | 1 - hw/ide/atapi.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
include/hw/ide/internal.h +0 -1
@@ -455,7 +455,6 @@ struct IDEDMAOps {struct IDEDMA {const struct IDEDMAOps *ops; -struct iovec iov;QEMUIOVector qiov;BlockAIOCB *aiocb; };
hw/ide/atapi.c +2 -3
@@ -420,9 +420,8 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) data_offset =0 ; }trace_ide_atapi_cmd_read_dma_cb_aio (s, s->lba, n); - s->bus->dma->iov.iov_base = (void *)(s->io_buffer + data_offset); - s->bus->dma->iov.iov_len = n *ATAPI_SECTOR_SIZE ; -qemu_iovec_init_external (&s->bus->dma->qiov, &s->bus->dma->iov,1 ); +qemu_iovec_init_buf (&s->bus->dma->qiov, s->io_buffer + data_offset, + n *ATAPI_SECTOR_SIZE ); s->bus->dma->aiocb = ide_buffered_readv(s, (int64_t)s->lba << 2, &s->bus->dma->qiov, n * 4,
Signature · 1 line
2.18.0
Stefan Hajnoczi
AppliedQuoted 59 lines · Vladimir Sementsov-Ogievskiy
Hi all!
Here is a new simple helper for a very often patter around
qemu_iovec_init_external, when we need simple qiov with only one iov, initialized from external buffer.v4:
01: tiny improvements by Eric
+ fix bug: s/niov/nalloc in assertion
+ rename s/qemu_iovec_get_buf/qemu_iovec_buf,
to don't look like getter, which in turn should not return pointer to something internal to be freed separately.
So, no r-b's in 01
07,10,16
- rebase on new function nameqemu_iovec_buf
- save r-b's by Eric and Stefan
others unchanged, add r-b's by Eric and Stefanv3:
01-02: tiny improvements, described in patch-emails 03-17: new patchesNote: only
hw/scsi/scsi-disk.cnot updated, as it has too tricky
logic around @iov fields of structures. So, it is simpler to keep it as is.v2 was "[PATCH v2 0/2] block: local qiov helper: part I"
https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg01610.htmlVladimir Sementsov-Ogievskiy (17):
block: enhance QEMUIOVector structure
block/io: useqemu_iovec_init_buf
block/block-backend: useQEMU_IOVEC_INIT_BUF
block/backup: useqemu_iovec_init_buf
block/commit: useQEMU_IOVEC_INIT_BUF
block/stream: useQEMU_IOVEC_INIT_BUF
block/parallels: useQEMU_IOVEC_INIT_BUF
block/qcow: useqemu_iovec_init_buf
block/qcow2: useqemu_iovec_init_buf
block/qed: useqemu_iovec_init_buf
block/vmdk: useqemu_iovec_init_buf
qemu-img: useqemu_iovec_init_buf
migration/block: useqemu_iovec_init_buf
tests/test-bdrv-drain: useQEMU_IOVEC_INIT_BUF
hw/ide: drop iov field from IDEState
hw/ide: drop iov field from IDEBufferedRequest
hw/ide: drop iov field from IDEDMAinclude/hw/ide/internal.h | 3 -- include/qemu/iov.h | 64 +++++++++++++++++++++++++++- block/backup.c | 5 +-- block/block-backend.c | 13 +----- block/commit.c | 7 +-- block/io.c | 89 +++++++++------------------------------ block/parallels.c | 13 +++--- block/qcow.c | 21 ++------- block/qcow2.c | 12 +----- block/qed-table.c | 16 ++----- block/qed.c | 31 ++++----------
Quoted 13 lines
block/stream.c | 7 +-- block/vmdk.c | 7 +-- hw/ide/atapi.c | 14 +++--- hw/ide/core.c | 19 ++++----- migration/block.c | 10 ++--- qemu-img.c | 10 +---- tests/test-bdrv-drain.c | 29 ++----------- 18 files changed, 134 insertions(+), 236 deletions(-)Signature · 1 line
2.18.0
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan