aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2011-08-03 19:21:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-08-03 20:25:24 -0400
commit8079b1c859c44f27d63da4951f5038a16589a563 (patch)
tree677e77a4c9d3b9c33427196cb5f860ebcf530b15 /mm/filemap.c
parente504f3fdd63d486d45b18009e5a65f2e329acb0a (diff)
mm: clarify the radix_tree exceptional cases
Make the radix_tree exceptional cases, mostly in filemap.c, clearer. It's hard to devise a suitable snappy name that illuminates the use by shmem/tmpfs for swap, while keeping filemap/pagecache/radix_tree generality. And akpm points out that /* radix_tree_deref_retry(page) */ comments look like calls that have been commented out for unknown reason. Skirt the naming difficulty by rearranging these blocks to handle the transient radix_tree_deref_retry(page) case first; then just explain the remaining shmem/tmpfs swap case in a comment. Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c66
1 files changed, 44 insertions, 22 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 96778faf82d..645a080ba4d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -700,10 +700,14 @@ repeat:
700 if (unlikely(!page)) 700 if (unlikely(!page))
701 goto out; 701 goto out;
702 if (radix_tree_exception(page)) { 702 if (radix_tree_exception(page)) {
703 if (radix_tree_exceptional_entry(page)) 703 if (radix_tree_deref_retry(page))
704 goto out; 704 goto repeat;
705 /* radix_tree_deref_retry(page) */ 705 /*
706 goto repeat; 706 * Otherwise, shmem/tmpfs must be storing a swap entry
707 * here as an exceptional entry: so return it without
708 * attempting to raise page count.
709 */
710 goto out;
707 } 711 }
708 if (!page_cache_get_speculative(page)) 712 if (!page_cache_get_speculative(page))
709 goto repeat; 713 goto repeat;
@@ -838,15 +842,21 @@ repeat:
838 continue; 842 continue;
839 843
840 if (radix_tree_exception(page)) { 844 if (radix_tree_exception(page)) {
841 if (radix_tree_exceptional_entry(page)) 845 if (radix_tree_deref_retry(page)) {
842 continue; 846 /*
847 * Transient condition which can only trigger
848 * when entry at index 0 moves out of or back
849 * to root: none yet gotten, safe to restart.
850 */
851 WARN_ON(start | i);
852 goto restart;
853 }
843 /* 854 /*
844 * radix_tree_deref_retry(page): 855 * Otherwise, shmem/tmpfs must be storing a swap entry
845 * can only trigger when entry at index 0 moves out of 856 * here as an exceptional entry: so skip over it -
846 * or back to root: none yet gotten, safe to restart. 857 * we only reach this from invalidate_mapping_pages().
847 */ 858 */
848 WARN_ON(start | i); 859 continue;
849 goto restart;
850 } 860 }
851 861
852 if (!page_cache_get_speculative(page)) 862 if (!page_cache_get_speculative(page))
@@ -904,14 +914,20 @@ repeat:
904 continue; 914 continue;
905 915
906 if (radix_tree_exception(page)) { 916 if (radix_tree_exception(page)) {
907 if (radix_tree_exceptional_entry(page)) 917 if (radix_tree_deref_retry(page)) {
908 break; 918 /*
919 * Transient condition which can only trigger
920 * when entry at index 0 moves out of or back
921 * to root: none yet gotten, safe to restart.
922 */
923 goto restart;
924 }
909 /* 925 /*
910 * radix_tree_deref_retry(page): 926 * Otherwise, shmem/tmpfs must be storing a swap entry
911 * can only trigger when entry at index 0 moves out of 927 * here as an exceptional entry: so stop looking for
912 * or back to root: none yet gotten, safe to restart. 928 * contiguous pages.
913 */ 929 */
914 goto restart; 930 break;
915 } 931 }
916 932
917 if (!page_cache_get_speculative(page)) 933 if (!page_cache_get_speculative(page))
@@ -973,13 +989,19 @@ repeat:
973 continue; 989 continue;
974 990
975 if (radix_tree_exception(page)) { 991 if (radix_tree_exception(page)) {
976 BUG_ON(radix_tree_exceptional_entry(page)); 992 if (radix_tree_deref_retry(page)) {
993 /*
994 * Transient condition which can only trigger
995 * when entry at index 0 moves out of or back
996 * to root: none yet gotten, safe to restart.
997 */
998 goto restart;
999 }
977 /* 1000 /*
978 * radix_tree_deref_retry(page): 1001 * This function is never used on a shmem/tmpfs
979 * can only trigger when entry at index 0 moves out of 1002 * mapping, so a swap entry won't be found here.
980 * or back to root: none yet gotten, safe to restart.
981 */ 1003 */
982 goto restart; 1004 BUG();
983 } 1005 }
984 1006
985 if (!page_cache_get_speculative(page)) 1007 if (!page_cache_get_speculative(page))