On Fri, Apr 12, 2013 at 2:22 PM, Kevin Wolf <kw...@redhat.com> wrote: > Am 12.04.2013 um 14:06 hat Stefan Hajnoczi geschrieben: >> On Fri, Apr 12, 2013 at 12:27 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: >> > Il 12/04/2013 12:04, Kevin Wolf ha scritto: >> >> Or actually, if you want to avoid .bdrv_drain for now, the patch that I >> >> started when I thought a bit about this, had a default .bdrv_drain >> >> implementation that just forwarded the request to bs->file if it wasn't >> >> implemented by a block driver. For the QED case, this would work. >> > >> > It's similar to bdrv_co_flush. Drain bs first, then bs->backing_hd >> > (this is not needed in bdrv_co_flush), then bs->file, then the driver >> > can do it on other files. >> >> Thanks for explaining Kevin. I didn't check whether bdrv_states >> included all BlockDriverStates. >> >> The simplest solution is to put all BlockDriverStates on a global list. >> >> A .bdrv_drain() interface is more flexible but I don't see a need for it yet. > > We don't need the .bdrv_drain() callback yet, but please implement it > without a global list and with a function that forwards requests to > bs->file and bs->backing_hd like Paolo suggested. This will be the > obvious place to add the .bdrv_drain() callback later. > > The reason why I prefer this approach is that it allows draining a > single BlockDriverState. After your patches we're really close to > enabling this and converting some bdrv_drain_all() to more specific > bdrv_drain(bs) calls.
Fair enough, that approach does make it possible to drain single devices in the future. Stefan