Question

Does anyone know how long a UBIFS takes to flush/sync a file to flash?

The write happens through a normal fwrite operation and I would like to know how long before that write is committed to flash when no other writes to file occur.

If not, any way of finding out?

Thanks.

Was it helpful?

Solution

An interesting read: http://www.linux-mtd.infradead.org/doc/ubifs.html - Write-back knobs in Linux

The write-back functions can be tuned via /proc/sys calls:

  • dirty_writeback_centisecs - how often the Linux periodic write-back thread wakes up and writes out dirty data. This is a mechanism which makes sure all dirty data hits the media at some point.

  • dirty_expire_centisecs - dirty data expire period. This is maximum time data may stay dirty. After this period of time it will be written back by the Linux periodic write-back thread. IOW, the periodic write-back thread wakes up every "dirty_writeback_centisecs" centi-seconds and synchronizes data which was dirtied "dirty_expire_centisecs" centi-seconds ago.

  • dirty_background_ratio - maximum amount of dirty data in percent of total memory. When the amount of dirty data becomes larger, the periodic write-back thread starts synchronizing it until it becomes smaller. Even non-expired data will be synchronized. This may be used to set a "soft" limit for the amount of dirty data in the system.

  • dirty_ratio - maximum amount of dirty data at which writers will first synchronize the existing dirty data before adding more. IOW, this is a "hard" limit of the amount of dirty data in the system.

This way we can tune the write-back sync time.

OTHER TIPS

It's not going to be a constant - it'll depend on a lot of variable factors.

You can use fsync() on the file after writing, and time how long it takes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top