xfs
[Top] [All Lists]

Re: [PATCH 5/6] [XFS] Replace per-ag array with a radix tree

To: Dave Chinner <david@xxxxxxxxxxxxx>, Nick Piggin <npiggin@xxxxxxx>
Subject: Re: [PATCH 5/6] [XFS] Replace per-ag array with a radix tree
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 11 Dec 2009 06:46:27 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20091211004353.GF30608@xxxxxxxxxxxxxxxx>
References: <1259734299-20306-1-git-send-email-david@xxxxxxxxxxxxx> <1259734299-20306-6-git-send-email-david@xxxxxxxxxxxxx> <20091210234547.GA28289@xxxxxxxxxxxxx> <20091211004353.GF30608@xxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
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

<Prev in Thread] Current Thread [Next in Thread>