Lines Matching refs:it
538 _pctrie_iter_lookup_node(struct pctrie_iter *it, uint64_t index, smr_t smr, in _pctrie_iter_lookup_node() argument
548 while (it->top != 0) { in _pctrie_iter_lookup_node()
549 node = it->path[it->top - 1]; in _pctrie_iter_lookup_node()
557 --it->top; in _pctrie_iter_lookup_node()
559 if (it->top == 0) in _pctrie_iter_lookup_node()
560 node = pctrie_root_load(it->ptree, smr, access); in _pctrie_iter_lookup_node()
564 KASSERT(it->top < nitems(it->path), in _pctrie_iter_lookup_node()
565 ("%s: path overflow in trie %p", __func__, it->ptree)); in _pctrie_iter_lookup_node()
566 it->path[it->top++] = node; in _pctrie_iter_lookup_node()
576 _pctrie_iter_lookup(struct pctrie_iter *it, uint64_t index, smr_t smr, in _pctrie_iter_lookup() argument
581 it->index = index; in _pctrie_iter_lookup()
582 node = _pctrie_iter_lookup_node(it, index, smr, access); in _pctrie_iter_lookup()
590 pctrie_iter_lookup(struct pctrie_iter *it, uint64_t index) in pctrie_iter_lookup() argument
592 return (_pctrie_iter_lookup(it, index, NULL, PCTRIE_LOCKED)); in pctrie_iter_lookup()
601 pctrie_iter_insert_lookup(struct pctrie_iter *it, uint64_t *val) in pctrie_iter_insert_lookup() argument
605 it->index = *val; in pctrie_iter_insert_lookup()
606 node = _pctrie_iter_lookup_node(it, *val, NULL, PCTRIE_LOCKED); in pctrie_iter_insert_lookup()
608 if (it->top == 0) in pctrie_iter_insert_lookup()
609 pctrie_node_store(pctrie_root(it->ptree), in pctrie_iter_insert_lookup()
612 pctrie_addnode(it->path[it->top - 1], it->index, in pctrie_iter_insert_lookup()
616 if (__predict_false(pctrie_match_value(node, it->index) != NULL)) in pctrie_iter_insert_lookup()
618 (uintmax_t)it->index); in pctrie_iter_insert_lookup()
625 if (it->top == 0) in pctrie_iter_insert_lookup()
626 return (pctrie_root(it->ptree)); in pctrie_iter_insert_lookup()
627 node = it->path[it->top - 1]; in pctrie_iter_insert_lookup()
628 return (&node->pn_child[pctrie_slot(node, it->index)]); in pctrie_iter_insert_lookup()
636 _pctrie_iter_stride(struct pctrie_iter *it, int stride, smr_t smr, in _pctrie_iter_stride() argument
639 uint64_t index = it->index + stride; in _pctrie_iter_stride()
642 if ((stride > 0) != (index > it->index)) in _pctrie_iter_stride()
645 if ((index < it->limit) != (it->index < it->limit)) in _pctrie_iter_stride()
648 return (_pctrie_iter_lookup(it, index, smr, access)); in _pctrie_iter_stride()
656 pctrie_iter_stride(struct pctrie_iter *it, int stride) in pctrie_iter_stride() argument
658 return (_pctrie_iter_stride(it, stride, NULL, PCTRIE_LOCKED)); in pctrie_iter_stride()
666 pctrie_iter_next(struct pctrie_iter *it) in pctrie_iter_next() argument
668 return (_pctrie_iter_stride(it, 1, NULL, PCTRIE_LOCKED)); in pctrie_iter_next()
676 pctrie_iter_prev(struct pctrie_iter *it) in pctrie_iter_prev() argument
678 return (_pctrie_iter_stride(it, -1, NULL, PCTRIE_LOCKED)); in pctrie_iter_prev()
789 pctrie_iter_lookup_ge(struct pctrie_iter *it, uint64_t index) in pctrie_iter_lookup_ge() argument
796 node = _pctrie_iter_lookup_node(it, index, NULL, PCTRIE_LOCKED); in pctrie_iter_lookup_ge()
804 while (it->top != 0) { in pctrie_iter_lookup_ge()
805 node = it->path[it->top - 1]; in pctrie_iter_lookup_ge()
809 --it->top; in pctrie_iter_lookup_ge()
811 if (it->top == 0) in pctrie_iter_lookup_ge()
821 if (it->limit != 0 && node->pn_owner >= it->limit) in pctrie_iter_lookup_ge()
824 KASSERT(it->top < nitems(it->path), in pctrie_iter_lookup_ge()
825 ("%s: path overflow in trie %p", __func__, it->ptree)); in pctrie_iter_lookup_ge()
826 it->path[it->top++] = node; in pctrie_iter_lookup_ge()
831 if (it->limit != 0 && *m >= it->limit) in pctrie_iter_lookup_ge()
833 it->index = *m; in pctrie_iter_lookup_ge()
842 pctrie_iter_jump_ge(struct pctrie_iter *it, int64_t jump) in pctrie_iter_jump_ge() argument
844 uint64_t index = it->index + jump; in pctrie_iter_jump_ge()
847 if ((jump > 0) != (index > it->index)) in pctrie_iter_jump_ge()
849 if (it->limit != 0 && index >= it->limit) in pctrie_iter_jump_ge()
851 return (pctrie_iter_lookup_ge(it, index)); in pctrie_iter_jump_ge()
946 pctrie_iter_lookup_le(struct pctrie_iter *it, uint64_t index) in pctrie_iter_lookup_le() argument
953 node = _pctrie_iter_lookup_node(it, index, NULL, PCTRIE_LOCKED); in pctrie_iter_lookup_le()
961 while (it->top != 0) { in pctrie_iter_lookup_le()
962 node = it->path[it->top - 1]; in pctrie_iter_lookup_le()
966 --it->top; in pctrie_iter_lookup_le()
968 if (it->top == 0) in pctrie_iter_lookup_le()
978 if (it->limit != 0 && it->limit >= in pctrie_iter_lookup_le()
982 KASSERT(it->top < nitems(it->path), in pctrie_iter_lookup_le()
983 ("%s: path overflow in trie %p", __func__, it->ptree)); in pctrie_iter_lookup_le()
984 it->path[it->top++] = node; in pctrie_iter_lookup_le()
989 if (it->limit != 0 && *m <= it->limit) in pctrie_iter_lookup_le()
991 it->index = *m; in pctrie_iter_lookup_le()
1000 pctrie_iter_jump_le(struct pctrie_iter *it, int64_t jump) in pctrie_iter_jump_le() argument
1002 uint64_t index = it->index - jump; in pctrie_iter_jump_le()
1005 if ((jump > 0) != (index < it->index)) in pctrie_iter_jump_le()
1007 if (it->limit != 0 && index <= it->limit) in pctrie_iter_jump_le()
1009 return (pctrie_iter_lookup_le(it, index)); in pctrie_iter_jump_le()
1106 pctrie_iter_remove(struct pctrie_iter *it, struct pctrie_node **freenode) in pctrie_iter_remove() argument
1114 if (it->top >= 1) { in pctrie_iter_remove()
1115 parent = (it->top >= 2) ? it->path[it->top - 2] : NULL; in pctrie_iter_remove()
1116 node = it->path[it->top - 1]; in pctrie_iter_remove()
1117 slot = pctrie_slot(node, it->index); in pctrie_iter_remove()
1122 child = pctrie_root_load(it->ptree, NULL, PCTRIE_LOCKED); in pctrie_iter_remove()
1124 m = pctrie_match_value(child, it->index); in pctrie_iter_remove()
1126 pctrie_remove(it->ptree, it->index, parent, node, freenode); in pctrie_iter_remove()
1128 --it->top; in pctrie_iter_remove()
1137 pctrie_iter_value(struct pctrie_iter *it) in pctrie_iter_value() argument
1142 if (it->top == 0) in pctrie_iter_value()
1143 node = pctrie_root_load(it->ptree, NULL, in pctrie_iter_value()
1146 node = it->path[it->top - 1]; in pctrie_iter_value()
1147 slot = pctrie_slot(node, it->index); in pctrie_iter_value()