3

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.

waffleman
  • 4,159
  • 10
  • 39
  • 63
user626201
  • 1,623
  • 3
  • 19
  • 36

2 Answers2

4

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.

lnksz
  • 421
  • 3
  • 15
user626201
  • 1,623
  • 3
  • 19
  • 36
2

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.

caf
  • 233,326
  • 40
  • 323
  • 462