diff options
Diffstat (limited to 'mm/truncate.c')
| -rw-r--r-- | mm/truncate.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index a654928323dc..8fde6580657e 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
| @@ -17,6 +17,32 @@ | |||
| 17 | do_invalidatepage */ | 17 | do_invalidatepage */ |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | /** | ||
| 21 | * do_invalidatepage - invalidate part of all of a page | ||
| 22 | * @page: the page which is affected | ||
| 23 | * @offset: the index of the truncation point | ||
| 24 | * | ||
| 25 | * do_invalidatepage() is called when all or part of the page has become | ||
| 26 | * invalidated by a truncate operation. | ||
| 27 | * | ||
| 28 | * do_invalidatepage() does not have to release all buffers, but it must | ||
| 29 | * ensure that no dirty buffer is left outside @offset and that no I/O | ||
| 30 | * is underway against any of the blocks which are outside the truncation | ||
| 31 | * point. Because the caller is about to free (and possibly reuse) those | ||
| 32 | * blocks on-disk. | ||
| 33 | */ | ||
| 34 | void do_invalidatepage(struct page *page, unsigned long offset) | ||
| 35 | { | ||
| 36 | void (*invalidatepage)(struct page *, unsigned long); | ||
| 37 | invalidatepage = page->mapping->a_ops->invalidatepage; | ||
| 38 | #ifdef CONFIG_BLOCK | ||
| 39 | if (!invalidatepage) | ||
| 40 | invalidatepage = block_invalidatepage; | ||
| 41 | #endif | ||
| 42 | if (invalidatepage) | ||
| 43 | (*invalidatepage)(page, offset); | ||
| 44 | } | ||
| 45 | |||
| 20 | static inline void truncate_partial_page(struct page *page, unsigned partial) | 46 | static inline void truncate_partial_page(struct page *page, unsigned partial) |
| 21 | { | 47 | { |
| 22 | memclear_highpage_flush(page, partial, PAGE_CACHE_SIZE-partial); | 48 | memclear_highpage_flush(page, partial, PAGE_CACHE_SIZE-partial); |
