[mpf70-devel] info about the cache used by the kernel module
Status: Inactive
Brought to you by:
jeremy_laine
From: Jeremy <jer...@m4...> - 2003-03-10 19:57:03
|
The mpf70 kernel module has a cache whose size is a multiple (MPF70_CACHE = 2 at present) of MPF70_BLOCK (=32) sectors. The reason for this cache is that the internal memory of the player is a flash device and whenever a write operation is requested to one or more sectors, the full corresponding block first gets erased! I had originally tried to set the block device's physical sector size to match the block size, but this value is too large and the kernel refuses it. Anyway, as the filesystem is FAT, the block device has to support 512 byte writes. Alan Cox was the one who suggested a buffer mechanism in response to a message I posted on the Linux kernel mailing list. The idea of the cache is that as we buffer sector write requests to the player until the sector we are asked to write is outside of the cache. A map of the sectors in the cache is maintained, so that when it is time to flush the cache, we know if any sectors need to be read off the player before we actually start writing. In practice, when writing files to the player we always write full blocks (except the very last sectors of the file) so no reading is required. Updating the FAT is a different story, as we only get a request to write a single 512 byte sector so here we do have to read the missing sectors from the player before the write occurs. This does not really cause a big performance hit as there a very few writes to the FAT compared to actual data transfers. Jeremy -- http://www.jerryweb.org/ : JerryWeb.org http://sailcut.sourceforge.net/ : Sailcut CAD http://mpf70.sourceforge.net/ : MPman MP-F70 support for Linux |