20 #ifndef _RTEMS_BDBUF_H 21 #define _RTEMS_BDBUF_H 177 #if defined(RTEMS_POSIX_API) 183 #define RTEMS_BDBUF_USE_PTHREAD 405 #define RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT 0 410 #define RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT 16 415 #define RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT 15 420 #define RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT 250 425 #define RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT 1000 430 #define RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT 0 435 #define RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT \ 436 RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT 441 #define RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT \ 442 RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT 447 #define RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT RTEMS_MINIMUM_STACK_SIZE 452 #define RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT (64 * 512) 457 #define RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT (512) 462 #define RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT (4096) void rtems_bdbuf_purge_dev(rtems_disk_device *dd)
Purges all buffers corresponding to the disk device dd.
Definition: bdbuf.c:3098
This is used to manage each element (node) which is placed on a chain.
Definition: chain.h:65
void * user
User data.
Definition: bdbuf.h:342
uint32_t rtems_blkdev_bnum
Block device block index type.
Definition: diskdevs.h:46
rtems_bdbuf_group * group
Pointer to the group of BDs this BD is part of.
Definition: bdbuf.h:336
Accessed by upper layer with modified data.
Definition: bdbuf.h:269
rtems_task_priority swapout_priority
Priority of the swap out task.
Definition: bdbuf.h:372
void rtems_bdbuf_get_device_stats(const rtems_disk_device *dd, rtems_blkdev_stats *stats)
Returns the block device statistics.
Definition: bdbuf.c:3222
int references
Allow reference counting by owner.
Definition: bdbuf.h:341
uint32_t waiters
The number of threads waiting on this buffer.
Definition: bdbuf.h:334
A group is a continuous block of buffer descriptors.
Definition: bdbuf.h:352
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 comp...
Definition: bdbuf.c:2466
signed char cache
Cache.
Definition: bdbuf.h:322
In transfer by block device driver and purged.
Definition: bdbuf.h:299
size_t swapout_workers
The number of worker threads for the swap-out task.
Definition: bdbuf.h:377
struct rtems_bdbuf_buffer * left
Left Child.
Definition: bdbuf.h:320
void sync(void)
This function operates by as follows: for all threads for all FILE * fsync() fdatasync() ...
Definition: sync.c:82
Scheduled for synchronization.
Definition: bdbuf.h:289
Empty.
Definition: bdbuf.h:254
void rtems_bdbuf_reset_device_stats(rtems_disk_device *dd)
Resets the block device statistics.
Definition: bdbuf.c:3230
size_t size
Size of memory in the cache.
Definition: bdbuf.h:384
rtems_task_priority swapout_worker_priority
Priority of the swap out task.
Definition: bdbuf.h:380
size_t task_stack_size
Task stack size for swap-out task and worker threads.
Definition: bdbuf.h:382
rtems_status_code rtems_bdbuf_init(void)
Prepare buffering layer to work - initialize buffer descritors and (if it is neccessary) buffers...
Definition: bdbuf.c:1747
Buffering configuration definition.
Definition: bdbuf.h:367
uint32_t max_write_blocks
Number of blocks to write at once.
Definition: bdbuf.h:370
unsigned char * buffer
Pointer to the buffer memory area.
Definition: bdbuf.h:330
Cached.
Definition: bdbuf.h:259
signed char bal
The balance of the sub-tree.
Definition: bdbuf.h:323
rtems_status_code rtems_bdbuf_read(rtems_disk_device *dd, rtems_blkdev_bnum block, rtems_bdbuf_buffer **bd)
Get the block buffer and if not already in the cache read from the disk.
Definition: bdbuf.c:2294
size_t bds_per_group
The number of BD allocated to this group.
Definition: bdbuf.h:356
Block device statistics.
Definition: diskdevs.h:93
struct rtems_bdbuf_buffer rtems_bdbuf_buffer
To manage buffers we using buffer descriptors (BD).
Description of a disk device (logical and physical disks).
Definition: diskdevs.h:158
uint32_t max_read_ahead_blocks
Number of blocks to read ahead.
Definition: bdbuf.h:368
uint32_t swap_block_hold
Period a buffer is held.
Definition: bdbuf.h:376
Priority_Control rtems_task_priority
Define the type for an RTEMS API task priority.
Definition: tasks.h:79
Modified by upper layer.
Definition: bdbuf.h:284
rtems_status_code
Classic API Status.
Definition: status.h:46
rtems_task_priority read_ahead_priority
Priority of the read-ahead task.
Definition: bdbuf.h:390
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.
Definition: bdbuf.c:3106
uint32_t hold_timer
Timer to indicate how long a buffer has been held in the cache modified.
Definition: bdbuf.h:338
rtems_bdbuf_buffer * bdbuf
First BD this block covers.
Definition: bdbuf.h:360
rtems_disk_device * dd
disk device
Definition: bdbuf.h:326
Block Device Disk Management API.
rtems_status_code rtems_bdbuf_release(rtems_bdbuf_buffer *bd)
Release the buffer obtained by a read call back to the cache.
Definition: bdbuf.c:2368
rtems_chain_node link
Link the groups on a LRU list if they have no buffers in use.
Definition: bdbuf.h:354
To manage buffers we using buffer descriptors (BD).
Definition: bdbuf.h:314
struct rtems_bdbuf_buffer * right
Right Child.
Definition: bdbuf.h:321
rtems_status_code rtems_bdbuf_get(rtems_disk_device *dd, rtems_blkdev_bnum block, rtems_bdbuf_buffer **bd)
Get block buffer for data to be written into.
Definition: bdbuf.c:2026
const rtems_bdbuf_config rtems_bdbuf_configuration
External reference to the configuration.
Accessed by upper layer with cached data.
Definition: bdbuf.h:264
rtems_bdbuf_buf_state
State of a buffer of the cache.
Definition: bdbuf.h:244
uint32_t buffer_max
Maximum buffer size supported.
Definition: bdbuf.h:387
rtems_bdbuf_buf_state state
State of the buffer.
Definition: bdbuf.h:332
Free.
Definition: bdbuf.h:249
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...
Definition: bdbuf.c:2434
Accessed by upper layer with purged data.
Definition: bdbuf.h:279
struct rtems_bdbuf_config rtems_bdbuf_config
Buffering configuration definition.
rtems_blkdev_bnum block
block number on the device
Definition: bdbuf.h:328
uint32_t users
How many users the block has.
Definition: bdbuf.h:359
uint32_t buffer_min
Minimum buffer size.
Definition: bdbuf.h:386
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.
Definition: bdbuf.c:2402
rtems_chain_node link
Link the BD onto a number of lists.
Definition: bdbuf.h:316
Accessed by upper layer with invalid data.
Definition: bdbuf.h:274
In transfer by block device driver.
Definition: bdbuf.h:294
uint32_t swapout_period
Period swap-out checks buf timers.
Definition: bdbuf.h:374