From 6ae79e6df6fbc89ffbd6badb3f84d6a2b513fe83 Mon Sep 17 00:00:00 2001 From: Christian Mauderer Date: Tue, 19 Jan 2021 15:33:35 +0100 Subject: libblock: Add rtems_bdbuf_peek() Adds a peek function that allows (for example) a file system to suggest the next blocks that should be used for read ahead. This can increase the read speed of fragmented files. Update #3689 --- cpukit/include/rtems/diskdevs.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'cpukit/include/rtems/diskdevs.h') diff --git a/cpukit/include/rtems/diskdevs.h b/cpukit/include/rtems/diskdevs.h index 85d157dcd5..527a8cc955 100644 --- a/cpukit/include/rtems/diskdevs.h +++ b/cpukit/include/rtems/diskdevs.h @@ -58,6 +58,11 @@ typedef int (*rtems_block_device_ioctl)( */ #define RTEMS_DISK_READ_AHEAD_NO_TRIGGER ((rtems_blkdev_bnum) -1) +/** + * @brief Size value to set number of blocks based on config and disk size. + */ +#define RTEMS_DISK_READ_AHEAD_SIZE_AUTO (0) + /** * @brief Block device read-ahead control. */ @@ -71,7 +76,8 @@ typedef struct { * @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. + * read-ahead requests (except the ones triggered by @a rtems_bdbuf_peek) + * since no valid block can have this value. */ rtems_blkdev_bnum trigger; @@ -82,6 +88,14 @@ typedef struct { * be arbitrary. */ rtems_blkdev_bnum next; + + /** + * @brief Size of the next read-ahead request in blocks. + * + * A value of @ref RTEMS_DISK_READ_AHEAD_SIZE_AUTO will try to read the rest + * of the disk but at most the configured max_read_ahead_blocks. + */ + uint32_t nr_blocks; } rtems_blkdev_read_ahead; /** @@ -110,10 +124,16 @@ typedef struct { /** * @brief Read-ahead transfer count. * - * Each read-ahead transfer may read multiple blocks. + * Each read-ahead transfer may read multiple blocks. This counts all + * transfers (including peeks). */ uint32_t read_ahead_transfers; + /** + * @brief Read-ahead transfers caused by a peek. + */ + uint32_t read_ahead_peeks; + /** * @brief Count of blocks transfered from the device. */ -- cgit v1.2.3