On Mon, Sep 30, 2019 at 01:11:38AM -0700, Christoph Hellwig wrote: > On Fri, Sep 27, 2019 at 01:17:52PM -0400, Brian Foster wrote: > > The upcoming allocation algorithm update searches multiple > > allocation btree cursors concurrently. As such, it requires an > > active state to track when a particular cursor should continue > > searching. While active state will be modified based on higher level > > logic, we can define base functionality based on the result of > > allocation btree lookups. > > > > Define an active flag in the private area of the btree cursor. > > Update it based on the result of lookups in the existing allocation > > btree helpers. Finally, provide a new helper to query the current > > state. > > I vaguely remember having the discussion before, but why isn't the > active flag in the generic part of xfs_btree_cur and just tracked > for all types? That would seem bother simpler and more useful in > the long run. The active flag was in the allocation cursor originally and was moved to the private portion of the btree cursor simply because IIRC that's where you suggested to put it. FWIW, that seems like the appropriate place to me because 1.) as of right now I don't have any other use case in mind outside of allocbt cursors 2.) flag state is similarly managed in the allocation btree helpers and 3.) the flag is not necessarily used as a generic btree cursor state (it is more accurately a superset of the generic btree state where the allocation algorithm can also make higher level changes). The latter bit is why it was originally put in the allocation tracking structure, FWIW. I've no fundamental objection to moving some or all of this to more generic code down the road, but I'd prefer not to do that until there's another user so the above can be rectified against an actual use case. I can include the reasoning for the current placement in the commit log description if that is useful. Brian