Lines Matching refs:cache

45 	VMCache			*cache;
122 fCache(ref->cache),
156 // allocate pages for the cache and mark them busy
289 VMCache* cache = ref->cache;
290 cache->Lock();
292 if (cache->consumers.IsEmpty() && cache->areas == NULL
305 vm_page_write_modified_page_range(cache,
309 // free some pages from our cache
313 for (VMCachePagesTree::Iterator it = cache->pages.GetIterator();
319 cache->RemovePage(page);
326 cache->Unlock();
345 if (offset + (off_t)bytesEnd > ref->cache->virtual_end)
346 bytesEnd = ref->cache->virtual_end - offset;
367 /*! Reads the requested amount of data into the cache, and allocates
372 operation it will unlock the cache, though.
382 VMCache* cache = ref->cache;
393 // allocate pages for the cache and mark them busy
398 cache->InsertPage(page, offset + pos);
406 cache->Unlock();
417 cache->Lock();
420 cache->NotifyPageEvents(pages[i], PAGE_EVENT_NOT_BUSY);
421 cache->RemovePage(pages[i]);
445 cache->Lock();
447 // make the pages accessible in the cache
451 cache->MarkPageUnbusy(pages[i]);
474 ref->cache->Unlock();
484 ref->cache->Lock();
490 /*! Like read_into_cache() but writes data into the cache.
491 To preserve data consistency, it might also read pages into the cache,
512 // allocate pages for the cache and mark them busy
514 // TODO: if space is becoming tight, and this cache is already grown
516 // (a working set like approach for the file cache)
526 ref->cache->InsertPage(page, offset + pos);
533 ref->cache->Unlock();
540 // from the file to have consistent data in the cache
557 if ((off_t)(offset + pageOffset + bufferSize) == ref->cache->virtual_end) {
618 ref->cache->Lock();
620 // make the pages accessible in the cache
622 ref->cache->MarkPageUnbusy(pages[i]);
674 ref->cache->Unlock();
694 ref->cache->Lock();
736 VMCache* cache = ref->cache;
764 AutoLocker<VMCache> locker(cache);
773 // In low memory situations we bypass the cache beyond a
781 vm_page* page = cache->LookupPage(offset);
783 // The page may be busy - since we need to unlock the cache sometime
794 // Since satisfy_cache_io() unlocks the cache, we need to look up
796 page = cache->LookupPage(offset);
798 cache->WaitForPageEvents(page, PAGE_EVENT_NOT_BUSY, true);
812 // need to unlock the cache temporarily to avoid a potential
848 cache->MarkPageUnbusy(page);
906 // ToDo: clear the cache
907 dprintf("cache_control: clear cache!\n");
959 VMCache* cache;
960 if (vfs_get_vnode_cache(vnode, &cache, false) != B_OK)
962 if (cache->type != CACHE_TYPE_VNODE) {
963 cache->ReleaseRef();
967 file_cache_ref* ref = ((VMVnodeCache*)cache)->FileCacheRef();
968 off_t fileSize = cache->virtual_end;
979 // Don't do anything if we don't have the resources left, or the cache
982 || 3 * cache->page_count > 2 * fileSize / B_PAGE_SIZE) {
983 cache->ReleaseRef();
993 cache->Lock();
998 vm_page* page = cache->LookupPage(offset);
1017 // we must not have the cache locked during I/O
1018 cache->Unlock();
1020 cache->Lock();
1033 cache->ReleaseRefAndUnlock();
1056 cache_node_opened(struct vnode* vnode, int32 fdType, VMCache* cache,
1063 if (cache != NULL && cache->type == CACHE_TYPE_VNODE) {
1064 file_cache_ref* ref = ((VMVnodeCache*)cache)->FileCacheRef();
1066 size = cache->virtual_end;
1075 cache_node_closed(struct vnode* vnode, int32 fdType, VMCache* cache,
1082 if (cache != NULL && cache->type == CACHE_TYPE_VNODE) {
1103 // ToDo: get cache module out of driver settings
1167 // Gets (usually creates) the cache for the node
1168 if (vfs_get_vnode_cache(ref->vnode, &ref->cache, true) != B_OK)
1171 ref->cache->virtual_end = size;
1172 ((VMVnodeCache*)ref->cache)->SetFileCacheRef(ref);
1191 ref->cache->ReleaseRef();
1201 AutoLocker<VMCache> _(ref->cache);
1215 // TODO: This function only removes all pages from the cache and prevents
1216 // that the file cache functions add any new ones until re-enabled. The
1218 // should mark the cache to prevent shared mappings of the file and fix
1224 AutoLocker<VMCache> _(ref->cache);
1232 // The file cache is not yet disabled. We need to evict all cached pages.
1233 status_t error = ref->cache->FlushAndRemoveAllPages();
1246 AutoLocker<VMCache> _(ref->cache);
1262 VMCache* cache = ref->cache;
1263 AutoLocker<VMCache> _(cache);
1265 off_t oldSize = cache->virtual_end;
1266 status_t status = cache->Resize(newSize, VM_PRIORITY_USER);
1267 // Note, the priority doesn't really matter, since this cache doesn't
1270 // We may have a new partial page at the end of the cache that must be
1274 vm_page* page = cache->LookupPage(newSize - partialBytes);
1293 return ref->cache->WriteModified();
1309 const off_t fileSize = ref->cache->virtual_end;