On Mon, 01/13 23:44, rudy...@163.com wrote: > Hi,everyone. > I tested the capability of drive mirror, I found the IO is low. Then I read > the code, > The code mirror_run() will call mirror_iteration() to read the size of buffer > data > from source storage, when the read callback ,and then in mirror_read_complete > () > write the data to the target storage, It is serial. > Now, I hope when it is writing the data to target storage ,we can send the > request > of reading data from source storage. Because of using coroutine to do it > ,there is > some troubles to achieve it. why not use Multi-thread? > Some one can give me some idea?
Hi, QEMU block layer has been using coroutine as the program model even before introducing these block jobs, so it was nature that block mirror followed this style. With coroutines, I believe it is as possible as with multi-thread, to have more outstanding IO requests, in order to speed up the mirroring. What's the trouble you have? Multi-threading needs much more synchronization mechanism than what we have in block interface now. One day it may be possible to move block job to a thread, but it will require quite some work. Fam