ref: 74d0e84547710dcb8bc93b23aa0a5c9450af52a9
parent: 914d1a53f60d476c1bbdb6a666277780b88ed313
author: gkostka <[email protected]>
date: Fri Jan 17 13:56:23 EST 2014
Better caching method for fopen.
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -660,13 +660,8 @@
if((f->flags & O_TRUNC) &&
(inode_type == EXT4_DIRECTORY_FILETYPE_REG_FILE)){
- /*Turncate.*/
- ext4_block_delay_cache_flush(mp->fs.bdev, 1);
- /*Truncate may be IO heavy.
- Do it with delayed cache flush mode.*/
- r = ext4_fs_truncate_inode(&ref, 0);
- ext4_block_delay_cache_flush(mp->fs.bdev, 0);
+ r = ext4_fs_truncate_inode(&ref, 0);
if(r != EOK){
ext4_fs_put_inode_ref(&ref);
return r;
@@ -766,7 +761,9 @@
return ENOENT;
EXT4_MP_LOCK(mp);
+ ext4_block_delay_cache_flush(mp->fs.bdev, 1);
r = ext4_generic_open(f, path, flags, true, 0, 0);
+ ext4_block_delay_cache_flush(mp->fs.bdev, 0);
EXT4_MP_UNLOCK(mp);
return r;
}