On Mon, Jan 22, 2018 at 05:45:49PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Is it a bug or a feature? Why do we call inc/dec twice for read/write? > We don't do this for flush and discard..
It's non-obvious and I asked Paolo the same question previously. > - bdrv_inc_in_flight(bs); > - > /* throttling disk I/O */ > if (blk->public.throttle_group_member.throttle_state) { > > throttle_group_co_io_limits_intercept(&blk->public.throttle_group_member, > bytes, false); > } ^^^ HINT HINT HINT ^^^ > > - ret = bdrv_co_preadv(blk->root, offset, bytes, qiov, flags); > - bdrv_dec_in_flight(bs); > - return ret; > + return bdrv_co_preadv(blk->root, offset, bytes, qiov, flags); The problem is what happens if the request is throttled? Even throttled requests must be counted so that bdrv_drain() and friends work. It may be possible to eliminate this now that throttling is a BDS node. It used to be implemented as a completely separate API outside the BDS node graph. Now there is a throttling node in the graph, so maybe we can stop taking the extra reference but some refactoring may be necessary. Stefan
signature.asc
Description: PGP signature