Search code examples
linuxsynchronizationfilesystemsembedded-linuxubifs

How long does an UBIFS take to sync a file to flash


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.


Solution

  • An interesting read: UBIFS write-back knobs in Linux

    The write-back functions can be tuned via /proc/sys/vm 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.