[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/16] block: change drain to look only at one c
Re: [Qemu-devel] [PATCH 07/16] block: change drain to look only at one child at a time
Wed, 9 Mar 2016 08:49:07 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
On 09/03/2016 04:41, Fam Zheng wrote:
> > bdrv_requests_pending is checking children to also wait until internal
> > requests (such as metadata writes) have completed. However, checking
> > children is in general overkill because, apart from this special case,
> > the parent's in_flight count will always be incremented by at least one
> > for every request in the child.
> While the patch looks good, I'm not sure I understand this: aren't children's
> requests generated by the child itself, how is parent's in_flight incremented?
What I mean is that there are two cases of bs generating I/O on
1) writes caused by an operation on bs, e.g. a bdrv_aio_write to bs. In
this case, the bdrv_aio_write increments bs's in_flight count
2) asynchronous metadata writes or flushes. Such writes can be started
even if bs's in_flight count is zero, but not after the .bdrv_drain
callback has been invoked. So the correct sequence is:
- finish current I/O
- call bdrv_drain callback
- recurse on children
This is what is needed for QED's callback to work correctly, and I'll
implement it this way in v2.