Index: sys/vm/vm_radix.h =================================================================== --- sys/vm/vm_radix.h +++ sys/vm/vm_radix.h @@ -60,7 +60,7 @@ vm_radix_node_free, vm_radix_smr); /* - * Inserts the key-value pair into the trie. + * Inserts the key-value pair into the trie, starting search from root. * Panics if the key already exists. */ static __inline int @@ -69,6 +69,16 @@ return (VM_RADIX_PCTRIE_INSERT(&rtree->rt_trie, page)); } +/* + * Inserts the key-value pair into the trie, starting search from iterator. + * Panics if the key already exists. + */ +static __inline int +vm_radix_iter_insert(struct pctrie_iter *pages, vm_page_t page) +{ + return (VM_RADIX_PCTRIE_ITER_INSERT(pages, page)); +} + /* * Insert the page into the vm_radix tree with its pindex as the key. Panic if * the pindex already exists. Return zero on success or a non-zero error on @@ -187,6 +197,15 @@ { return (VM_RADIX_PCTRIE_REMOVE_LOOKUP(&rtree->rt_trie, index)); } + +/* + * Remove the current page from the trie. + */ +static __inline void +vm_radix_iter_remove(struct pctrie_iter *pages) +{ + VM_RADIX_PCTRIE_ITER_REMOVE(pages); +} /* * Reclaim all the interior nodes of the trie, and invoke the callback @@ -238,6 +257,19 @@ return (VM_RADIX_PCTRIE_ITER_STEP_GE(pages)); } +/* + * Initialize an iterator pointing to the page with the greatest pindex that is + * less than or equal to the specified pindex, or NULL if there are no such + * pages. Return the page. + * + * Requires that access be externally synchronized by a lock. + */ +static __inline vm_page_t +vm_radix_iter_lookup_le(struct pctrie_iter *pages, vm_pindex_t index) +{ + return (VM_RADIX_PCTRIE_ITER_LOOKUP_LE(pages, index)); +} + /* * Update the iterator to point to the page with the pindex that is one greater * than the current pindex, or NULL if there is no such page. Return the page.