Lines Matching refs:entry
69 Panic("BufCache: Cannot allocate cache entry\n");
86 * Looks up a buffer cache entry that can be used by BufCache_Alloc or
91 * @param [out] entry If successful, this contains the buffer cache entry.
97 BufCacheLookup(Disk *disk, uint64_t diskOffset, BufCacheEntry **entry)
110 *entry = e;
115 *entry = NULL;
122 * Allocates a buffer cache entry that can be used by BufCache_Alloc or
127 * @param [out] entry If successful, this contains the buffer cache entry.
133 BufCacheAlloc(Disk *disk, uint64_t diskOffset, BufCacheEntry **entry)
160 *entry = e;
168 * Allocate a buffer cache entry to allow writing new data to disk.
172 * @param [out] entry If successful, this contains the buffer cache entry.
178 BufCache_Alloc(Disk *disk, uint64_t diskOffset, BufCacheEntry **entry)
184 status = BufCacheLookup(disk, diskOffset, entry);
185 if (*entry == NULL) {
186 status = BufCacheAlloc(disk, diskOffset, entry);
199 * Release a buffer cache entry. If no other references are held the
200 * buffer cache entry is placed on the LRU list.
202 * @param [in] entry Buffer cache entry.
205 BufCache_Release(BufCacheEntry *entry)
209 entry->refCount--;
210 if (entry->refCount == 0) {
211 TAILQ_INSERT_TAIL(&lruList, entry, lruEntry);
224 * @param [out] entry If successful, this contains the buffer cache entry.
229 BufCache_Read(Disk *disk, uint64_t diskOffset, BufCacheEntry **entry)
236 status = BufCacheLookup(disk, diskOffset, entry);
237 if (*entry != NULL) {
244 status = BufCacheAlloc(disk, diskOffset, entry);
250 buf = (*entry)->buffer;
267 * Write a buffer cache entry to disk.
273 BufCache_Write(BufCacheEntry *entry)
275 void *buf = entry->buffer;
279 SGArray_Append(&sga, entry->diskOffset, BLOCKSIZE);
281 return Disk_Write(entry->disk, buf, &sga, NULL, NULL);