summaryrefslogtreecommitdiff
path: root/cpukit/libblock/src/bdbuf.c (follow)
AgeCommit message (Collapse)Author
2020-04-16Canonicalize config.h includeSebastian Huber
Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
2018-10-02Use rtems_task_exit()Sebastian Huber
Update #3530. Update #3533.
2018-02-02libblock: Use self-contained mutex and cond varSebastian Huber
Update #2843.
2017-10-05posix: Implement self-contained POSIX mutexSebastian Huber
POSIX mutexes are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3112.
2016-04-07libblock: Drop superfluous <stdlib.h> includeSebastian Huber
Drop superfluous <stdlib.h> include from <rtems/diskdevs.h> since this leads to conflicts with the latest Newlib in case this header file is used in the FreeBSD kernel space, e.g. for USB mass storage support.
2014-11-28bdbuf: Fix race condition with sync active flagSebastian Huber
Bug report by Oleg Kravtsov: In rtems_bdbuf_swapout_processing() function there is the following lines: if (bdbuf_cache.sync_active && !transfered_buffers) { rtems_id sync_requester; rtems_bdbuf_lock_cache (); ... } Here access to bdbuf_cache.sync_active is not protected with anything. Imagine the following test case: 1. Task1 releases buffer(s) with bdbuf_release_modified() calls; 2. After a while swapout task starts and flushes all buffers; 3. In the end of that swapout flush we are before that part of code, and assume there is task switching (just before "if (bdbuf_cache.sync_active && !transfered_buffers)"); 4. Some other task (with higher priority) does bdbuf_release_modified and rtems_bdbuf_syncdev(). This task successfully gets both locks sync and pool (in rtems_bdbuf_syncdev() function), sets sync_active to true and starts waiting for RTEMS_BDBUF_TRANSFER_SYNC event with only sync lock got. 5. Task switching happens again and we are again before "if (bdbuf_cache.sync_active && !transfered_buffers)". As the result we check sync_active and we come inside that "if" statement. 6. The result is that we send RTEMS_BDBUF_TRANSFER_SYNC event! Though ALL modified messages of that task are not flushed yet! close #1485
2014-11-25bdbuf: Use rtems_cache_aligned_malloc()Sebastian Huber
2014-11-20bdbuf: Use rtems_cache_get_data_line_size()Sebastian Huber
2014-08-05Add and use RTEMS_CONTAINER_OF()Sebastian Huber
2014-06-03libblock: Avoid recursive mutexSebastian Huber
2014-06-02libblock: Add RTEMS_BDBUF_USE_PTHREADRalf Kirchner
Use the PTHREAD mutexes and condition variables if available. This helps on SMP configurations to avoid the home grown condition variables via disabled preemption.
2014-06-02libblock: Use pthread_once() for initializationRalf Kirchner
Enabling and disabling preemption as done for single core will not work for SMP. In the bdbuf initialization preemption handling can be avoided in general by using pthread_once().
2013-10-17Remove double count of start offsetRic Claus
2013-09-16libblock: PR2145: Limit maximum read-ahead blocksSebastian Huber
This helps to prevent stack overflows due to configuration errors.
2013-08-26libblock: Avoid uninitialized variableSebastian Huber
2013-07-26score: Merge tod implementation into one fileSebastian Huber
Delete TOD_MICROSECONDS_PER_SECOND, TOD_MICROSECONDS_TO_TICKS() and TOD_MILLISECONDS_TO_TICKS().
2013-02-21libblock: Do resource allocation in one placeSebastian Huber
All resource allocations take place in rtems_bdbuf_init() now. After rtems_bdbuf_init() no fatal errors can happen due to configuration errors or resource limits. This makes it easier to detect configuration errors for users.
2012-11-15score: Add RTEMS_FATAL_SOURCE_BDBUFSebastian Huber
Add rtems_bdbuf_fatal_code as a replacement for the previous fatal error codes. Remove unused error codes. Add new error codes. Use rtems_fatal() with RTEMS_FATAL_SOURCE_BDBUF as source.
2012-11-02libblock: Block device transfer request API changeSebastian Huber
Add and use rtems_blkdev_request_done(). Block device transfer requests must signal the completion status now with rtems_blkdev_request_done(). The return value of the block device IO control will be ignored for transfer requests. The first parameter of rtems_blkdev_request_cb is now the transfer request structure. Renamed rtems_blkdev_request::req_done to rtems_blkdev_request::done to break third party drivers at compile time, otherwise this API change would result in runtime errors.
2012-10-30libblock: Use transient eventSebastian Huber
2012-10-26libblock: rtems_bdbuf_set_block_size() API changeSebastian Huber
The set block size must synchronize and purge the disk to avoid an inconsistent cache state and data corruption. The synchronization is optional depending on the new sync parameter. In some contexts a synchronization must not be performed, e.g. during disk creation.
2012-07-19Remove CVS-Ids.Ralf Corsépius
2012-07-09libblock: Fix read-ahead task wake-upSebastian Huber
In case the read-ahead task is not configured we must not send a wake-up event. This would send the wake-up event to the executing task. We must send the wake-up event only in case the request list changes from empty to non-empty. Since otherwise we may send a false transfer event.
2012-07-03libblock: Move read-ahead trigger checkSebastian Huber
In case the read-ahead task has a higher priority than the reading task, this ensures that the read-ahead request is issued after the read miss is serviced.
2012-07-02libblock: Fix read-ahead trigger and next updateSebastian Huber
The previous version was sub-optimal for read-ahead transfer counts of one.
2012-07-02libblock: Fix read-ahead trigger and next updateSebastian Huber
2012-07-02libblock: Fix continuous blocks write requestSebastian Huber
2012-07-02libblock: Remove unused fieldSebastian Huber
2012-06-12libblock: Add block device statisticsSebastian Huber
2012-06-12libblock: Remove const qualifierSebastian Huber
This allows addtion of per disk statistics for example.
2012-06-04libblock: Add read-ahead taskSebastian Huber
Read-ahead requests were previously executed in the context of the reading task. This blocks the reading task until the complete read with read-ahead transfer is finished. A read-ahead task is introduced to off-load the read-ahead transfer. This allows the reading task to work with the requested block more quickly. The read-ahead is triggered after two misses of ascending consecutive blocks or a read hit of a block read by the most-recent read-ahead transfer. The read-ahead feature is configurable and can be disabled.
2012-05-31Fix C files which had two semi-colons at EOLJoel Sherrill
2012-05-31libblock: Move rtems_bdbuf_get_media_block() callSebastian Huber
Move rtems_bdbuf_get_media_block() call inside the bdbuf lock.
2012-05-31libblock: Simplify disk managementSebastian Huber
Add block_count and media_blocks_per_block to rtems_disk_device. Add and use rtems_disk_init_phys() and rtems_disk_init_log().
2012-05-31libblock: Remove explicit bds_per_group parameterSebastian Huber
2012-05-31libblock: Remove const qualifier from bdbuf APISebastian Huber
This allows addtion of per disk statistics for example.
2012-05-31libblock: Add task stack size bdbuf configurationSebastian Huber
The task stack size for the swap-out and worker tasks is now configurable. The bdbuf task resources are now included in the work space size estimate.
2012-05-24libblock: Fix read request block count calculationSebastian Huber
2012-05-24libblock: Fix state descriptionsSebastian Huber
2012-05-14libblock: Fix purge device tree traversalSebastian Huber
2012-04-12libblock: Add rtems_bdbuf_set_block_size()Sebastian Huber
The new function rtems_bdbuf_set_block_size() must be used to set the block size of a disk device. It will check if the block size is valid and set the new fields block_to_media_block_shift and bds_per_group of the rtems_disk_device structure. This helps to avoid complex arithmetic operations in the block device buffer get and read path.
2012-04-12libblock: Change error status to fatal errorSebastian Huber
Calling the bdbuf API functions in the not configured state is now a fatal error.
2012-04-12libblock: Use unprotected chain operationsSebastian Huber
The transfer chain is accessed by at most one thread at a time.
2012-04-12libblock: Use unprotected chain operationsSebastian Huber
The chains are protected by the bdbuf cache lock.
2012-03-13libblock: Change bdbuf APISebastian Huber
The functions o rtems_bdbuf_get(), o rtems_bdbuf_read(), o rtems_bdbuf_syncdev(), and o rtems_bdbuf_purge_dev(), use now the disk device instead of the device identifier. This makes bdbuf independent of rtems_disk_obtain() and rtems_disk_release(). It is the responsiblity of the file system to obtain the disk device. This also reduces the overhead to get a buffer. The key for the AVL tree uses now the disk device instead of the device identifier. The pointer is interpreted as an unsigned integer. This reduces the memory overhead and makes the comparison operation a bit faster. Removed function rtems_bdbuf_purge_major(). This function was too destructive and could have unpredictable side effects.
2012-03-13libblock: Remove superfluous volatile qualifierSebastian Huber
All these variables are protected by the bdbuf cache mutex.
2011-11-032011-11-03 Chris Johns <chrisj@rtems.org>Chris Johns
PR 1948/filesystem * libfs/src/rfs/rtems-rfs-file-system.c, libfs/src/rfs/rtems-rfs-file-system.h, libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-rtems.c: Add support for mount passing an ASCIIZ string containing configuration options. Remove the hardcoded dir string and size. Fix comments. * libblock/src/bdbuf.c: Fix state labels in trace output.
2010-07-042010-07-04 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill
* libblock/include/rtems/ide_part_table.h, libblock/src/bdbuf.c, libcsupport/src/__times.c, libcsupport/src/libio_init.c, libcsupport/src/mallocfreespace.c, libcsupport/src/mount-mgr.c, libcsupport/src/mount.c, libcsupport/src/rewinddir.c, libcsupport/src/seekdir.c, libcsupport/src/telldir.c, libcsupport/src/unmount.c, libfs/src/dosfs/fat.c, libfs/src/dosfs/fat_fat_operations.c, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_eval.c, libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_format.c, libfs/src/dosfs/msdos_fsunmount.c, libfs/src/dosfs/msdos_initsupp.c, libfs/src/dosfs/msdos_rename.c, libmisc/cpuuse/cpuusagereport.c, libmisc/shell/vis.c, libmisc/stackchk/check.c, sapi/src/posixapi.c, telnetd/telnetd.c: Remove include of assert.h when it is not needed.
2010-05-182010-05-18 Chris Johns <chrisj@rtems.org>Chris Johns
* libblock/src/diskdevs.c, libblock/include/rtems/blkdev.h, libblock/src/bdbuf.c: PR 1448/filesystem. * libblock/include/rtems/blkdev.h, libblock/src/bdbuf.c: PR 1514/filesystem.
2010-04-292010-04-29 Sebastian Huber <sebastian.huber@embedded-brains.de>Sebastian Huber
PR1507 * libblock/src/bdbuf.c: Avoid NULL pointer access. * libblock/src/diskdevs.c: Fixed bounds check in rtems_disk_next().