On 20/12/2017 11:34, Kevin Wolf wrote:
> .inherit_options = bdrv_inherited_options,
> .drained_begin = bdrv_child_cb_drained_begin,
> .drained_end = bdrv_child_cb_drained_end,
> + .attach = bdrv_child_cb_attach,
> + .detach = bdrv_child_cb_detach,
> .inactivate = bdrv_child_cb_inactivate,
> };
>
> @@ -911,6 +933,8 @@ const BdrvChildRole child_format = {
> .inherit_options = bdrv_inherited_fmt_options,
> .drained_begin = bdrv_child_cb_drained_begin,
> .drained_end = bdrv_child_cb_drained_end,
> + .attach = bdrv_child_cb_attach,
> + .detach = bdrv_child_cb_detach,
> .inactivate = bdrv_child_cb_inactivate,
Is there any case of a BdrvChildRole that doesn't want these callbacks?
Maybe the functions should be called after ->attach and before ->detach
(e.g. bdrv_{,un}apply_subtree_drain), rather than modifying the
BdrvChildRole implementations.
Then they can be put in block/io.c, and bdrv_do_drained_* can remain
static. (I would also consider extracting block/drain.c, but it is
painful to do it now that you have this nice series---so let's do it after).
Paolo