Am 09.05.2016 um 15:17 hat Stefan Hajnoczi geschrieben: > On Fri, Apr 22, 2016 at 07:42:38PM +0200, Kevin Wolf wrote: > > This removes the last part of I/O throttling from block/io.c and moves > > it to the BlockBackend. > > > > Instead of having knowledge about throttling inside io.c, we can call a > > BdrvChild callback .drained_begin/end, which happens to drain the > > throttled requests for BlockBackend parents. > > > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > > --- > > block/block-backend.c | 32 +++++++++++++++++++++++++++----- > > block/io.c | 39 ++++++++++++++++++--------------------- > > include/block/block_int.h | 8 +++----- > > 3 files changed, 48 insertions(+), 31 deletions(-) > > I'm confused about the naming. BdrvChildRole.drained_begin/end and > bdrv_parent_drained_begin/end have nothing to do with > bdrv_drained_begin()/bdrv_drained_end()?
Hm, you may have a point there. I think we need to add another pair of calls in bdrv_drained_begin()/bdrv_drained_end(). We just want to call the callbacks as well on a simple bdrv_drain() or bdrv_drain_all(), so the existing calls should be right. > If these were callbacks that happened at bdrv_drained_begin/end time > then I could understand, but that doesn't seem to be the case. > > What are the semantics of these callbacks? Maybe we can find a clearer > name. I think the point is not to "drain" (in the sense of completing > requests) but simply to restart queued requests? This is just a different perspective on the same thing, as these callbacks are always called as part of a bdrv_drain(). Any request that is restarted is also completed before bdrv_drain() returns. The intended semantics is that a parent doesn't submit new requests after returning from .drained_begin() until .drained_end() is called. The easy implementation for throttling was to simply restart the requests like the old implementation did. Kevin
pgpyN5xD6Bn7N.pgp
Description: PGP signature