|
AquilaOS documentation
How it works, and its code
|
#include <core/system.h>Go to the source code of this file.
Typedefs | |
| typedef ssize_t(*) | blkcache_io(void *owner, uint64_t sector, size_t count, void *buf) |
Functions | |
| ssize_t | blkcache_read (void *owner, uint64_t sector, size_t count, void *buf, uint64_t nsectors, blkcache_io read) |
| Reads sectors of a disk through the cache. | |
| ssize_t | blkcache_write (void *owner, uint64_t sector, size_t count, void *buf, blkcache_io write) |
| Writes sectors of a disk through the cache: they stay dirty in it until it is flushed. | |
| int | blkcache_flush (void) |
| Writes every dirty block of the cache to its disk. | |
Definition at line 10 of file blkcache.h.
| int blkcache_flush | ( | void | ) |
Writes every dirty block of the cache to its disk.
Definition at line 309 of file blkcache.c.
References blkcache_flush(), blks, CACHE_BLOCKS, blk::dirty, dirty, flush_block(), full_dirty(), lookup(), blk::nr, blk::owner, RUN_MAX, and blk::write.
Referenced by blkcache_flush(), blkcache_write(), flush_old(), and kdev_sync().
| ssize_t blkcache_read | ( | void * | owner, |
| uint64_t | sector, | ||
| size_t | count, | ||
| void * | buf, | ||
| uint64_t | nsectors, | ||
| blkcache_io | read ) |
Reads sectors of a disk through the cache.
The sectors the cache doesn't have are read with read, and cached.
| owner | the disk (the driver's, for its sectors) |
| sector | the first sector, absolute on the disk |
| count | how many sectors |
| buf | where to put them |
| nsectors | the disk's size in sectors, or 0 if it isn't known |
| read | how the driver reads sectors |
Definition at line 367 of file blkcache.c.
References blk_data(), BLK_SECTORS, BLK_SIZE, blkcache_read(), block_new(), flush_old(), kfree(), kmalloc(), lookup(), memcpy(), MIN, blk::nr, overlap(), blk::owner, prefault(), RUN_MAX, sector_mask(), SECTOR_SIZE, touch(), blk::valid, and writes.
Referenced by ata_read(), and blkcache_read().
| ssize_t blkcache_write | ( | void * | owner, |
| uint64_t | sector, | ||
| size_t | count, | ||
| void * | buf, | ||
| blkcache_io | write ) |
Writes sectors of a disk through the cache: they stay dirty in it until it is flushed.
If the cache has no room even after flushing, they go straight to the disk.
| owner | the disk (the driver's, for its sectors) |
| sector | the first sector, absolute on the disk |
| count | how many sectors |
| buf | the sectors' data |
| write | how the driver writes sectors |
Definition at line 484 of file blkcache.c.
References blk_data(), BLK_SECTORS, blkcache_flush(), blkcache_write(), block_new(), dirty, DIRTY_MAX, flush_old(), kfree(), kmalloc(), lookup(), make_dirty(), memcpy(), blk::nr, overlap(), blk::owner, prefault(), sector_mask(), SECTOR_SIZE, touch(), blk::valid, blk::write, and writes.
Referenced by ata_write(), and blkcache_write().