From 39ee704e757268de833ffb956dda28f6aa2fa3a1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 31 May 2012 10:27:29 +0200 Subject: libblock: Add read-ahead task 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. --- cpukit/libblock/include/rtems/diskdevs.h | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'cpukit/libblock/include/rtems/diskdevs.h') diff --git a/cpukit/libblock/include/rtems/diskdevs.h b/cpukit/libblock/include/rtems/diskdevs.h index fe931f8a94..0b194096a5 100644 --- a/cpukit/libblock/include/rtems/diskdevs.h +++ b/cpukit/libblock/include/rtems/diskdevs.h @@ -16,6 +16,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -54,6 +55,37 @@ typedef int (*rtems_block_device_ioctl)( void *argp ); +/** + * @brief Trigger value to disable further read-ahead requests. + */ +#define RTEMS_DISK_READ_AHEAD_NO_TRIGGER ((rtems_blkdev_bnum) -1) + +/** + * @brief Read-ahead control. + */ +typedef struct { + /** + * @brief Chain node for the read-ahead request queue of the read-ahead task. + */ + rtems_chain_node node; + + /** + * @brief Block value to trigger the read-ahead request. + * + * A value of @ref RTEMS_DISK_READ_AHEAD_NO_TRIGGER will disable further + * read-ahead requests since no valid block can have this value. + */ + rtems_blkdev_bnum trigger; + + /** + * @brief Start block for the next read-ahead request. + * + * In case the trigger value is out of range of valid blocks, this value my + * be arbitrary. + */ + rtems_blkdev_bnum next; +} rtems_disk_read_ahread; + /** * @brief Description of a disk device (logical and physical disks). * @@ -168,6 +200,11 @@ struct rtems_disk_device { * releases this disk. */ bool deleted; + + /** + * @brief Read-ahead control for this disk. + */ + rtems_disk_read_ahread read_ahead; }; /** -- cgit v1.2.3