diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-08 15:41:23 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-13 09:38:03 +0100 |
commit | 0f0db894f76661f0108b822bf6fd15fd19eb901e (patch) | |
tree | ccc1ebf075e27b97e1d68ef332db3bc6a45b4126 /cpukit/libfs/src/dosfs/msdos_misc.c | |
parent | dosfs: Use FAT_UNDEFINED_VALUE (diff) | |
download | rtems-0f0db894f76661f0108b822bf6fd15fd19eb901e.tar.bz2 |
dosfs: Lazy update of FAT32 FS info sector
The FAT32 FS info sector contains hints for the free cluster count and
the next free cluster. The previous code read these values during mount
and replaced them with invalid values. The shutdown operation updated
them with the current values. These values are only hints. Every FAT
implementation must cope with arbitrary values. They are intended to
speed up certain operations.
Now we update the free cluster count and next free culster in the FAT32
FS info sector only during unmount or sync operations and only if the
values have changed. This avoids writes to the FS info sector and
conforms to the behaviour of Linux and Windows.
The application can force an update of these values now with the fsync()
and fdatasync() operations. Applications that only read will perform
not write operations to the FAT32 FS info sector.
The new fat_sync() function performs all non-file specific
synchronizations.
Diffstat (limited to 'cpukit/libfs/src/dosfs/msdos_misc.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_misc.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c b/cpukit/libfs/src/dosfs/msdos_misc.c index fade1e9030..f4de0d5915 100644 --- a/cpukit/libfs/src/dosfs/msdos_misc.c +++ b/cpukit/libfs/src/dosfs/msdos_misc.c @@ -1646,19 +1646,6 @@ int msdos_find_node_by_cluster_num_in_fat_file( } int -msdos_sync_unprotected(msdos_fs_info_t *fs_info) -{ - int rc = fat_buf_release(&fs_info->fat); - rtems_status_code sc = rtems_bdbuf_syncdev(fs_info->fat.vol.dd); - if (sc != RTEMS_SUCCESSFUL) { - errno = EIO; - rc = -1; - } - - return rc; -} - -int msdos_sync(rtems_libio_t *iop) { int rc = RC_OK; @@ -1670,7 +1657,7 @@ msdos_sync(rtems_libio_t *iop) if (sc != RTEMS_SUCCESSFUL) rtems_set_errno_and_return_minus_one(EIO); - rc = msdos_sync_unprotected(fs_info); + rc = fat_sync(&fs_info->fat); rtems_semaphore_release(fs_info->vol_sema); return rc; |