Home | History | Annotate | Download | only in ext2fs

Lines Matching full:cache

5  * Implements a one-block write-through cache.
72 struct unix_cache cache[CACHE_SIZE];
89 struct unix_cache *cache, unsigned long block);
250 * Here we implement the cache functions
253 /* Allocate the cache buffers */
258 struct unix_cache *cache;
262 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
263 cache->block = 0;
264 cache->access_time = 0;
265 cache->dirty = 0;
266 cache->in_use = 0;
268 &cache->buf)))
274 /* Free the cache buffers */
277 struct unix_cache *cache;
281 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
282 cache->block = 0;
283 cache->access_time = 0;
284 cache->dirty = 0;
285 cache->in_use = 0;
286 if (cache->buf)
287 ext2fs_free_mem(&cache->buf);
288 cache->buf = 0;
294 * Try to find a block in the cache. If the block is not found, and
295 * eldest is a non-zero pointer, then fill in eldest with the cache
302 struct unix_cache *cache, *unused_cache, *oldest_cache;
306 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
307 if (!cache->in_use) {
309 unused_cache = cache;
312 if (cache->block == block) {
313 cache->access_time = ++data->access_time;
314 return cache;
317 (cache->access_time < oldest_cache->access_time))
318 oldest_cache = cache;
326 * Reuse a particular cache entry for another block.
329 struct unix_cache *cache, unsigned long block)
331 if (cache->dirty && cache->in_use)
332 raw_write_blk(channel, data, cache->block, 1, cache->buf);
334 cache->in_use = 1;
335 cache->dirty = 0;
336 cache->block = block;
337 cache->access_time = ++data->access_time;
341 * Flush all of the blocks in the cache
348 struct unix_cache *cache;
353 for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
354 if (!cache->in_use)
358 cache->in_use = 0;
360 if (!cache->dirty)
364 cache->block, 1, cache->buf);
368 cache->dirty = 0;
529 struct unix_cache *cache, *reuse[READ_DIRECT_SIZE];
543 * flush out the cache and then do a direct read.
553 /* If it's in the cache, use it! */
554 if ((cache = find_cached_block(data, block, &reuse[0]))) {
558 memcpy(cp, cache->buf, channel->block_size);
577 /* Save the results in the cache */
580 cache = reuse[j];
581 reuse_cache(channel, data, cache, block++);
582 memcpy(cache->buf, cp, channel->block_size);
594 struct unix_cache *cache, *reuse;
608 * flush out the cache completely and then do a direct write.
618 * if we're in write-through cache mode, and then fill the
619 * cache with the blocks.
627 cache = find_cached_block(data, block, &reuse);
628 if (!cache) {
629 cache = reuse;
630 reuse_cache(channel, data, cache, block);
632 memcpy(cache->buf, cp, channel->block_size);
633 cache->dirty = !writethrough;
655 * Flush out the cache completely