Yep. I think the first step should be to simplify the code to remove
all the insync/start optimisations and just implement it in a very
straightforward way. I can't see any way this code could be even
slightly performance critical.
Uh, I guess that's one way of putting it. The other is that it tests
for an obscure condition that's indirectly related to something that
might indicate a bug if the code were written differently. A good
BUG_ON/assert acts as documentation because it tells the reader about
the expected logical state at that point, but it needs to be expressed
in terms which are directly relevant to the algorithm in question.
J
--