RTEMS CPU Kit with SuperCore
4.11.3
|
Block device buffer management. More...
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <pthread.h>
#include <rtems.h>
#include <rtems/error.h>
#include "rtems/bdbuf.h"
Data Structures | |
struct | rtems_bdbuf_swapout_transfer |
A swapout transfer transaction data. More... | |
struct | rtems_bdbuf_swapout_worker |
Swapout worker thread. More... | |
struct | rtems_bdbuf_waiters |
Buffer waiters synchronization. More... | |
struct | rtems_bdbuf_cache |
The BD buffer cache. More... | |
Macros | |
#define | RTEMS_BDBUF_TRACE 0 |
Set to 1 to enable debug tracing. | |
#define | BDBUF_INVALID_DEV NULL |
#define | bdbuf_config rtems_bdbuf_configuration |
#define | RTEMS_BDBUF_SWAPOUT_SYNC RTEMS_EVENT_2 |
The events used in this code. More... | |
#define | RTEMS_BDBUF_READ_AHEAD_WAKE_UP RTEMS_EVENT_1 |
#define | RTEMS_BDBUF_CACHE_LOCK_ATTRIBS |
Lock semaphore attributes. More... | |
#define | RTEMS_BDBUF_CACHE_WAITER_ATTRIBS |
Waiter semaphore attributes. More... | |
#define | RTEMS_BDBUF_WAIT_TIMEOUT RTEMS_NO_TIMEOUT |
Waiter timeout. More... | |
#define | rtems_bdbuf_tracer (0) |
#define | rtems_bdbuf_show_usage() ((void) 0) |
#define | rtems_bdbuf_show_users(_w, _b) ((void) 0) |
#define | RTEMS_BDBUF_AVL_MAX_HEIGHT (32) |
The default maximum height of 32 allows for AVL trees having between 5,704,880 and 4,294,967,295 nodes, depending on order of insertion. More... | |
#define | bdbuf_alloc(size) __builtin_alloca (size) |
Typedefs | |
typedef struct rtems_bdbuf_swapout_transfer | rtems_bdbuf_swapout_transfer |
A swapout transfer transaction data. More... | |
typedef struct rtems_bdbuf_swapout_worker | rtems_bdbuf_swapout_worker |
Swapout worker thread. More... | |
typedef rtems_id | rtems_bdbuf_lock_type |
typedef struct rtems_bdbuf_waiters | rtems_bdbuf_waiters |
Buffer waiters synchronization. | |
typedef struct rtems_bdbuf_cache | rtems_bdbuf_cache |
The BD buffer cache. | |
Functions | |
rtems_status_code | rtems_bdbuf_init (void) |
Prepare buffering layer to work - initialize buffer descritors and (if it is neccessary) buffers. More... | |
rtems_status_code | rtems_bdbuf_get (rtems_disk_device *dd, rtems_blkdev_bnum block, rtems_bdbuf_buffer **bd_ptr) |
Get block buffer for data to be written into. More... | |
rtems_status_code | rtems_bdbuf_read (rtems_disk_device *dd, rtems_blkdev_bnum block, rtems_bdbuf_buffer **bd_ptr) |
Get the block buffer and if not already in the cache read from the disk. More... | |
rtems_status_code | rtems_bdbuf_release (rtems_bdbuf_buffer *bd) |
Release the buffer obtained by a read call back to the cache. More... | |
rtems_status_code | rtems_bdbuf_release_modified (rtems_bdbuf_buffer *bd) |
Release the buffer allocated with a get or read call placing it on the modified list. More... | |
rtems_status_code | rtems_bdbuf_sync (rtems_bdbuf_buffer *bd) |
Release the buffer as modified and wait until it has been synchronized with the disk by writing it. More... | |
rtems_status_code | rtems_bdbuf_syncdev (rtems_disk_device *dd) |
Synchronize all modified buffers for this device with the disk and wait until the transfers have completed. More... | |
void | rtems_bdbuf_purge_dev (rtems_disk_device *dd) |
Purges all buffers corresponding to the disk device dd. More... | |
rtems_status_code | rtems_bdbuf_set_block_size (rtems_disk_device *dd, uint32_t block_size, bool sync) |
Sets the block size of a disk device. More... | |
void | rtems_bdbuf_get_device_stats (const rtems_disk_device *dd, rtems_blkdev_stats *stats) |
Returns the block device statistics. | |
void | rtems_bdbuf_reset_device_stats (rtems_disk_device *dd) |
Resets the block device statistics. | |
Block device buffer management.
#define RTEMS_BDBUF_AVL_MAX_HEIGHT (32) |
The default maximum height of 32 allows for AVL trees having between 5,704,880 and 4,294,967,295 nodes, depending on order of insertion.
You may change this compile-time constant as you wish.
#define RTEMS_BDBUF_CACHE_LOCK_ATTRIBS |
Lock semaphore attributes.
This is used for locking type mutexes.
#define RTEMS_BDBUF_CACHE_WAITER_ATTRIBS |
Waiter semaphore attributes.
#define RTEMS_BDBUF_SWAPOUT_SYNC RTEMS_EVENT_2 |
The events used in this code.
These should be system events rather than application events.
#define RTEMS_BDBUF_WAIT_TIMEOUT RTEMS_NO_TIMEOUT |
Waiter timeout.
Set to non-zero to find some info on a waiter that is waiting too long.
typedef struct rtems_bdbuf_swapout_transfer rtems_bdbuf_swapout_transfer |
A swapout transfer transaction data.
This data is passed to a worked thread to handle the write phase of the transfer.
typedef struct rtems_bdbuf_swapout_worker rtems_bdbuf_swapout_worker |
Swapout worker thread.
These are available to take processing from the main swapout thread and handle the I/O operation.