diff options
Diffstat (limited to 'mm/truncate.c')
-rw-r--r-- | mm/truncate.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index ecdfdcc50522..6c79ca4a1ca7 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -341,6 +341,15 @@ failed: | |||
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
343 | 343 | ||
344 | static int do_launder_page(struct address_space *mapping, struct page *page) | ||
345 | { | ||
346 | if (!PageDirty(page)) | ||
347 | return 0; | ||
348 | if (page->mapping != mapping || mapping->a_ops->launder_page == NULL) | ||
349 | return 0; | ||
350 | return mapping->a_ops->launder_page(page); | ||
351 | } | ||
352 | |||
344 | /** | 353 | /** |
345 | * invalidate_inode_pages2_range - remove range of pages from an address_space | 354 | * invalidate_inode_pages2_range - remove range of pages from an address_space |
346 | * @mapping: the address_space | 355 | * @mapping: the address_space |
@@ -405,7 +414,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
405 | PAGE_CACHE_SIZE, 0); | 414 | PAGE_CACHE_SIZE, 0); |
406 | } | 415 | } |
407 | } | 416 | } |
408 | if (!invalidate_complete_page2(mapping, page)) | 417 | ret = do_launder_page(mapping, page); |
418 | if (ret == 0 && !invalidate_complete_page2(mapping, page)) | ||
409 | ret = -EIO; | 419 | ret = -EIO; |
410 | unlock_page(page); | 420 | unlock_page(page); |
411 | } | 421 | } |