diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-09 14:33:51 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-11 13:58:43 +0200 |
commit | 86ef0df976faf1b060347a07744814458aa42619 (patch) | |
tree | d001b836005d059b5aa11cf541093f5027c50d28 /cpukit/libfs/src/dosfs/fat_file.c | |
parent | libblock: Add RTEMS_BLKIO_PURGEDEV (diff) | |
download | rtems-86ef0df976faf1b060347a07744814458aa42619.tar.bz2 |
dosfs: Remove fat_file_datasync()
The fat_file_datasync() read every cluster of the file into the cache
and then synchronized it step-by-step. For unmodified buffers this is a
non-operation. For modified buffers this will wake-up the swapout task
which performs then a single buffer write operation. This is usually
quite inefficient. Firstly we do single buffer writes, secondly we
may perform a lot of unnecessary read operations (for huge files this is
really bad), and thirdly this leads likely to cache evictions.
The synchronization procedure is replaced by a simple
rtems_bdbuf_sync_dev(). This has the side-effect that also buffers not
related to the file are synchronized, but since the modified list is
normally short this should be acceptable.
Diffstat (limited to 'cpukit/libfs/src/dosfs/fat_file.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/fat_file.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c index a10347ccc4..73ea076819 100644 --- a/cpukit/libfs/src/dosfs/fat_file.c +++ b/cpukit/libfs/src/dosfs/fat_file.c @@ -774,65 +774,6 @@ fat_file_mark_removed( fat_fd->flags |= FAT_FILE_REMOVED; } -/* fat_file_datasync -- - * Synchronize fat-file - flush all buffered data to the media. - * - * PARAMETERS: - * mt_entry - mount table entry - * fat_fd - fat-file descriptor - * - * RETURNS: - * RC_OK on success, or -1 if error occured and errno set appropriately - */ -int -fat_file_datasync( - rtems_filesystem_mount_table_entry_t *mt_entry, - fat_file_fd_t *fat_fd - ) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - fat_fs_info_t *fs_info = mt_entry->fs_info; - uint32_t cur_cln = fat_fd->cln; - rtems_bdbuf_buffer *block = NULL; - uint32_t sec = 0; - uint32_t i = 0; - - if (fat_fd->fat_file_size == 0) - return RC_OK; - - /* - * we can use only one bdbuf :( and we also know that cache is useless - * for sync operation, so don't use it - */ - rc = fat_buf_release(fs_info); - if (rc != RC_OK) - return rc; - - /* for each cluster of the file ... */ - while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val) - { - sec = fat_cluster_num_to_sector_num(mt_entry, cur_cln); - /* for each sector in cluster ... */ - for ( i = 0; i < fs_info->vol.spc; i++ ) - { - /* ... sync it */ - sc = rtems_bdbuf_read(fs_info->vol.dd, (sec + i), &block); - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one( EIO ); - - sc = rtems_bdbuf_sync(block); - if ( sc != RTEMS_SUCCESSFUL ) - rtems_set_errno_and_return_minus_one( EIO ); - } - - rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - } - return rc; -} - /* fat_file_size -- * Calculate fat-file size - fat-file is nothing that clusters chain, so * go through all clusters in the chain and count it. Only |