summaryrefslogtreecommitdiff
path: root/core/fs/cache.c
Commit message (Collapse)AuthorAgeFilesLines
* cache, btrfs: Provide a general cached read routineH. Peter Anvin2014-05-261-2/+34
| | | | | | | | btrfs_read() was really just a function to read data linearly while using the metadata cache. Move it to cache.c and rename it cache_read() so other filesystems can make use of it as well. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: Avoid initializing the cache more than onceRaphael S. Carvalho2014-04-031-0/+2
| | | | | | | | | | Most of file system drivers initialize the cache themselves. The problem is that the same cache could be again initialized later, then invalidating the previous one. This patch fixes this. Problem found while auditing the code. Signed-off-by: Raphael S. Carvalho <raphael.scarv@gmail.com>
* Correct initialization of the cache doubly-linked listsyslinux-4.06-pre11H. Peter Anvin2012-07-191-2/+2
| | | | | | | | | | | | | | | The initialization of the cache doubly-linked list had head->next->prev instead of head->prev->next; this entry is supposed to initialize the ->next entry of the last entry in the list (which points back to the head node.) For clarity, consistently use "head" to refer to the head node; the mixing of "head" and "dev->cache_head" needlessly obfuscated the code. The wild pointer reference caused crashes on some systems. Reported-by: Jan Safrata <jsafrata@centrum.cz> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* cache: fix cache initializationH. Peter Anvin2010-02-161-14/+14
| | | | | | | | Fix the cache initialization; in particular make sure dev->cache_head actually gets set. Also, just use a plain division to figure out how many entries we can fit in the cache. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* cache: fix _get_cache_block() return, add lock_cache_block()H. Peter Anvin2010-02-161-7/+22
| | | | | | | Correct the return value from _get_cache_block(), and add a method for locking a block permanently in the cache. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* cache: update the metadata cache designH. Peter Anvin2010-02-161-83/+59
| | | | | | | | | | - instead of get_cache_block() returning a descriptor, have get_cache() returning const void *. - have a subfunction to allow getting a block without reading it from disk, and returning the cache descriptor. This will be used in ext2 to pre-seed block 0 with all zero. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* core: move fs-related C files into fs/H. Peter Anvin2010-02-161-0/+134
Move filesystem-related C files into the fs/ directory. Signed-off-by: H. Peter Anvin <hpa@zytor.com>