aboutsummaryrefslogtreecommitdiffstats
path: root/mm/truncate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/truncate.c')
-rw-r--r--mm/truncate.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/mm/truncate.c b/mm/truncate.c
index af3dcf0e48e6..7c994f2d6145 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -253,21 +253,8 @@ void truncate_inode_pages(struct address_space *mapping, loff_t lstart)
253} 253}
254EXPORT_SYMBOL(truncate_inode_pages); 254EXPORT_SYMBOL(truncate_inode_pages);
255 255
256/** 256unsigned long __invalidate_mapping_pages(struct address_space *mapping,
257 * invalidate_mapping_pages - Invalidate all the unlocked pages of one inode 257 pgoff_t start, pgoff_t end, bool be_atomic)
258 * @mapping: the address_space which holds the pages to invalidate
259 * @start: the offset 'from' which to invalidate
260 * @end: the offset 'to' which to invalidate (inclusive)
261 *
262 * This function only removes the unlocked pages, if you want to
263 * remove all the pages of one inode, you must call truncate_inode_pages.
264 *
265 * invalidate_mapping_pages() will not block on IO activity. It will not
266 * invalidate pages which are dirty, locked, under writeback or mapped into
267 * pagetables.
268 */
269unsigned long invalidate_mapping_pages(struct address_space *mapping,
270 pgoff_t start, pgoff_t end)
271{ 258{
272 struct pagevec pvec; 259 struct pagevec pvec;
273 pgoff_t next = start; 260 pgoff_t next = start;
@@ -308,9 +295,30 @@ unlock:
308 break; 295 break;
309 } 296 }
310 pagevec_release(&pvec); 297 pagevec_release(&pvec);
298 if (likely(!be_atomic))
299 cond_resched();
311 } 300 }
312 return ret; 301 return ret;
313} 302}
303
304/**
305 * invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
306 * @mapping: the address_space which holds the pages to invalidate
307 * @start: the offset 'from' which to invalidate
308 * @end: the offset 'to' which to invalidate (inclusive)
309 *
310 * This function only removes the unlocked pages, if you want to
311 * remove all the pages of one inode, you must call truncate_inode_pages.
312 *
313 * invalidate_mapping_pages() will not block on IO activity. It will not
314 * invalidate pages which are dirty, locked, under writeback or mapped into
315 * pagetables.
316 */
317unsigned long invalidate_mapping_pages(struct address_space *mapping,
318 pgoff_t start, pgoff_t end)
319{
320 return __invalidate_mapping_pages(mapping, start, end, false);
321}
314EXPORT_SYMBOL(invalidate_mapping_pages); 322EXPORT_SYMBOL(invalidate_mapping_pages);
315 323
316/* 324/*