On 12/04/2018 13:53, Kevin Wolf wrote: >> The problem I have is that there is a direction through which I/O flows >> (parent-to-child), so why can't draining follow that natural direction. >> Having to check for the parents' I/O, while draining the child, seems >> wrong. Perhaps we can't help it, but I cannot understand the reason. > I'm not sure what's there that could be not understood. You already > confirmed that we need to drain the parents, too, when we drain a node. > Drain really must propagate in the opposite direction of I/O, because > part of its job is to quiesce the origin of any I/O to the node that > should be drained. Opposite of I/O _is_ the natural direction for drain.
Opposite of I/O is the natural direction for drain to propagate, yes. However, I/O direction is the natural direction for requests to stop. After quiescing X and calling X->drv->bdrv_drain(X), there can be pending requests only in X's children. So I don't understand why you need to keep checking in_flight over the whole subgraph, when there are roots that will conclude their request first, and then their children, and so on so forth. Thanks, Paolo > We also have subtree drains, but that's not because that's the natural > direction for drain, but just as a convenience function because some > operations (e.g. reopen) affect a whole subtree, so they need everything > in that subtree drained rather than just a single node.