Am 16.03.2017 um 01:46 hat John Snow geschrieben: > This lets us hook into drained_begin and drained_end requests from the > backend level, which is particularly useful for making sure that all > jobs associated with a particular node (whether the source or the target) > receive a drain request. > > Suggested-by: Kevin Wolf <kw...@redhat.com> > Signed-off-by: John Snow <js...@redhat.com> > > -- > > RFC topics: > > - BlkDevOps is traditionally only for Qdev devices, and a BlockJob is not > currently a 'device'... Do we want to loosen this restriction, find another > way to deliver callbacks to BlockJobs attached to BlkBackends, or do > something > crazy like make a BlockJob device object? > > struct JobDevice { > DeviceState parent_obj; > BlockJob *job; > } ...??
We should probably rename BlkDevOps to something that works not only for devices, but for any user of a BlockBackend. I don't think the implementation has to be changed, it's just a struct of callbacks and an opaque pointer that is actually properly treated as opaque. BlockBackend also has a dev field, which is indeed supposed to be a DeviceState and is sometimes casted to one (if we can assert !blk->legacy_dev), but it's a concept completely separate from BlkDevOps. So we just need to be sure not to call blk_attach_dev() or blk_attach_dev_legacy(). Kevin