summaryrefslogtreecommitdiffstats
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 3f690bae6b78..7d1010453fb9 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2154,6 +2154,7 @@ int write_cache_pages(struct address_space *mapping,
2154{ 2154{
2155 int ret = 0; 2155 int ret = 0;
2156 int done = 0; 2156 int done = 0;
2157 int error;
2157 struct pagevec pvec; 2158 struct pagevec pvec;
2158 int nr_pages; 2159 int nr_pages;
2159 pgoff_t uninitialized_var(writeback_index); 2160 pgoff_t uninitialized_var(writeback_index);
@@ -2227,25 +2228,31 @@ continue_unlock:
2227 goto continue_unlock; 2228 goto continue_unlock;
2228 2229
2229 trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); 2230 trace_wbc_writepage(wbc, inode_to_bdi(mapping->host));
2230 ret = (*writepage)(page, wbc, data); 2231 error = (*writepage)(page, wbc, data);
2231 if (unlikely(ret)) { 2232 if (unlikely(error)) {
2232 if (ret == AOP_WRITEPAGE_ACTIVATE) { 2233 /*
2234 * Handle errors according to the type of
2235 * writeback. There's no need to continue for
2236 * background writeback. Just push done_index
2237 * past this page so media errors won't choke
2238 * writeout for the entire file. For integrity
2239 * writeback, we must process the entire dirty
2240 * set regardless of errors because the fs may
2241 * still have state to clear for each page. In
2242 * that case we continue processing and return
2243 * the first error.
2244 */
2245 if (error == AOP_WRITEPAGE_ACTIVATE) {
2233 unlock_page(page); 2246 unlock_page(page);
2234 ret = 0; 2247 error = 0;
2235 } else { 2248 } else if (wbc->sync_mode != WB_SYNC_ALL) {
2236 /* 2249 ret = error;
2237 * done_index is set past this page,
2238 * so media errors will not choke
2239 * background writeout for the entire
2240 * file. This has consequences for
2241 * range_cyclic semantics (ie. it may
2242 * not be suitable for data integrity
2243 * writeout).
2244 */
2245 done_index = page->index + 1; 2250 done_index = page->index + 1;
2246 done = 1; 2251 done = 1;
2247 break; 2252 break;
2248 } 2253 }
2254 if (!ret)
2255 ret = error;
2249 } 2256 }
2250 2257
2251 /* 2258 /*