The address_space
structure holds all the pages in radix_tree
(mapping->page_tree
in your case). So all you need is to iterate over that tree. Linux kernel has radix tree API (see here) including the for_each
iterators. For eaxmple:
396 /**
397 * radix_tree_for_each_chunk_slot - iterate over slots in one chunk
398 *
399 * @slot: the void** variable, at the beginning points to chunk first slot
400 * @iter: the struct radix_tree_iter pointer
401 * @flags: RADIX_TREE_ITER_*, should be constant
402 *
403 * This macro is designed to be nested inside radix_tree_for_each_chunk().
404 * @slot points to the radix tree slot, @iter->index contains its index.
405 */
406 #define radix_tree_for_each_chunk_slot(slot, iter, flags) \
407 for (; slot ; slot = radix_tree_next_slot(slot, iter, flags))
408