diff options
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 3277f3b23524..d6846de08887 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2491,3 +2491,33 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
2491 | } | 2491 | } |
2492 | return retval; | 2492 | return retval; |
2493 | } | 2493 | } |
2494 | |||
2495 | /** | ||
2496 | * try_to_release_page() - release old fs-specific metadata on a page | ||
2497 | * | ||
2498 | * @page: the page which the kernel is trying to free | ||
2499 | * @gfp_mask: memory allocation flags (and I/O mode) | ||
2500 | * | ||
2501 | * The address_space is to try to release any data against the page | ||
2502 | * (presumably at page->private). If the release was successful, return `1'. | ||
2503 | * Otherwise return zero. | ||
2504 | * | ||
2505 | * The @gfp_mask argument specifies whether I/O may be performed to release | ||
2506 | * this page (__GFP_IO), and whether the call may block (__GFP_WAIT). | ||
2507 | * | ||
2508 | * NOTE: @gfp_mask may go away, and this function may become non-blocking. | ||
2509 | */ | ||
2510 | int try_to_release_page(struct page *page, gfp_t gfp_mask) | ||
2511 | { | ||
2512 | struct address_space * const mapping = page->mapping; | ||
2513 | |||
2514 | BUG_ON(!PageLocked(page)); | ||
2515 | if (PageWriteback(page)) | ||
2516 | return 0; | ||
2517 | |||
2518 | if (mapping && mapping->a_ops->releasepage) | ||
2519 | return mapping->a_ops->releasepage(page, gfp_mask); | ||
2520 | return try_to_free_buffers(page); | ||
2521 | } | ||
2522 | |||
2523 | EXPORT_SYMBOL(try_to_release_page); | ||