mtdblock caching and syncing

Doug Graham dgraham at nortel.com
Thu Apr 9 15:24:31 EDT 2009


On Thu, Apr 09, 2009 at 07:07:24PM +0100, Jamie Lokier wrote:
> Doug Graham wrote:
> > > The device in question isn't the flash.  It's the mtdblock device.  So
> > > fsync semantics are preserved.  This is the same as writing to a file
> > > on a hard drive, calling fsync, and having it sit in the hard drive's
> > > cache.
> > 
> > That's a good point, and one I've wondered about before.  I don't know
> > much about how hard drives manage their cache, but I would assume that
> > they don't leave dirty data in their cache for an unbounded period
> > of time.  I'd guess that data is written to the actual disk within a
> > few 10s of milliseconds after being sent to the device.
> 
> Ideally, fsync() should flush data from a hard drive's cache too.

That seems ideal to me too, and if Linux had the framework to support
that, the solution to the mtdblock problem would be trivial.  I'd guess
that the cleanest way to do this would be to add a sync() method to
block_device_operations.

--Doug.



More information about the linux-mtd mailing list