On Fri, Dec 11, 2009 at 11:43:53AM +1100, Dave Chinner wrote:
> > > + spin_lock(&mp->m_perag_lock);
> > > + pag = radix_tree_lookup(&mp->m_perag_tree, agno);
> > > + spin_unlock(&mp->m_perag_lock);
> > > + return pag;
> >
> > Can't we do this as a lock-less (at least for lookups) radix tree?
>
> I think it can be (RCU-based?) , but I think that makes sense as a
> followup optimisation once we have confidence the code is working
> as it should.
Nick, what are the rules for the lock-less radix tree reader side?
Dave is introducing a radix tree in XFS which has the following access
pattern:
- lots of read side access during normal fs operations
- insertations currently only happen during mount before the fs is life
and during a very rare operation (filesystem resize)
- currently items are never deleted, but we might need that in the
future (for filesystem shrink support)
- the objects pointed to are kmalloced and refcounted structures,
but we don't even strictly need the refcounting until the filesystem
shrink support is implemented
|