_lookup() and _lookup_next() each had nearly identical loops that took a
dirty boolean. We combine them into one walker with flags for dirty and
next and add a prev prev as well, giving us all the exported functions
with combinations of the flags.
We also add _last() to match _first() and _prev() to match _next().
Signed-off-by: Zach Brown <zab@versity.com>