Lines Matching refs:index

3  * index.c - NTFS kernel index handling.  Part of the Linux-NTFS project.
13 #include "index.h"
17 * ntfs_index_ctx_get - allocate and initialize a new index context
18 * @idx_ni: ntfs index inode with which to initialize the context
20 * Allocate a new index context, initialize it with @idx_ni and return it.
23 * Locking: Caller must hold i_mutex on the index inode.
36 * ntfs_index_ctx_put - release an index context
37 * @ictx: index context to free
39 * Release the index context @ictx, releasing all associated resources.
41 * Locking: Caller must hold i_mutex on the index inode.
65 * ntfs_index_lookup - find a key in an index and return its index entry
66 * @key: [IN] key for which to search in the index
68 * @ictx: [IN/OUT] context describing the index and the returned entry
73 * Look for the @key in the index specified by the index lookup context @ictx.
74 * ntfs_index_lookup() walks the contents of the index looking for the @key.
76 * If the @key is found in the index, 0 is returned and @ictx is setup to
77 * describe the index entry containing the matching @key. @ictx->entry is the
78 * index entry and @ictx->data and @ictx->data_len are the index entry data and
81 * If the @key is not found in the index, -ENOENT is returned and @ictx is
82 * setup to describe the index entry whose key collates immediately after the
83 * search @key, i.e. this is the position in the index at which an index entry
92 * If the index entry was modified, call flush_dcache_index_entry_page()
97 * Locking: - Caller must hold i_mutex on the index inode.
98 * - Each page cache page in the index allocation mapping must be
131 idx_ni->itype.index.collation_rule)) {
134 idx_ni->itype.index.collation_rule));
137 /* Get hold of the mft record for the index inode. */
149 /* Find the index root attribute in the mft record. */
160 /* Get to the index root value (it has been verified in read_inode). */
163 index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length);
164 /* The first index entry. */
165 ie = (INDEX_ENTRY*)((u8*)&ir->index +
166 le32_to_cpu(ir->index.entries_offset));
213 rc = ntfs_collate(vol, idx_ni->itype.index.collation_rule, key,
217 * is definitely no such key in this index but we might need to
231 * We have finished with this index without success. Check for the
240 /* Consistency check: Verify that an index allocation exists. */
242 ntfs_error(sb, "No index allocation attribute but index entry "
251 * We are done with the index root and the mft record. Release them,
260 * Convert vcn to index into the index allocation attribute in units
265 idx_ni->itype.index.vcn_size_bits >> PAGE_SHIFT);
267 ntfs_error(sb, "Failed to map index page, error %ld.",
275 /* Get to the index allocation block. */
277 idx_ni->itype.index.vcn_size_bits) & ~PAGE_MASK));
292 ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is "
300 if (le32_to_cpu(ia->index.allocated_size) + 0x18 !=
301 idx_ni->itype.index.block_size) {
303 "a size (%u) differing from the index "
307 le32_to_cpu(ia->index.allocated_size) + 0x18,
308 idx_ni->itype.index.block_size);
311 index_end = (u8*)ia + idx_ni->itype.index.block_size;
320 index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length);
321 if (index_end > (u8*)ia + idx_ni->itype.index.block_size) {
322 ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of inode "
327 /* The first index entry. */
328 ie = (INDEX_ENTRY*)((u8*)&ia->index +
329 le32_to_cpu(ia->index.entries_offset));
331 * Iterate similar to above big loop but applied to index buffer, thus
376 rc = ntfs_collate(vol, idx_ni->itype.index.collation_rule, key,
380 * is definitely no such key in this index but we might need to
394 * We have finished with this index buffer without success. Check for
402 if ((ia->index.flags & NODE_MASK) == LEAF_NODE) {
438 ntfs_error(sb, "Corrupt index. Aborting lookup.");