]> git.baikalelectronics.ru Git - kernel.git/commit
radix-tree: use iterators in find_get_pages* functions
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Wed, 28 Mar 2012 21:42:54 +0000 (14:42 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 29 Mar 2012 00:14:37 +0000 (17:14 -0700)
commitdf767a4af48f178e6c69e4fbdd9e15050d456d79
tree4503c084da1097e1cf66d8bac1ec548bc69ce69a
parent241551d60e3a285aa4994f980ce2afb9c1efea83
radix-tree: use iterators in find_get_pages* functions

Replace radix_tree_gang_lookup_slot() and
radix_tree_gang_lookup_tag_slot() in page-cache lookup functions with
brand-new radix-tree direct iterating.  This avoids the double-scanning
and pointer copying.

Iterator don't stop after nr_pages page-get fails in a row, it continue
lookup till the radix-tree end.  Thus we can safely remove these restart
conditions.

Unfortunately, old implementation didn't forbid nr_pages == 0, this corner
case does not fit into new code, so the patch adds an extra check at the
beginning.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Tested-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c