• Home
  • Raw
  • Download

Lines Matching +full:file +full:- +full:entry +full:- +full:cache

10  *  : add quick-buffer for sload compression support
64 *offset -= in __get_device_fd()
69 return -1; in __get_device_fd()
81 /* ---------- dev_cache, Least Used First (LUF) policy ------------------- */
88 static uint64_t *dcache_lastused; /* last used ticks for cache entries */
113 20, -20, 40, -40, 80, -80, 160, -160,
114 320, -320, 640, -640, 1280, -1280, 2560, -2560,
123 /* Number of used cache entries */ in dcache_print_statistics()
130 * c: number of cache entries in dcache_print_statistics()
133 * CH: cache hit in dcache_print_statistics()
134 * CM: cache miss in dcache_print_statistics()
135 * Repl: read cache replaced in dcache_print_statistics()
176 return -1; in dcache_alloc_all()
184 return -1; in dcache_alloc_all()
218 /* release previous cache init, if any */ in dcache_init()
230 /* halve alloc size until alloc succeed, or min cache reached */ in dcache_init()
249 static inline char *dcache_addr(long entry) in dcache_addr() argument
251 return dcache_buf + F2FS_BLKSIZE * entry; in dcache_addr()
254 /* relocate on (n+1)-th collision */
255 static inline long dcache_relocate(long entry, int n) in dcache_relocate() argument
258 return (entry + dcache_relocate_offset[n]) % in dcache_relocate()
266 long entry, least_used, target; in dcache_find() local
270 target = least_used = entry = blk % n; /* simple modulo hash */ in dcache_find()
274 return target; /* found target or empty cache slot */ in dcache_find()
277 target = dcache_relocate(entry, try); /* next target */ in dcache_find()
282 /* Physical read into cache */
283 static int dcache_io_read(int fd, long entry, off64_t offset, off64_t blk) in dcache_io_read() argument
285 if (pread64(fd, dcache_buf + entry * F2FS_BLKSIZE, in dcache_io_read()
288 return -1; in dcache_io_read()
290 dcache_lastused[entry] = ++dcache_usetick; in dcache_io_read()
291 dcache_valid[entry] = true; in dcache_io_read()
292 dcache_blk[entry] = blk; in dcache_io_read()
297 * - Note: Read/Write are not symmetric:
298 * For read, we need to do it block by block, due to the cache nature:
300 * For write, since we always do a write-thru, we can join all writes into one,
301 * and write it once at the caller. This function updates the cache for write, but
303 * - Note: We concentrate read/write together, due to the fact of similar structure to find
304 * the relavant cache entries
305 * - Return values:
307 * 1: cache not available (uninitialized)
308 * -1: error
329 (size_t)(F2FS_BLKSIZE - addr_in_blk)); in dcache_update_rw()
330 long entry = dcache_find(blk); in dcache_update_rw() local
335 if (dcache_valid[entry] && dcache_blk[entry] == blk) { in dcache_update_rw()
336 /* cache hit */ in dcache_update_rw()
337 if (is_write) /* write: update cache */ in dcache_update_rw()
338 memcpy(dcache_addr(entry) + addr_in_blk, in dcache_update_rw()
343 /* cache miss */ in dcache_update_rw()
347 if (dcache_valid[entry]) in dcache_update_rw()
349 /* read: physical I/O read into cache */ in dcache_update_rw()
350 err = dcache_io_read(fd, entry, start, blk); in dcache_update_rw()
356 /* read: copy data from cache */ in dcache_update_rw()
359 memcpy(buf, dcache_addr(entry) + addr_in_blk, in dcache_update_rw()
366 byte_count -= cur_size; in dcache_update_rw()
373 * dcache_update_cache() just update cache, won't do physical I/O.
374 * Thus even no error, we need normal non-cache I/O for actual write
376 * return value: 1: cache not available
377 * 0: success, -1: I/O error
384 /* handles read into cache + read into buffer */
398 return -1; in dev_read_version()
433 return -ENOMEM; in sparse_write_blk()
485 return -ENOMEM; in sparse_merge_blocks()
532 /* err = 1: cache not available, fall back to non-cache R/W */ in dev_read()
533 /* err = 0: success, err=-1: I/O error */ in dev_read()
538 return -1; in dev_read()
575 * dcache_update_cache() just update cache, won't do I/O. in dev_write()
576 * Thus even no error, we need normal non-cache I/O for actual write in dev_write()
579 return -1; in dev_write()
581 return -1; in dev_write()
593 return -1; in dev_write_dump()
611 return -1; in dev_fill()
613 return -1; in dev_fill()
640 return -1; in f2fs_fsync_device()
653 return -1; in f2fs_init_sparse_file()
658 return -1; in f2fs_init_sparse_file()
661 c.device_size &= (~((uint64_t)(F2FS_BLKSIZE - 1))); in f2fs_init_sparse_file()
665 MSG(0, "\tError: Corrupted sparse file\n"); in f2fs_init_sparse_file()
666 return -1; in f2fs_init_sparse_file()
672 return -1; in f2fs_init_sparse_file()
678 return -1; in f2fs_init_sparse_file()
685 return -1; in f2fs_init_sparse_file()
718 int64_t chunk_start = (blocks[0] == NULL) ? -1 : 0; in f2fs_finalize_device()
731 if (chunk_start != -1) { in f2fs_finalize_device()
732 if (j - chunk_start >= MAX_CHUNK_COUNT) { in f2fs_finalize_device()
734 j - chunk_start, 0); in f2fs_finalize_device()
736 chunk_start = -1; in f2fs_finalize_device()
740 if (chunk_start == -1) { in f2fs_finalize_device()
755 j - chunk_start, 0); in f2fs_finalize_device()
763 chunk_start = -1; in f2fs_finalize_device()
766 if (chunk_start != -1) { in f2fs_finalize_device()
768 blocks_count - chunk_start, 0); in f2fs_finalize_device()
780 * in the block device page cache. in f2fs_finalize_device()
792 MSG(0, "\tError: Failed to close device file!!!\n"); in f2fs_finalize_device()