Lines Matching refs:fnd
655 void fnd_clear(struct ntfs_fnd *fnd) in fnd_clear() argument
659 for (i = fnd->level - 1; i >= 0; i--) { in fnd_clear()
660 struct indx_node *n = fnd->nodes[i]; in fnd_clear()
666 fnd->nodes[i] = NULL; in fnd_clear()
668 fnd->level = 0; in fnd_clear()
669 fnd->root_de = NULL; in fnd_clear()
672 static int fnd_push(struct ntfs_fnd *fnd, struct indx_node *n, in fnd_push() argument
677 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()
1133 struct ntfs_fnd *fnd) in indx_find() argument
1148 e = fnd->level ? fnd->de[fnd->level - 1] : fnd->root_de; in indx_find()
1157 fnd_clear(fnd); in indx_find()
1164 fnd->root_de = e; in indx_find()
1184 fnd_push(fnd, node, e); in indx_find()
1193 struct ntfs_fnd *fnd) in indx_find_sort() argument
1199 int level = fnd->level; in indx_find_sort()
1206 fnd_clear(fnd); in indx_find_sort()
1207 fnd->root_de = e; in indx_find_sort()
1209 if (de_is_last(fnd->root_de)) { in indx_find_sort()
1214 e = hdr_next_de(&root->ihdr, fnd->root_de); in indx_find_sort()
1217 fnd->root_de = e; in indx_find_sort()
1219 n = fnd->nodes[level - 1]; in indx_find_sort()
1220 e = fnd->de[level - 1]; in indx_find_sort()
1229 fnd->de[level - 1] = e; in indx_find_sort()
1241 fnd_pop(fnd); in indx_find_sort()
1259 fnd_push(fnd, n, e); in indx_find_sort()
1274 fnd_pop(fnd); in indx_find_sort()
1278 level = fnd->level; in indx_find_sort()
1281 n = fnd->nodes[level - 1]; in indx_find_sort()
1282 e = fnd->de[level - 1]; in indx_find_sort()
1283 } else if (fnd->root_de) { in indx_find_sort()
1285 e = fnd->root_de; in indx_find_sort()
1286 fnd->root_de = NULL; in indx_find_sort()
1294 if (!fnd->root_de) in indx_find_sort()
1295 fnd->root_de = e; in indx_find_sort()
1303 size_t *off, struct ntfs_fnd *fnd) in indx_find_raw() argument
1320 fnd_clear(fnd); in indx_find_raw()
1321 fnd->root_de = e; in indx_find_raw()
1333 } else if (!fnd->root_de) in indx_find_raw()
1341 if (!fnd->level) { in indx_find_raw()
1343 if (!de_is_last(fnd->root_de)) { in indx_find_raw()
1344 e = hdr_next_de(&root->ihdr, fnd->root_de); in indx_find_raw()
1347 fnd->root_de = e; in indx_find_raw()
1355 e2 = fnd->de[fnd->level - 1]; in indx_find_raw()
1357 n = fnd->nodes[fnd->level - 1]; in indx_find_raw()
1363 fnd->de[fnd->level - 1] = e; in indx_find_raw()
1375 fnd_pop(fnd); in indx_find_raw()
1397 fnd_push(fnd, n, e); in indx_find_raw()
1557 struct ntfs_fnd *fnd, bool undo) in indx_insert_into_root() argument
1600 fnd_clear(fnd); in indx_insert_into_root()
1601 fnd->root_de = e; in indx_insert_into_root()
1669 fnd->root_de = hdr_first_de(hdr); in indx_insert_into_root()
1730 fnd_clear(fnd); in indx_insert_into_root()
1731 err = indx_insert_entry(indx, ni, new_de, ctx, fnd, undo); in indx_insert_into_root()
1744 fnd_push(fnd, n, e); in indx_insert_into_root()
1769 const void *ctx, int level, struct ntfs_fnd *fnd) in indx_insert_into_buffer() argument
1775 struct indx_node *n1 = fnd->nodes[level]; in indx_insert_into_buffer()
1784 e = fnd->level - 1 == level ? fnd->de[level] : NULL; in indx_insert_into_buffer()
1786 fnd->de[level] = e; in indx_insert_into_buffer()
1875 err = indx_insert_into_root(indx, ni, up_e, NULL, ctx, fnd, 0); in indx_insert_into_buffer()
1884 level - 1, fnd); in indx_insert_into_buffer()
1902 struct ntfs_fnd *fnd, bool undo) in indx_insert_entry() argument
1910 if (!fnd) { in indx_insert_entry()
1916 fnd = fnd_a; in indx_insert_entry()
1925 if (fnd_is_empty(fnd)) { in indx_insert_entry()
1932 fnd); in indx_insert_entry()
1942 if (!fnd->level) { in indx_insert_entry()
1947 err = indx_insert_into_root(indx, ni, new_de, fnd->root_de, ctx, in indx_insert_entry()
1948 fnd, undo); in indx_insert_entry()
1956 fnd->level - 1, fnd); in indx_insert_entry()
2132 struct ntfs_fnd *fnd) in indx_get_entry_to_replace() argument
2152 fnd_push(fnd, n, e); in indx_get_entry_to_replace()
2159 level = fnd->level - 1; in indx_get_entry_to_replace()
2172 n = fnd->nodes[level]; in indx_get_entry_to_replace()
2207 fnd->de[level] = e; in indx_get_entry_to_replace()
2215 fnd_clear(fnd); in indx_get_entry_to_replace()
2228 struct ntfs_fnd *fnd, *fnd2; in indx_delete_entry() local
2240 fnd = fnd_get(); in indx_delete_entry()
2241 if (!fnd) { in indx_delete_entry()
2259 err = indx_find(indx, ni, root, key, key_len, ctx, &diff, &e, fnd); in indx_delete_entry()
2268 level = fnd->level; in indx_delete_entry()
2271 n = fnd->nodes[level - 1]; in indx_delete_entry()
2272 e = fnd->de[level - 1]; in indx_delete_entry()
2277 e = fnd->root_de; in indx_delete_entry()
2302 fnd_pop(fnd); in indx_delete_entry()
2322 fnd->level - 1, in indx_delete_entry()
2323 fnd) in indx_delete_entry()
2325 ctx, fnd, 0); in indx_delete_entry()
2367 level = fnd->level; in indx_delete_entry()
2369 hdr = level ? &fnd->nodes[level - 1]->index->ihdr : &root->ihdr; in indx_delete_entry()
2391 fnd_clear(fnd); in indx_delete_entry()
2400 fnd_push(fnd, in, NULL); in indx_delete_entry()
2405 fnd_push(fnd, fnd2->nodes[level], fnd2->de[level]); in indx_delete_entry()
2411 for (level = fnd->level; level; level--) { in indx_delete_entry()
2412 struct indx_node *in = fnd->nodes[level - 1]; in indx_delete_entry()
2511 for (; level < fnd->level; level++) { in indx_delete_entry()
2512 ib = fnd->nodes[level]->index; in indx_delete_entry()
2523 fnd_clear(fnd); in indx_delete_entry()
2530 err = indx_insert_entry(indx, ni, me, ctx, fnd, 0); in indx_delete_entry()
2543 fnd_clear(fnd); in indx_delete_entry()
2596 fnd_put(fnd); in indx_delete_entry()
2612 struct ntfs_fnd *fnd; in indx_update_dup() local
2617 fnd = fnd_get(); in indx_update_dup()
2618 if (!fnd) in indx_update_dup()
2629 &diff, &e, fnd); in indx_update_dup()
2654 if (fnd->level) { in indx_update_dup()
2656 err = indx_write(indx, ni, fnd->nodes[fnd->level - 1], sync); in indx_update_dup()
2667 fnd_put(fnd); in indx_update_dup()