On 05/11/2015 17:35, Stefan Hajnoczi wrote:
>> >  void bdrv_drain(BlockDriverState *bs)
>> >  {
>> > +    BdrvChild *child;
>> >      bool busy = true;
>> >  
>> > +    if (bs->drv && bs->drv->bdrv_drain) {
>> > +        bs->drv->bdrv_drain(bs);
>> > +    }
>> > +    QLIST_FOREACH(child, &bs->children, next) {
>> > +        bdrv_drain(child->bs);
>> > +    }
>> >      while (busy) {
>> >          /* Keep iterating */
>> >           bdrv_flush_io_queue(bs);
> Recursing calls aio_poll() once for each BDS node and I think it's not
> necessary and could be a performance problem.

Indeed, only the call to bs->drv->bdrv_drain should be done recursively.

Paolo

Reply via email to