aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 5020b280a771..088358c8006b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -257,9 +257,11 @@ static int filemap_check_errors(struct address_space *mapping)
257{ 257{
258 int ret = 0; 258 int ret = 0;
259 /* Check for outstanding write errors */ 259 /* Check for outstanding write errors */
260 if (test_and_clear_bit(AS_ENOSPC, &mapping->flags)) 260 if (test_bit(AS_ENOSPC, &mapping->flags) &&
261 test_and_clear_bit(AS_ENOSPC, &mapping->flags))
261 ret = -ENOSPC; 262 ret = -ENOSPC;
262 if (test_and_clear_bit(AS_EIO, &mapping->flags)) 263 if (test_bit(AS_EIO, &mapping->flags) &&
264 test_and_clear_bit(AS_EIO, &mapping->flags))
263 ret = -EIO; 265 ret = -EIO;
264 return ret; 266 return ret;
265} 267}
@@ -906,8 +908,8 @@ EXPORT_SYMBOL(page_cache_prev_hole);
906 * Looks up the page cache slot at @mapping & @offset. If there is a 908 * Looks up the page cache slot at @mapping & @offset. If there is a
907 * page cache page, it is returned with an increased refcount. 909 * page cache page, it is returned with an increased refcount.
908 * 910 *
909 * If the slot holds a shadow entry of a previously evicted page, it 911 * If the slot holds a shadow entry of a previously evicted page, or a
910 * is returned. 912 * swap entry from shmem/tmpfs, it is returned.
911 * 913 *
912 * Otherwise, %NULL is returned. 914 * Otherwise, %NULL is returned.
913 */ 915 */
@@ -928,9 +930,9 @@ repeat:
928 if (radix_tree_deref_retry(page)) 930 if (radix_tree_deref_retry(page))
929 goto repeat; 931 goto repeat;
930 /* 932 /*
931 * Otherwise, shmem/tmpfs must be storing a swap entry 933 * A shadow entry of a recently evicted page,
932 * here as an exceptional entry: so return it without 934 * or a swap entry from shmem/tmpfs. Return
933 * attempting to raise page count. 935 * it without attempting to raise page count.
934 */ 936 */
935 goto out; 937 goto out;
936 } 938 }
@@ -983,8 +985,8 @@ EXPORT_SYMBOL(find_get_page);
983 * page cache page, it is returned locked and with an increased 985 * page cache page, it is returned locked and with an increased
984 * refcount. 986 * refcount.
985 * 987 *
986 * If the slot holds a shadow entry of a previously evicted page, it 988 * If the slot holds a shadow entry of a previously evicted page, or a
987 * is returned. 989 * swap entry from shmem/tmpfs, it is returned.
988 * 990 *
989 * Otherwise, %NULL is returned. 991 * Otherwise, %NULL is returned.
990 * 992 *
@@ -1099,8 +1101,8 @@ EXPORT_SYMBOL(find_or_create_page);
1099 * with ascending indexes. There may be holes in the indices due to 1101 * with ascending indexes. There may be holes in the indices due to
1100 * not-present pages. 1102 * not-present pages.
1101 * 1103 *
1102 * Any shadow entries of evicted pages are included in the returned 1104 * Any shadow entries of evicted pages, or swap entries from
1103 * array. 1105 * shmem/tmpfs, are included in the returned array.
1104 * 1106 *
1105 * find_get_entries() returns the number of pages and shadow entries 1107 * find_get_entries() returns the number of pages and shadow entries
1106 * which were found. 1108 * which were found.
@@ -1128,9 +1130,9 @@ repeat:
1128 if (radix_tree_deref_retry(page)) 1130 if (radix_tree_deref_retry(page))
1129 goto restart; 1131 goto restart;
1130 /* 1132 /*
1131 * Otherwise, we must be storing a swap entry 1133 * A shadow entry of a recently evicted page,
1132 * here as an exceptional entry: so return it 1134 * or a swap entry from shmem/tmpfs. Return
1133 * without attempting to raise page count. 1135 * it without attempting to raise page count.
1134 */ 1136 */
1135 goto export; 1137 goto export;
1136 } 1138 }
@@ -1198,9 +1200,9 @@ repeat:
1198 goto restart; 1200 goto restart;
1199 } 1201 }
1200 /* 1202 /*
1201 * Otherwise, shmem/tmpfs must be storing a swap entry 1203 * A shadow entry of a recently evicted page,
1202 * here as an exceptional entry: so skip over it - 1204 * or a swap entry from shmem/tmpfs. Skip
1203 * we only reach this from invalidate_mapping_pages(). 1205 * over it.
1204 */ 1206 */
1205 continue; 1207 continue;
1206 } 1208 }
@@ -1265,9 +1267,9 @@ repeat:
1265 goto restart; 1267 goto restart;
1266 } 1268 }
1267 /* 1269 /*
1268 * Otherwise, shmem/tmpfs must be storing a swap entry 1270 * A shadow entry of a recently evicted page,
1269 * here as an exceptional entry: so stop looking for 1271 * or a swap entry from shmem/tmpfs. Stop
1270 * contiguous pages. 1272 * looking for contiguous pages.
1271 */ 1273 */
1272 break; 1274 break;
1273 } 1275 }
@@ -1341,10 +1343,17 @@ repeat:
1341 goto restart; 1343 goto restart;
1342 } 1344 }
1343 /* 1345 /*
1344 * This function is never used on a shmem/tmpfs 1346 * A shadow entry of a recently evicted page.
1345 * mapping, so a swap entry won't be found here. 1347 *
1348 * Those entries should never be tagged, but
1349 * this tree walk is lockless and the tags are
1350 * looked up in bulk, one radix tree node at a
1351 * time, so there is a sizable window for page
1352 * reclaim to evict a page we saw tagged.
1353 *
1354 * Skip over it.
1346 */ 1355 */
1347 BUG(); 1356 continue;
1348 } 1357 }
1349 1358
1350 if (!page_cache_get_speculative(page)) 1359 if (!page_cache_get_speculative(page))