diff options
author | Christian Mauderer <christian.mauderer@embedded-brains.de> | 2021-01-19 15:33:35 +0100 |
---|---|---|
committer | Christian Mauderer <christian.mauderer@embedded-brains.de> | 2021-03-26 14:25:38 +0100 |
commit | 6ae79e6df6fbc89ffbd6badb3f84d6a2b513fe83 (patch) | |
tree | 370419dc3ec031519955f899069222fbd138b91b /cpukit/include/rtems/diskdevs.h | |
parent | gen_uuid.c: Revert previous patch (597e4f476568a225d14dfaff02074cf269ad62ac) (diff) | |
download | rtems-6ae79e6df6fbc89ffbd6badb3f84d6a2b513fe83.tar.bz2 |
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
Diffstat (limited to 'cpukit/include/rtems/diskdevs.h')
-rw-r--r-- | cpukit/include/rtems/diskdevs.h | 24 |
1 files changed, 22 insertions, 2 deletions
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 @@ -59,6 +59,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. */ typedef struct { @@ -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,11 +124,17 @@ 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. */ uint32_t read_blocks; |