Charles Manning actrix.gen.nz> writes: > On Friday 11 June 2010 13:10:57 Andre Renaud wrote: > > >> Has anyone ever looked at using LZO or similar compression within YAFFS > > >> to reduce the amount of data written? > > > > > > This is something we talked about in very early YAFFS days. There are > > > some pros and cons. > > > > > > Pros: Less writes, more stored. > > > Cons: Really bad for any form of overwrite (one of the main reasons > > > JFFS2 does not support memory mapped writing). > > > > > > You can get some of the Pros by storing compressed files (eg. vai loop > > > mounting). > > > > Hi Charles, > > Do you know if this means that UBIFS doesn't support mmap'd IO? > > Last time I checked it did not. Whether that is still the case I do not know. JFFS2 has problems only with MAP_SHARED. JFFS2 does not support MAP_SHARED simply because it is fully synchronous FS and every write goes synchronously to the media. So with shared mmaps, every byte you change would have to be written to the media synchronously, which makes little sense because it would be dead slow. I do not know how YAFFS supports MAP_SHARED without implementing write-back. What is the trick? UBIFS, as any standard FS, supports write-back, so it has no problems with shared mmaps(): you change your bytes, they are changed in the page-cache, the page is marked as dirty, and later on write-back takes care of flushing it. Just like in any standard FS like ext3. Thus, no, UBIFS has no problems with shared mmaps. Vs zero files Charles mentioned - sure asynchronous FS has its own costs - the applications have to have less bugs be aware of how to use fsync() and the like. This is the price for very fast writes. But hey, these are standard things which existed for ages. But no one cancelled the -o sync mount option which will make UBIFS fully synchronous, but of course slower. I wrote quite a lot of docs about write-back: http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback http://www.linux-mtd.infradead.org/doc/ubifs.html#L_wb_knobs Also, it is possible to implement several UBIFS hacks like ext4 implemented recently to lessen possible impacts for buggy apps: sync on close and sync on move: http://www.linux-mtd.infradead.org/doc/ubifs.html#L_sync_exceptions