On Mon, Oct 17, 2011 at 11:26 AM, Kevin Wolf <kw...@redhat.com> wrote: > Am 26.09.2011 09:24, schrieb Zhi Yong Wu: >> On Sat, Sep 24, 2011 at 12:19 AM, Kevin Wolf <kw...@redhat.com> wrote: >>> Am 08.09.2011 12:11, schrieb Zhi Yong Wu: >>>> Note: >>>> 1.) When bps/iops limits are specified to a small value such as 511 >>>> bytes/s, this VM will hang up. We are considering how to handle this >>>> senario. >>>> 2.) When "dd" command is issued in guest, if its option bs is set to >>>> a large value such as "bs=1024K", the result speed will slightly bigger >>>> than the limits. >>>> >>>> For these problems, if you have nice thought, pls let us know.:) >>>> >>>> Signed-off-by: Zhi Yong Wu <wu...@linux.vnet.ibm.com> >>>> --- >>>> block.c | 259 >>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- >>>> block.h | 1 - >>>> 2 files changed, 248 insertions(+), 12 deletions(-) >>> >>> One general comment: What about synchronous and/or coroutine I/O >>> operations? Do you think they are just not important enough to consider >>> here or were they forgotten? >> For sync ops, we assume that it will be converse into async mode at >> some point of future, right? >> For coroutine I/O, it is introduced in image driver layer, and behind >> bdrv_aio_readv/writev. I think that we need not consider them, right? > > Meanwhile the block layer has been changed to handle all requests in > terms of coroutines. So you would best move your intercepting code into > the coroutine functions.
Some additional info: the advantage of handling all requests in coroutines is that there is now a single place where you can put I/O throttling. It will work for bdrv_read(), bdrv_co_readv(), and bdrv_aio_readv(). There is no code duplication, just put the I/O throttling logic in bdrv_co_do_readv(). Stefan