summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/dosfs/fat_file.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-10-23 08:21:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-10-23 10:21:39 +0200
commitcf4f962cc0debb56a1a1c6f6ed844adeb09599e4 (patch)
treed402f419bb450053296c671c3106ecf4980fb230 /cpukit/libfs/src/dosfs/fat_file.c
parentRevert "fstests/mdosfs_fstime: Remove test" (diff)
downloadrtems-cf4f962cc0debb56a1a1c6f6ed844adeb09599e4.tar.bz2
dosfs: Write meta-data only if it changed
Diffstat (limited to 'cpukit/libfs/src/dosfs/fat_file.c')
-rw-r--r--cpukit/libfs/src/dosfs/fat_file.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c
index 1f20926884..af71ee239a 100644
--- a/cpukit/libfs/src/dosfs/fat_file.c
+++ b/cpukit/libfs/src/dosfs/fat_file.c
@@ -174,20 +174,17 @@ fat_file_update(fat_fs_info_t *fs_info, fat_file_fd_t *fat_fd)
* if fat-file descriptor is not marked as "removed", synchronize
* size, first cluster number, write time and date fields of the file
*/
- if (!FAT_FILE_IS_REMOVED(fat_fd))
+ if (!FAT_FILE_IS_REMOVED(fat_fd) && FAT_FILE_HAS_META_DATA_CHANGED(fat_fd))
{
int rc;
- if (fat_fd->fat_file_type == FAT_FILE)
- {
- rc = fat_file_write_first_cluster_num(fs_info, fat_fd);
- if (rc != RC_OK)
- ret_rc = rc;
+ rc = fat_file_write_first_cluster_num(fs_info, fat_fd);
+ if (rc != RC_OK)
+ ret_rc = rc;
- rc = fat_file_write_file_size(fs_info, fat_fd);
- if (rc != RC_OK)
- ret_rc = rc;
- }
+ rc = fat_file_write_file_size(fs_info, fat_fd);
+ if (rc != RC_OK)
+ ret_rc = rc;
rc = fat_file_write_time_and_date(fs_info, fat_fd);
if (rc != RC_OK)
@@ -677,8 +674,9 @@ fat_file_extend(
/* add new chain to the end of existing */
if ( fat_fd->fat_file_size == 0 )
{
- fat_fd->map.disk_cln = fat_fd->cln = chain;
+ fat_fd->map.disk_cln = chain;
fat_fd->map.file_cln = 0;
+ fat_file_set_first_cluster_num(fat_fd, chain);
}
else
{
@@ -721,7 +719,7 @@ fat_file_extend(
}
*a_length = new_length;
- fat_fd->fat_file_size = new_length;
+ fat_file_set_file_size(fat_fd, new_length);
return RC_OK;
}