Function ext4_cache_write_back

Source
pub unsafe extern "C" fn ext4_cache_write_back(
    path: *const c_char,
    on: bool,
) -> c_int
Expand description

@brief Enable/disable write back cache mode. @warning Default model of cache is write trough. It means that when You do:

      ext4_fopen(...);
      ext4_fwrite(...);
                       < --- data is flushed to physical drive

      When you do:
      ext4_cache_write_back(..., 1);
      ext4_fopen(...);
      ext4_fwrite(...);
                       < --- data is NOT flushed to physical drive
      ext4_cache_write_back(..., 0);
                       < --- when write back mode is disabled all
                             cache data will be flushed

To enable write back mode permanently just call this function once after ext4_mount (and disable before ext4_umount).

Some of the function use write back cache mode internally. If you enable write back mode twice you have to disable it twice to flush all data:

  ext4_cache_write_back(..., 1);
  ext4_cache_write_back(..., 1);

  ext4_cache_write_back(..., 0);
  ext4_cache_write_back(..., 0);

Write back mode is useful when you want to create a lot of empty files/directories.

@param mount_pount Mount point. @param on Enable/disable cache writeback mode.

@return Standard error code.