summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/src/bdbuf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libblock: Use self-contained mutex and cond varSebastian Huber2018-02-021-282/+42
| | | | Update #2843.
* posix: Implement self-contained POSIX mutexSebastian Huber2017-10-051-2/+4
| | | | | | | | POSIX mutexes are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3112.
* libblock: Drop superfluous <stdlib.h> includeSebastian Huber2016-04-071-0/+1
| | | | | | 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.
* bdbuf: Fix race condition with sync active flagSebastian Huber2014-11-281-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* bdbuf: Use rtems_cache_aligned_malloc()Sebastian Huber2014-11-251-9/+6
|
* bdbuf: Use rtems_cache_get_data_line_size()Sebastian Huber2014-11-201-9/+1
|
* Add and use RTEMS_CONTAINER_OF()Sebastian Huber2014-08-051-2/+2
|
* libblock: Avoid recursive mutexSebastian Huber2014-06-031-9/+10
|
* libblock: Add RTEMS_BDBUF_USE_PTHREADRalf Kirchner2014-06-021-62/+181
| | | | | | Use the PTHREAD mutexes and condition variables if available. This helps on SMP configurations to avoid the home grown condition variables via disabled preemption.
* libblock: Use pthread_once() for initializationRalf Kirchner2014-06-021-29/+25
| | | | | | 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().
* Remove double count of start offsetRic Claus2013-10-171-5/+5
|
* libblock: PR2145: Limit maximum read-ahead blocksSebastian Huber2013-09-161-2/+13
| | | | This helps to prevent stack overflows due to configuration errors.
* libblock: Avoid uninitialized variableSebastian Huber2013-08-261-2/+1
|
* score: Merge tod implementation into one fileSebastian Huber2013-07-261-1/+1
| | | | | Delete TOD_MICROSECONDS_PER_SECOND, TOD_MICROSECONDS_TO_TICKS() and TOD_MILLISECONDS_TO_TICKS().
* libblock: Do resource allocation in one placeSebastian Huber2013-02-211-115/+153
| | | | | | | 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.
* score: Add RTEMS_FATAL_SOURCE_BDBUFSebastian Huber2012-11-151-78/+73
| | | | | | 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.
* libblock: Block device transfer request API changeSebastian Huber2012-11-021-17/+8
| | | | | | | | | | | | | | 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.
* libblock: Use transient eventSebastian Huber2012-10-301-5/+15
|
* libblock: rtems_bdbuf_set_block_size() API changeSebastian Huber2012-10-261-2/+11
| | | | | | | 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.
* Remove CVS-Ids.Ralf Corsépius2012-07-191-2/+0
|
* libblock: Fix read-ahead task wake-upSebastian Huber2012-07-091-5/+10
| | | | | | | | | 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.
* libblock: Move read-ahead trigger checkSebastian Huber2012-07-031-1/+2
| | | | | | 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.
* libblock: Fix read-ahead trigger and next updateSebastian Huber2012-07-021-1/+1
| | | | | The previous version was sub-optimal for read-ahead transfer counts of one.
* libblock: Fix read-ahead trigger and next updateSebastian Huber2012-07-021-2/+2
|
* libblock: Fix continuous blocks write requestSebastian Huber2012-07-021-13/+6
|
* libblock: Remove unused fieldSebastian Huber2012-07-021-1/+0
|
* libblock: Add block device statisticsSebastian Huber2012-06-121-0/+34
|
* libblock: Remove const qualifierSebastian Huber2012-06-121-17/+17
| | | | This allows addtion of per disk statistics for example.
* libblock: Add read-ahead taskSebastian Huber2012-06-041-121/+226
| | | | | | | | | | | 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.
* Fix C files which had two semi-colons at EOLJoel Sherrill2012-05-311-1/+1
|
* libblock: Move rtems_bdbuf_get_media_block() callSebastian Huber2012-05-311-75/+78
| | | | Move rtems_bdbuf_get_media_block() call inside the bdbuf lock.
* libblock: Simplify disk managementSebastian Huber2012-05-311-11/+16
| | | | | Add block_count and media_blocks_per_block to rtems_disk_device. Add and use rtems_disk_init_phys() and rtems_disk_init_log().
* libblock: Remove explicit bds_per_group parameterSebastian Huber2012-05-311-18/+13
|
* libblock: Remove const qualifier from bdbuf APISebastian Huber2012-05-311-4/+4
| | | | This allows addtion of per disk statistics for example.
* libblock: Add task stack size bdbuf configurationSebastian Huber2012-05-311-35/+41
| | | | | | 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.
* libblock: Fix read request block count calculationSebastian Huber2012-05-241-1/+1
|
* libblock: Fix state descriptionsSebastian Huber2012-05-241-1/+1
|
* libblock: Fix purge device tree traversalSebastian Huber2012-05-141-1/+2
|
* libblock: Add rtems_bdbuf_set_block_size()Sebastian Huber2012-04-121-51/+73
| | | | | | | | 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.
* libblock: Change error status to fatal errorSebastian Huber2012-04-121-11/+7
| | | | | Calling the bdbuf API functions in the not configured state is now a fatal error.
* libblock: Use unprotected chain operationsSebastian Huber2012-04-121-4/+4
| | | | The transfer chain is accessed by at most one thread at a time.
* libblock: Use unprotected chain operationsSebastian Huber2012-04-121-17/+17
| | | | The chains are protected by the bdbuf cache lock.
* libblock: Change bdbuf APISebastian Huber2012-03-131-159/+78
| | | | | | | | | | | | | | | | | | | | 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.
* libblock: Remove superfluous volatile qualifierSebastian Huber2012-03-131-6/+6
| | | | All these variables are protected by the bdbuf cache mutex.
* 2011-11-03 Chris Johns <chrisj@rtems.org>Chris Johns2011-11-031-1/+1
| | | | | | | | | | | 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-04 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill2010-07-041-1/+0
| | | | | | | | | | | | | | | | * 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-18 Chris Johns <chrisj@rtems.org>Chris Johns2010-05-181-13/+40
| | | | | | | | * 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-29 Sebastian Huber <sebastian.huber@embedded-brains.de>Sebastian Huber2010-04-291-0/+1
| | | | | | | PR1507 * libblock/src/bdbuf.c: Avoid NULL pointer access. * libblock/src/diskdevs.c: Fixed bounds check in rtems_disk_next().
* Fixed invalid chain extractThomas Doerfler2010-01-291-1/+2
|
* add purge capability to libblock, add proper test caseThomas Doerfler2010-01-261-113/+263
|