vfs_get_vnode_cache() now only allocates a new cache if requested: this

prevents the system to allocate caches for files that don't use or have
a file cache (ie. only those can be mmap()ed!).
Therefore, cache_prefetch() no longer crashes when trying to prefetch
files without a file cache.
read_into_cache() no longer does anything if the requested size is 0.
Fixed a bug in cache_prefetch_vnode(): if the cache couldn't be retrieved,
it put the vnode, but didn't own it (the caller does).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13904 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-08-05 11:52:22 +00:00
parent 06ae92cd04
commit eab435cd59
4 changed files with 18 additions and 10 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
bool vfs_can_page(void *vnode, void *cookie);
status_t vfs_read_pages(void *vnode, void *cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes);
status_t vfs_write_pages(void *vnode, void *cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes);
status_t vfs_get_vnode_cache(void *vnode, struct vm_cache_ref **_cache);
status_t vfs_get_vnode_cache(void *vnode, struct vm_cache_ref **_cache, bool allocate);
status_t vfs_get_file_map( void *_vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count);
status_t vfs_get_fs_node_from_path(mount_id mountID, const char *path, bool kernel, void **_node);
status_t vfs_stat_vnode(void *_vnode, struct stat *stat);