[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:32:49 EDT 2006


On Wed, 31 May 2006 15:50:28 -0600, Kevin Vigor wrote:
> 
> The following small patch modifies wbuf.c::jffs2_flash_read to avoid a 
> call to the mtd read layer in the case where all data returned by the 
> read would be replaced by data from the write buffer anyway. This 
> condition occurs relatively infrequently, but the cost of the test is 
> low and the benefit of avoiding the mtd read is high.

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.

Jörn

-- 
Don't worry about people stealing your ideas. If your ideas are any good,
you'll have to ram them down people's throats.
-- Howard Aiken quoted by Ken Iverson quoted by Jim Horning quoted by
   Raph Levien, 1979




More information about the linux-mtd mailing list