|
AquilaOS documentation
How it works, and its code
|
The block cache: a filesystem's blocks kept in memory, by a number the filesystem chooses (minix uses the block number), so that a block read again and again is read once. More...
Go to the source code of this file.
Data Structures | |
| struct | cache_block |
| A cached block. More... | |
Functions | |
| static int | bcache_eq (void *_a, void *_b) |
| Says whether a cached block is the one whose number _b points to. | |
| void | bcache_init (struct bcache *bcache) |
| Sets up an empty block cache. | |
| int | bcache_insert (struct bcache *bcache, uint64_t off, void *data) |
| Adds a block to a cache, which keeps its memory from now on. | |
| int | bcache_remove (struct bcache *bcache, uint64_t off) |
| Takes a block out of a cache. | |
| void * | bcache_find (struct bcache *bcache, uint64_t off) |
| Finds a cached block. | |
| void | bcache_dirty (struct bcache *bcache, uint64_t off) |
| Marks a cached block as changed. | |
The block cache: a filesystem's blocks kept in memory, by a number the filesystem chooses (minix uses the block number), so that a block read again and again is read once.
minix keeps its indirect zones there.
Definition in file bcache.c.
Marks a cached block as changed.
Nothing writes dirty blocks back yet: the filesystems write their changes through at once.
| bcache | the cache |
| off | the block's number |
Definition at line 124 of file bcache.c.
References bcache_dirty(), cache_block::dirty, hashmap_node::entry, hashmap_node::hash, bcache::hashmap, and cache_block::off.
Referenced by bcache_dirty().
|
static |
Says whether a cached block is the one whose number _b points to.
Definition at line 22 of file bcache.c.
References bcache_eq(), and cache_block::off.
Referenced by bcache_eq(), and bcache_init().
Finds a cached block.
| bcache | the cache |
| off | the block's number |
Definition at line 100 of file bcache.c.
References bcache_find(), cache_block::data, hashmap_node::entry, hashmap_node::hash, bcache::hashmap, and NULL.
Referenced by bcache_find(), and minix_bcache_get().
| void bcache_init | ( | struct bcache * | bcache | ) |
Sets up an empty block cache.
| bcache | the cache |
Definition at line 35 of file bcache.c.
References bcache_eq(), bcache_init(), and bcache::hashmap.
Referenced by bcache_init(), bcache_insert(), and minix_load().
Adds a block to a cache, which keeps its memory from now on.
| bcache | the cache, set up on first use |
| off | the block's number |
| data | its contents |
Definition at line 48 of file bcache.c.
References bcache_init(), bcache_insert(), cache_block::data, bcache::hashmap, kmalloc(), M_ZERO, and cache_block::off.
Referenced by bcache_insert(), and minix_bcache_get().
Takes a block out of a cache.
| bcache | the cache |
| off | the block's number |
Definition at line 73 of file bcache.c.
References bcache_remove(), hashmap_node::entry, hashmap_node::hash, bcache::hashmap, kfree(), NULL, and cache_block::off.
Referenced by bcache_remove(), minix_block_free(), and table_alloc().