Lines Matching refs:fnd

656 void fnd_clear(struct ntfs_fnd *fnd)  in fnd_clear()  argument
660 for (i = fnd->level - 1; i >= 0; i--) { in fnd_clear()
661 struct indx_node *n = fnd->nodes[i]; in fnd_clear()
667 fnd->nodes[i] = NULL; in fnd_clear()
669 fnd->level = 0; in fnd_clear()
670 fnd->root_de = NULL; in fnd_clear()
673 static int fnd_push(struct ntfs_fnd *fnd, struct indx_node *n, in fnd_push() argument
676 int i = fnd->level; in fnd_push()
678 if (i < 0 || i >= ARRAY_SIZE(fnd->nodes)) in fnd_push()
680 fnd->nodes[i] = n; in fnd_push()
681 fnd->de[i] = e; in fnd_push()
682 fnd->level += 1; in fnd_push()
686 static struct indx_node *fnd_pop(struct ntfs_fnd *fnd) in fnd_pop() argument
689 int i = fnd->level; in fnd_pop()
692 n = fnd->nodes[i]; in fnd_pop()
693 fnd->nodes[i] = NULL; in fnd_pop()
694 fnd->level = i; in fnd_pop()
699 static bool fnd_is_empty(struct ntfs_fnd *fnd) in fnd_is_empty() argument
701 if (!fnd->level) in fnd_is_empty()
702 return !fnd->root_de; in fnd_is_empty()
704 return !fnd->de[fnd->level - 1]; in fnd_is_empty()
1142 struct ntfs_fnd *fnd) in indx_find() argument
1157 e = fnd->level ? fnd->de[fnd->level - 1] : fnd->root_de; in indx_find()
1166 fnd_clear(fnd); in indx_find()
1173 fnd->root_de = e; in indx_find()
1195 fnd_push(fnd, node, e); in indx_find()
1204 struct ntfs_fnd *fnd) in indx_find_sort() argument
1210 int level = fnd->level; in indx_find_sort()
1217 fnd_clear(fnd); in indx_find_sort()
1218 fnd->root_de = e; in indx_find_sort()
1220 if (de_is_last(fnd->root_de)) { in indx_find_sort()
1225 e = hdr_next_de(&root->ihdr, fnd->root_de); in indx_find_sort()
1228 fnd->root_de = e; in indx_find_sort()
1230 n = fnd->nodes[level - 1]; in indx_find_sort()
1231 e = fnd->de[level - 1]; in indx_find_sort()
1240 fnd->de[level - 1] = e; in indx_find_sort()
1252 fnd_pop(fnd); in indx_find_sort()
1270 fnd_push(fnd, n, e); in indx_find_sort()
1285 fnd_pop(fnd); in indx_find_sort()
1289 level = fnd->level; in indx_find_sort()
1292 n = fnd->nodes[level - 1]; in indx_find_sort()
1293 e = fnd->de[level - 1]; in indx_find_sort()
1294 } else if (fnd->root_de) { in indx_find_sort()
1296 e = fnd->root_de; in indx_find_sort()
1297 fnd->root_de = NULL; in indx_find_sort()
1305 if (!fnd->root_de) in indx_find_sort()
1306 fnd->root_de = e; in indx_find_sort()
1314 size_t *off, struct ntfs_fnd *fnd) in indx_find_raw() argument
1331 fnd_clear(fnd); in indx_find_raw()
1332 fnd->root_de = e; in indx_find_raw()
1344 } else if (!fnd->root_de) in indx_find_raw()
1352 if (!fnd->level) { in indx_find_raw()
1354 if (!de_is_last(fnd->root_de)) { in indx_find_raw()
1355 e = hdr_next_de(&root->ihdr, fnd->root_de); in indx_find_raw()
1358 fnd->root_de = e; in indx_find_raw()
1366 e2 = fnd->de[fnd->level - 1]; in indx_find_raw()
1368 n = fnd->nodes[fnd->level - 1]; in indx_find_raw()
1374 fnd->de[fnd->level - 1] = e; in indx_find_raw()
1386 fnd_pop(fnd); in indx_find_raw()
1408 fnd_push(fnd, n, e); in indx_find_raw()
1578 struct ntfs_fnd *fnd, bool undo) in indx_insert_into_root() argument
1621 fnd_clear(fnd); in indx_insert_into_root()
1622 fnd->root_de = e; in indx_insert_into_root()
1690 fnd->root_de = hdr_first_de(hdr); in indx_insert_into_root()
1751 fnd_clear(fnd); in indx_insert_into_root()
1752 err = indx_insert_entry(indx, ni, new_de, ctx, fnd, undo); in indx_insert_into_root()
1765 fnd_push(fnd, n, e); in indx_insert_into_root()
1790 const void *ctx, int level, struct ntfs_fnd *fnd) in indx_insert_into_buffer() argument
1796 struct indx_node *n1 = fnd->nodes[level]; in indx_insert_into_buffer()
1806 e = fnd->level - 1 == level ? fnd->de[level] : NULL; in indx_insert_into_buffer()
1808 fnd->de[level] = e; in indx_insert_into_buffer()
1904 err = indx_insert_into_root(indx, ni, up_e, NULL, ctx, fnd, 0); in indx_insert_into_buffer()
1911 level - 1, fnd); in indx_insert_into_buffer()
1937 struct ntfs_fnd *fnd, bool undo) in indx_insert_entry() argument
1945 if (!fnd) { in indx_insert_entry()
1951 fnd = fnd_a; in indx_insert_entry()
1960 if (fnd_is_empty(fnd)) { in indx_insert_entry()
1967 fnd); in indx_insert_entry()
1977 if (!fnd->level) { in indx_insert_entry()
1982 err = indx_insert_into_root(indx, ni, new_de, fnd->root_de, ctx, in indx_insert_entry()
1983 fnd, undo); in indx_insert_entry()
1989 fnd->level - 1, fnd); in indx_insert_entry()
2166 struct ntfs_fnd *fnd) in indx_get_entry_to_replace() argument
2186 fnd_push(fnd, n, e); in indx_get_entry_to_replace()
2193 level = fnd->level - 1; in indx_get_entry_to_replace()
2206 n = fnd->nodes[level]; in indx_get_entry_to_replace()
2241 fnd->de[level] = e; in indx_get_entry_to_replace()
2250 fnd_clear(fnd); in indx_get_entry_to_replace()
2263 struct ntfs_fnd *fnd, *fnd2; in indx_delete_entry() local
2275 fnd = fnd_get(); in indx_delete_entry()
2276 if (!fnd) { in indx_delete_entry()
2294 err = indx_find(indx, ni, root, key, key_len, ctx, &diff, &e, fnd); in indx_delete_entry()
2303 level = fnd->level; in indx_delete_entry()
2306 n = fnd->nodes[level - 1]; in indx_delete_entry()
2307 e = fnd->de[level - 1]; in indx_delete_entry()
2312 e = fnd->root_de; in indx_delete_entry()
2337 fnd_pop(fnd); in indx_delete_entry()
2357 fnd->level - 1, in indx_delete_entry()
2358 fnd) : in indx_delete_entry()
2360 ctx, fnd, 0); in indx_delete_entry()
2402 level = fnd->level; in indx_delete_entry()
2404 hdr = level ? &fnd->nodes[level - 1]->index->ihdr : &root->ihdr; in indx_delete_entry()
2426 fnd_clear(fnd); in indx_delete_entry()
2435 fnd_push(fnd, in, NULL); in indx_delete_entry()
2440 fnd_push(fnd, fnd2->nodes[level], fnd2->de[level]); in indx_delete_entry()
2446 for (level = fnd->level; level; level--) { in indx_delete_entry()
2447 struct indx_node *in = fnd->nodes[level - 1]; in indx_delete_entry()
2546 for (; level < fnd->level; level++) { in indx_delete_entry()
2547 ib = fnd->nodes[level]->index; in indx_delete_entry()
2558 fnd_clear(fnd); in indx_delete_entry()
2565 err = indx_insert_entry(indx, ni, me, ctx, fnd, 0); in indx_delete_entry()
2578 fnd_clear(fnd); in indx_delete_entry()
2634 fnd_put(fnd); in indx_delete_entry()
2650 struct ntfs_fnd *fnd; in indx_update_dup() local
2655 fnd = fnd_get(); in indx_update_dup()
2656 if (!fnd) in indx_update_dup()
2667 &diff, &e, fnd); in indx_update_dup()
2692 if (fnd->level) { in indx_update_dup()
2694 err = indx_write(indx, ni, fnd->nodes[fnd->level - 1], sync); in indx_update_dup()
2705 fnd_put(fnd); in indx_update_dup()