Lines Matching refs:index
19 * larger), the code implements an index cache that caches the mapping from
20 * block index to datablock location on disk.
22 * The index cache allows Squashfs to handle large files (up to 1.75 TiB) while
26 * The index cache is designed to be memory efficient, and by default uses
44 * Locate cache slot in range [offset, index] for specified inode. If
45 * there's more than one return the slot closest to index.
48 int index)
56 TRACE("locate_meta_index: index %d, offset %d\n", index, offset);
64 msblk->meta_index[i].offset <= index &&
84 * Find and initialise an empty cache slot for index offset.
99 * First time cache index has been used, allocate and
100 * initialise. The cache index could be allocated at
204 * Each cache index slot has SQUASHFS_META_ENTRIES, each of which
205 * can cache one index -> datablock/blocklist-block mapping. We wish
206 * to distribute these over the length of the file, entry[0] maps index x,
207 * entry[1] maps index x + skip, entry[2] maps index x + 2 * skip, and so on.
223 * Search and grow the index cache for the specified inode, returning the
225 * <index_block, index_offset> for index (scaled to nearest cache index).
227 static int fill_meta_index(struct inode *inode, int index,
241 * Scale index to cache index (cache slot entry)
243 index /= SQUASHFS_META_INDEXES * skip;
245 while (offset < index) {
246 meta = locate_meta_index(inode, offset + 1, index);
253 offset = index < meta->offset + meta->entries ? index :
270 * slot is extended up to index or to the end of the slot, in
273 for (i = meta->offset + meta->entries; i <= index &&
312 * Scale cache index (cache slot entry) to index
324 * specified by index. Fill_meta_index() does most of the work.
326 static int read_blocklist(struct inode *inode, int index, u64 *block)
332 int res = fill_meta_index(inode, index, &start, &offset, block);
334 TRACE("read_blocklist: res %d, index %d, start 0x%llx, offset"
335 " 0x%x, block 0x%llx\n", res, index, start, offset,
342 * res contains the index of the mapping returned by fill_meta_index(),
343 * this will likely be less than the desired index (because the
347 if (res < index) {
348 blks = read_indexes(inode->i_sb, index - res, &start, &offset);
355 * Read length of block specified by index.
388 int start_index = page->index & ~mask, end_index = start_index | mask;
403 push_page = (i == page->index) ? page :
415 if (i != page->index)
451 int index = page->index >> (msblk->block_log - PAGE_SHIFT);
453 int expected = index == file_end ?
459 TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n",
460 page->index, squashfs_i(inode)->start);
462 if (page->index >= ((i_size_read(inode) + PAGE_SIZE - 1) >>
466 if (index < file_end || squashfs_i(inode)->fragment_block ==
469 int bsize = read_blocklist(inode, index, &block);