some confusion on qemu i/o pocess and the qcow2 format
1.what is the difference of bdrv_co_readv and bdrv_aio_readv?
2.I am confused about the I/O pocess of qcow2, i find. Can anybody tell me the detail pocess? or arethere any useful tools to trace the pocess?
Quoted 1 line · 浩樊啊
1.what is the difference of
bdrv_co_readvand bdrv_aio_readv?
bdrv_aio_readv() takes a callback function pointer and returns a request struct. The callback will be invoked when the request has completed.
bdrv_co_readv() must be called from coroutine context. It performs the request and then returns. This is similar to traditional preadv(2) except the coroutine will yield back to the QEMU event loop instead of blocking the thread.
Please take a look at include/qemu/coroutine.h if you'd like to learn more about coroutines.
I have also written about coroutines here:
http://blog.vmsplice.net/2014/01/coroutines-in-qemu-basics.html
Quoted 1 line
2.I am confused about the I/O pocess of qcow2, i find. Can anybody tell me the detail pocess? or arethere any useful tools to trace the pocess?
Unless you have more specific questions, the only advice I can give is to read the source code and/or add printfs to help you understand the code execution.
Re: [Qemu-devel] 回复: some confusion on qemu i/o pocess and the qcow2format
In reply to a message not in the archiveQuoted 4 lines · 浩樊啊
I read the source code of qcow2.
I can see bdrv_co_do_readv---bdrv_co_do_preadv---bdrv_aligned_preadv---drv->bdrv_co_readv (here drv.bdrv_co_readv=qcow2_co_readv)
but when I readqcow2_co_readv->bdrv_co_readv->bdrv_co_do_readv->bdrv_co_do_preadvI am confused about this.qcow2_co_readvusebdrv_co_do_preadvagain?
The qcow2 BlockDriverState uses a file BlockDriverState to do the actual I/O. This way the qcow2 image format can be used on POSIX files, iSCSI LUNs, Gluster files, etc.
It means that qcow2 code does not call preadv(2)/pwritev(2) directly but instead uses another BlockDriverState to perform the actual I/O. In QEMU we keep "image format" block drivers (e.g. qcow2, vmdk, vhdx) separate from "protocol" block drivers (e.g. POSIX, Win32, Gluster, Sheepdog, iSCSI).
Stefan
[Qemu-devel] 回复: 回复: someconfusion on qemu i/o pocess and the qcow2format
I want to change the queue_size of virtio-blk ring from 128 to 1024, so I change here:s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output);
but the vm will not work. Are any thing i missed ?
Re: [Qemu-devel] 回复: 回复: someconfusion on qemu i/o pocess and the qcow2format
Quoted 3 lines · 浩樊啊
I want to change the
queue_sizeof virtio-blk ring from 128 to 1024, so I change here:s->vq=virtio_add_queue(vdev, 128, virtio_blk_handle_output);
but the vm will not work. Are any thing i missed ?
I think 1024 should work in theory (it's the max supported virtqueue size). You'd have to debug it to figure out why.
Stefan