lib: radix-tree: update callback for changing leaf nodes

Support handing __radix_tree_replace() a callback that gets invoked for
all leaf nodes that change or get freed as a result of the slot
replacement, to assist users tracking nodes with node->private_list.

This prepares for putting page cache shadow entries into the radix tree
root again and drastically simplifying the shadow tracking.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Johannes Weiner <[email protected]>
Suggested-by: Jan Kara <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Johannes Weiner 2016-12-12 16:43:49 -08:00 • committed by Linus Torvalds
commit 4d693d0860
4 changed files with 36 additions and 16 deletions

View file

@ -311,7 +311,8 @@ static int shmem_radix_tree_replace(struct address_space *mapping,
return -ENOENT;
if (item != expected)
return -ENOENT;
__radix_tree_replace(&mapping->page_tree, node, pslot, replacement);
__radix_tree_replace(&mapping->page_tree, node, pslot,
replacement, NULL, NULL);
return 0;
}