diff options
Diffstat (limited to 'mm/truncate.c')
| -rw-r--r-- | mm/truncate.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index 4fbe1a2da5fb..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 | } |
| 254 | EXPORT_SYMBOL(truncate_inode_pages); | 254 | EXPORT_SYMBOL(truncate_inode_pages); |
| 255 | 255 | ||
| 256 | /** | 256 | unsigned 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 | */ | ||
| 269 | unsigned 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,17 +295,38 @@ 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 | */ | ||
| 317 | unsigned 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 | } | ||
| 314 | EXPORT_SYMBOL(invalidate_mapping_pages); | 322 | EXPORT_SYMBOL(invalidate_mapping_pages); |
| 315 | 323 | ||
| 316 | /* | 324 | /* |
| 317 | * This is like invalidate_complete_page(), except it ignores the page's | 325 | * This is like invalidate_complete_page(), except it ignores the page's |
| 318 | * refcount. We do this because invalidate_inode_pages2() needs stronger | 326 | * refcount. We do this because invalidate_inode_pages2() needs stronger |
| 319 | * invalidation guarantees, and cannot afford to leave pages behind because | 327 | * invalidation guarantees, and cannot afford to leave pages behind because |
| 320 | * shrink_list() has a temp ref on them, or because they're transiently sitting | 328 | * shrink_page_list() has a temp ref on them, or because they're transiently |
| 321 | * in the lru_cache_add() pagevecs. | 329 | * sitting in the lru_cache_add() pagevecs. |
| 322 | */ | 330 | */ |
| 323 | static int | 331 | static int |
| 324 | invalidate_complete_page2(struct address_space *mapping, struct page *page) | 332 | invalidate_complete_page2(struct address_space *mapping, struct page *page) |
