tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF
Use new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20190218140926.333779-15-vsementsov@virtuozzo.com Message-Id: <20190218140926.333779-15-vsementsov@virtuozzo.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
f556f37b11
commit
405d8fe0ba
@ -204,12 +204,7 @@ static void test_drv_cb_common(enum drain_type drain_type, bool recursive)
|
|||||||
BlockAIOCB *acb;
|
BlockAIOCB *acb;
|
||||||
int aio_ret;
|
int aio_ret;
|
||||||
|
|
||||||
QEMUIOVector qiov;
|
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, NULL, 0);
|
||||||
struct iovec iov = {
|
|
||||||
.iov_base = NULL,
|
|
||||||
.iov_len = 0,
|
|
||||||
};
|
|
||||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
|
||||||
|
|
||||||
blk = blk_new(BLK_PERM_ALL, BLK_PERM_ALL);
|
blk = blk_new(BLK_PERM_ALL, BLK_PERM_ALL);
|
||||||
bs = bdrv_new_open_driver(&bdrv_test, "test-node", BDRV_O_RDWR,
|
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_a = iothread_get_aio_context(a);
|
||||||
AioContext *ctx_b = iothread_get_aio_context(b);
|
AioContext *ctx_b = iothread_get_aio_context(b);
|
||||||
|
|
||||||
QEMUIOVector qiov;
|
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, NULL, 0);
|
||||||
struct iovec iov = {
|
|
||||||
.iov_base = NULL,
|
|
||||||
.iov_len = 0,
|
|
||||||
};
|
|
||||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
|
||||||
|
|
||||||
/* bdrv_drain_all() may only be called from the main loop thread */
|
/* bdrv_drain_all() may only be called from the main loop thread */
|
||||||
if (drain_type == BDRV_DRAIN_ALL && drain_thread != 0) {
|
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);
|
BlockDriverState *bs = blk_bs(blk);
|
||||||
BDRVTestTopState *tts = bs->opaque;
|
BDRVTestTopState *tts = bs->opaque;
|
||||||
void *buffer = g_malloc(65536);
|
void *buffer = g_malloc(65536);
|
||||||
QEMUIOVector qiov;
|
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buffer, 65536);
|
||||||
struct iovec iov = {
|
|
||||||
.iov_base = buffer,
|
|
||||||
.iov_len = 65536,
|
|
||||||
};
|
|
||||||
|
|
||||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
|
||||||
|
|
||||||
/* Pretend some internal write operation from parent to child.
|
/* Pretend some internal write operation from parent to child.
|
||||||
* Important: We have to read from the child, not from the parent!
|
* 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;
|
BdrvChild *child_a, *child_b;
|
||||||
BlockAIOCB *acb;
|
BlockAIOCB *acb;
|
||||||
|
|
||||||
QEMUIOVector qiov;
|
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, NULL, 0);
|
||||||
struct iovec iov = {
|
|
||||||
.iov_base = NULL,
|
|
||||||
.iov_len = 0,
|
|
||||||
};
|
|
||||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
|
||||||
|
|
||||||
if (!by_parent_cb) {
|
if (!by_parent_cb) {
|
||||||
detach_by_driver_cb_role = child_file;
|
detach_by_driver_cb_role = child_file;
|
||||||
|
Loading…
Reference in New Issue
Block a user