[PATCH] avoid unnnecessary mtd read when read can be satisfied by write buffer

Jörn Engel joern at wohnheim.fh-wedel.de
Thu Jun 1 10:49:02 EDT 2006


On Thu, 1 June 2006 15:39:34 +0100, David Woodhouse wrote:
> On Thursday 01 June 2006 15:32, Jörn Engel wrote:
> > Not sure whether this micro optimization is worth the code.  A real
> > solution would be to have a cache for the full device.  Possibly read
> > the device through pagecache somehow (writing obviously should be
> > write-through, not write-back).  That would have a significantly
> > higher hit rate than your patch.
> 
> We haven't written to the device yet, at this point -- this is just the case 
> where the data in question exist _only_ in the wbuf, but we're actually 
> reading from the flash first _anyway_, with the current code. 

Good point.  Ignore my objections then.

> I don't think that caching the compressed nodes from the flash is going to be 
> particularly useful -- we already have the page cache for _uncompressed_ 
> data. For other things we might want to cache, such as dirents and symlinks, 
> we'll do _much_ better to store that in memory for ourselves rather than just 
> caching whole pages of the backing store for such sparse content.

My observations have been a bit different.  I've had to deal with a
semi-broken simulator, where flash accesses were unbearably slow.
Booting took about an hour.  The simulator has been fixed since, but
the broken state made some details fairly visible. :)

One of the observations was that a lot of flash is being read multiple
times.  Reads on NAND happen in page granularity, so first we have to
read pretty much everything during scan, later again when accessing
the actual files.  There is some room for savings, as RAM is faster
than flash even in the real world.

Jörn

-- 
A quarrel is quickly settled when deserted by one party; there is
no battle unless there be two.
-- Seneca




More information about the linux-mtd mailing list