truncate.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /*
  2. * mm/truncate.c - code for taking down pages from address_spaces
  3. *
  4. * Copyright (C) 2002, Linus Torvalds
  5. *
  6. * 10Sep2002 Andrew Morton
  7. * Initial version.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/backing-dev.h>
  11. #include <linux/gfp.h>
  12. #include <linux/mm.h>
  13. #include <linux/swap.h>
  14. #include <linux/export.h>
  15. #include <linux/pagemap.h>
  16. #include <linux/highmem.h>
  17. #include <linux/pagevec.h>
  18. #include <linux/task_io_accounting_ops.h>
  19. #include <linux/buffer_head.h> /* grr. try_to_release_page,
  20. do_invalidatepage */
  21. #include <linux/cleancache.h>
  22. #include "internal.h"
  23. /**
  24. * do_invalidatepage - invalidate part or all of a page
  25. * @page: the page which is affected
  26. * @offset: the index of the truncation point
  27. *
  28. * do_invalidatepage() is called when all or part of the page has become
  29. * invalidated by a truncate operation.
  30. *
  31. * do_invalidatepage() does not have to release all buffers, but it must
  32. * ensure that no dirty buffer is left outside @offset and that no I/O
  33. * is underway against any of the blocks which are outside the truncation
  34. * point. Because the caller is about to free (and possibly reuse) those
  35. * blocks on-disk.
  36. */
  37. void do_invalidatepage(struct page *page, unsigned long offset)
  38. {
  39. void (*invalidatepage)(struct page *, unsigned long);
  40. invalidatepage = page->mapping->a_ops->invalidatepage;
  41. #ifdef CONFIG_BLOCK
  42. if (!invalidatepage)
  43. invalidatepage = block_invalidatepage;
  44. #endif
  45. if (invalidatepage)
  46. (*invalidatepage)(page, offset);
  47. }
  48. static inline void truncate_partial_page(struct page *page, unsigned partial)
  49. {
  50. zero_user_segment(page, partial, PAGE_CACHE_SIZE);
  51. cleancache_invalidate_page(page->mapping, page);
  52. if (page_has_private(page))
  53. do_invalidatepage(page, partial);
  54. }
  55. /*
  56. * This cancels just the dirty bit on the kernel page itself, it
  57. * does NOT actually remove dirty bits on any mmap's that may be
  58. * around. It also leaves the page tagged dirty, so any sync
  59. * activity will still find it on the dirty lists, and in particular,
  60. * clear_page_dirty_for_io() will still look at the dirty bits in
  61. * the VM.
  62. *
  63. * Doing this should *normally* only ever be done when a page
  64. * is truncated, and is not actually mapped anywhere at all. However,
  65. * fs/buffer.c does this when it notices that somebody has cleaned
  66. * out all the buffers on a page without actually doing it through
  67. * the VM. Can you say "ext3 is horribly ugly"? Tought you could.
  68. */
  69. void cancel_dirty_page(struct page *page, unsigned int account_size)
  70. {
  71. if (TestClearPageDirty(page)) {
  72. struct address_space *mapping = page->mapping;
  73. if (mapping && mapping_cap_account_dirty(mapping)) {
  74. dec_zone_page_state(page, NR_FILE_DIRTY);
  75. dec_bdi_stat(mapping->backing_dev_info,
  76. BDI_RECLAIMABLE);
  77. if (account_size)
  78. task_io_account_cancelled_write(account_size);
  79. }
  80. }
  81. }
  82. EXPORT_SYMBOL(cancel_dirty_page);
  83. /*
  84. * If truncate cannot remove the fs-private metadata from the page, the page
  85. * becomes orphaned. It will be left on the LRU and may even be mapped into
  86. * user pagetables if we're racing with filemap_fault().
  87. *
  88. * We need to bale out if page->mapping is no longer equal to the original
  89. * mapping. This happens a) when the VM reclaimed the page while we waited on
  90. * its lock, b) when a concurrent invalidate_mapping_pages got there first and
  91. * c) when tmpfs swizzles a page between a tmpfs inode and swapper_space.
  92. */
  93. static int
  94. truncate_complete_page(struct address_space *mapping, struct page *page)
  95. {
  96. if (page->mapping != mapping)
  97. return -EIO;
  98. if (page_has_private(page))
  99. do_invalidatepage(page, 0);
  100. cancel_dirty_page(page, PAGE_CACHE_SIZE);
  101. ClearPageMappedToDisk(page);
  102. delete_from_page_cache(page);
  103. return 0;
  104. }
  105. /*
  106. * This is for invalidate_mapping_pages(). That function can be called at
  107. * any time, and is not supposed to throw away dirty pages. But pages can
  108. * be marked dirty at any time too, so use remove_mapping which safely
  109. * discards clean, unused pages.
  110. *
  111. * Returns non-zero if the page was successfully invalidated.
  112. */
  113. static int
  114. invalidate_complete_page(struct address_space *mapping, struct page *page)
  115. {
  116. int ret;
  117. if (page->mapping != mapping)
  118. return 0;
  119. if (page_has_private(page) && !try_to_release_page(page, 0))
  120. return 0;
  121. ret = remove_mapping(mapping, page);
  122. return ret;
  123. }
  124. int truncate_inode_page(struct address_space *mapping, struct page *page)
  125. {
  126. if (page_mapped(page)) {
  127. unmap_mapping_range(mapping,
  128. (loff_t)page->index << PAGE_CACHE_SHIFT,
  129. PAGE_CACHE_SIZE, 0);
  130. }
  131. return truncate_complete_page(mapping, page);
  132. }
  133. /*
  134. * Used to get rid of pages on hardware memory corruption.
  135. */
  136. int generic_error_remove_page(struct address_space *mapping, struct page *page)
  137. {
  138. if (!mapping)
  139. return -EINVAL;
  140. /*
  141. * Only punch for normal data pages for now.
  142. * Handling other types like directories would need more auditing.
  143. */
  144. if (!S_ISREG(mapping->host->i_mode))
  145. return -EIO;
  146. return truncate_inode_page(mapping, page);
  147. }
  148. EXPORT_SYMBOL(generic_error_remove_page);
  149. /*
  150. * Safely invalidate one page from its pagecache mapping.
  151. * It only drops clean, unused pages. The page must be locked.
  152. *
  153. * Returns 1 if the page is successfully invalidated, otherwise 0.
  154. */
  155. int invalidate_inode_page(struct page *page)
  156. {
  157. struct address_space *mapping = page_mapping(page);
  158. if (!mapping)
  159. return 0;
  160. if (PageDirty(page) || PageWriteback(page))
  161. return 0;
  162. if (page_mapped(page))
  163. return 0;
  164. return invalidate_complete_page(mapping, page);
  165. }
  166. /**
  167. * truncate_inode_pages_range - truncate range of pages specified by start & end byte offsets
  168. * @mapping: mapping to truncate
  169. * @lstart: offset from which to truncate
  170. * @lend: offset to which to truncate
  171. *
  172. * Truncate the page cache, removing the pages that are between
  173. * specified offsets (and zeroing out partial page
  174. * (if lstart is not page aligned)).
  175. *
  176. * Truncate takes two passes - the first pass is nonblocking. It will not
  177. * block on page locks and it will not block on writeback. The second pass
  178. * will wait. This is to prevent as much IO as possible in the affected region.
  179. * The first pass will remove most pages, so the search cost of the second pass
  180. * is low.
  181. *
  182. * We pass down the cache-hot hint to the page freeing code. Even if the
  183. * mapping is large, it is probably the case that the final pages are the most
  184. * recently touched, and freeing happens in ascending file offset order.
  185. */
  186. void truncate_inode_pages_range(struct address_space *mapping,
  187. loff_t lstart, loff_t lend)
  188. {
  189. const pgoff_t start = (lstart + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT;
  190. const unsigned partial = lstart & (PAGE_CACHE_SIZE - 1);
  191. struct pagevec pvec;
  192. pgoff_t index;
  193. pgoff_t end;
  194. int i;
  195. cleancache_invalidate_inode(mapping);
  196. if (mapping->nrpages == 0)
  197. return;
  198. BUG_ON((lend & (PAGE_CACHE_SIZE - 1)) != (PAGE_CACHE_SIZE - 1));
  199. end = (lend >> PAGE_CACHE_SHIFT);
  200. pagevec_init(&pvec, 0);
  201. index = start;
  202. while (index <= end && pagevec_lookup(&pvec, mapping, index,
  203. min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
  204. mem_cgroup_uncharge_start();
  205. for (i = 0; i < pagevec_count(&pvec); i++) {
  206. struct page *page = pvec.pages[i];
  207. /* We rely upon deletion not changing page->index */
  208. index = page->index;
  209. if (index > end)
  210. break;
  211. if (!trylock_page(page))
  212. continue;
  213. WARN_ON(page->index != index);
  214. if (PageWriteback(page)) {
  215. unlock_page(page);
  216. continue;
  217. }
  218. truncate_inode_page(mapping, page);
  219. unlock_page(page);
  220. }
  221. pagevec_release(&pvec);
  222. mem_cgroup_uncharge_end();
  223. cond_resched();
  224. index++;
  225. }
  226. if (partial) {
  227. struct page *page = find_lock_page(mapping, start - 1);
  228. if (page) {
  229. wait_on_page_writeback(page);
  230. truncate_partial_page(page, partial);
  231. unlock_page(page);
  232. page_cache_release(page);
  233. }
  234. }
  235. index = start;
  236. for ( ; ; ) {
  237. cond_resched();
  238. if (!pagevec_lookup(&pvec, mapping, index,
  239. min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
  240. if (index == start)
  241. break;
  242. index = start;
  243. continue;
  244. }
  245. if (index == start && pvec.pages[0]->index > end) {
  246. pagevec_release(&pvec);
  247. break;
  248. }
  249. mem_cgroup_uncharge_start();
  250. for (i = 0; i < pagevec_count(&pvec); i++) {
  251. struct page *page = pvec.pages[i];
  252. /* We rely upon deletion not changing page->index */
  253. index = page->index;
  254. if (index > end)
  255. break;
  256. lock_page(page);
  257. WARN_ON(page->index != index);
  258. wait_on_page_writeback(page);
  259. truncate_inode_page(mapping, page);
  260. unlock_page(page);
  261. }
  262. pagevec_release(&pvec);
  263. mem_cgroup_uncharge_end();
  264. index++;
  265. }
  266. cleancache_invalidate_inode(mapping);
  267. }
  268. EXPORT_SYMBOL(truncate_inode_pages_range);
  269. /**
  270. * truncate_inode_pages - truncate *all* the pages from an offset
  271. * @mapping: mapping to truncate
  272. * @lstart: offset from which to truncate
  273. *
  274. * Called under (and serialised by) inode->i_mutex.
  275. *
  276. * Note: When this function returns, there can be a page in the process of
  277. * deletion (inside __delete_from_page_cache()) in the specified range. Thus
  278. * mapping->nrpages can be non-zero when this function returns even after
  279. * truncation of the whole mapping.
  280. */
  281. void truncate_inode_pages(struct address_space *mapping, loff_t lstart)
  282. {
  283. truncate_inode_pages_range(mapping, lstart, (loff_t)-1);
  284. }
  285. EXPORT_SYMBOL(truncate_inode_pages);
  286. /**
  287. * invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
  288. * @mapping: the address_space which holds the pages to invalidate
  289. * @start: the offset 'from' which to invalidate
  290. * @end: the offset 'to' which to invalidate (inclusive)
  291. *
  292. * This function only removes the unlocked pages, if you want to
  293. * remove all the pages of one inode, you must call truncate_inode_pages.
  294. *
  295. * invalidate_mapping_pages() will not block on IO activity. It will not
  296. * invalidate pages which are dirty, locked, under writeback or mapped into
  297. * pagetables.
  298. */
  299. unsigned long invalidate_mapping_pages(struct address_space *mapping,
  300. pgoff_t start, pgoff_t end)
  301. {
  302. struct pagevec pvec;
  303. pgoff_t index = start;
  304. unsigned long ret;
  305. unsigned long count = 0;
  306. int i;
  307. /*
  308. * Note: this function may get called on a shmem/tmpfs mapping:
  309. * pagevec_lookup() might then return 0 prematurely (because it
  310. * got a gangful of swap entries); but it's hardly worth worrying
  311. * about - it can rarely have anything to free from such a mapping
  312. * (most pages are dirty), and already skips over any difficulties.
  313. */
  314. pagevec_init(&pvec, 0);
  315. while (index <= end && pagevec_lookup(&pvec, mapping, index,
  316. min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
  317. mem_cgroup_uncharge_start();
  318. for (i = 0; i < pagevec_count(&pvec); i++) {
  319. struct page *page = pvec.pages[i];
  320. /* We rely upon deletion not changing page->index */
  321. index = page->index;
  322. if (index > end)
  323. break;
  324. if (!trylock_page(page))
  325. continue;
  326. WARN_ON(page->index != index);
  327. ret = invalidate_inode_page(page);
  328. unlock_page(page);
  329. /*
  330. * Invalidation is a hint that the page is no longer
  331. * of interest and try to speed up its reclaim.
  332. */
  333. if (!ret)
  334. deactivate_page(page);
  335. count += ret;
  336. }
  337. pagevec_release(&pvec);
  338. mem_cgroup_uncharge_end();
  339. cond_resched();
  340. index++;
  341. }
  342. return count;
  343. }
  344. EXPORT_SYMBOL(invalidate_mapping_pages);
  345. /*
  346. * This is like invalidate_complete_page(), except it ignores the page's
  347. * refcount. We do this because invalidate_inode_pages2() needs stronger
  348. * invalidation guarantees, and cannot afford to leave pages behind because
  349. * shrink_page_list() has a temp ref on them, or because they're transiently
  350. * sitting in the lru_cache_add() pagevecs.
  351. */
  352. static int
  353. invalidate_complete_page2(struct address_space *mapping, struct page *page)
  354. {
  355. if (page->mapping != mapping)
  356. return 0;
  357. if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL))
  358. return 0;
  359. spin_lock_irq(&mapping->tree_lock);
  360. if (PageDirty(page))
  361. goto failed;
  362. BUG_ON(page_has_private(page));
  363. __delete_from_page_cache(page);
  364. spin_unlock_irq(&mapping->tree_lock);
  365. mem_cgroup_uncharge_cache_page(page);
  366. if (mapping->a_ops->freepage)
  367. mapping->a_ops->freepage(page);
  368. page_cache_release(page); /* pagecache ref */
  369. return 1;
  370. failed:
  371. spin_unlock_irq(&mapping->tree_lock);
  372. return 0;
  373. }
  374. static int do_launder_page(struct address_space *mapping, struct page *page)
  375. {
  376. if (!PageDirty(page))
  377. return 0;
  378. if (page->mapping != mapping || mapping->a_ops->launder_page == NULL)
  379. return 0;
  380. return mapping->a_ops->launder_page(page);
  381. }
  382. /**
  383. * invalidate_inode_pages2_range - remove range of pages from an address_space
  384. * @mapping: the address_space
  385. * @start: the page offset 'from' which to invalidate
  386. * @end: the page offset 'to' which to invalidate (inclusive)
  387. *
  388. * Any pages which are found to be mapped into pagetables are unmapped prior to
  389. * invalidation.
  390. *
  391. * Returns -EBUSY if any pages could not be invalidated.
  392. */
  393. int invalidate_inode_pages2_range(struct address_space *mapping,
  394. pgoff_t start, pgoff_t end)
  395. {
  396. struct pagevec pvec;
  397. pgoff_t index;
  398. int i;
  399. int ret = 0;
  400. int ret2 = 0;
  401. int did_range_unmap = 0;
  402. cleancache_invalidate_inode(mapping);
  403. pagevec_init(&pvec, 0);
  404. index = start;
  405. while (index <= end && pagevec_lookup(&pvec, mapping, index,
  406. min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
  407. mem_cgroup_uncharge_start();
  408. for (i = 0; i < pagevec_count(&pvec); i++) {
  409. struct page *page = pvec.pages[i];
  410. /* We rely upon deletion not changing page->index */
  411. index = page->index;
  412. if (index > end)
  413. break;
  414. lock_page(page);
  415. WARN_ON(page->index != index);
  416. if (page->mapping != mapping) {
  417. unlock_page(page);
  418. continue;
  419. }
  420. wait_on_page_writeback(page);
  421. if (page_mapped(page)) {
  422. if (!did_range_unmap) {
  423. /*
  424. * Zap the rest of the file in one hit.
  425. */
  426. unmap_mapping_range(mapping,
  427. (loff_t)index << PAGE_CACHE_SHIFT,
  428. (loff_t)(1 + end - index)
  429. << PAGE_CACHE_SHIFT,
  430. 0);
  431. did_range_unmap = 1;
  432. } else {
  433. /*
  434. * Just zap this page
  435. */
  436. unmap_mapping_range(mapping,
  437. (loff_t)index << PAGE_CACHE_SHIFT,
  438. PAGE_CACHE_SIZE, 0);
  439. }
  440. }
  441. BUG_ON(page_mapped(page));
  442. ret2 = do_launder_page(mapping, page);
  443. if (ret2 == 0) {
  444. if (!invalidate_complete_page2(mapping, page))
  445. ret2 = -EBUSY;
  446. }
  447. if (ret2 < 0)
  448. ret = ret2;
  449. unlock_page(page);
  450. }
  451. pagevec_release(&pvec);
  452. mem_cgroup_uncharge_end();
  453. cond_resched();
  454. index++;
  455. }
  456. cleancache_invalidate_inode(mapping);
  457. return ret;
  458. }
  459. EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range);
  460. /**
  461. * invalidate_inode_pages2 - remove all pages from an address_space
  462. * @mapping: the address_space
  463. *
  464. * Any pages which are found to be mapped into pagetables are unmapped prior to
  465. * invalidation.
  466. *
  467. * Returns -EBUSY if any pages could not be invalidated.
  468. */
  469. int invalidate_inode_pages2(struct address_space *mapping)
  470. {
  471. return invalidate_inode_pages2_range(mapping, 0, -1);
  472. }
  473. EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
  474. /**
  475. * truncate_pagecache - unmap and remove pagecache that has been truncated
  476. * @inode: inode
  477. * @oldsize: old file size
  478. * @newsize: new file size
  479. *
  480. * inode's new i_size must already be written before truncate_pagecache
  481. * is called.
  482. *
  483. * This function should typically be called before the filesystem
  484. * releases resources associated with the freed range (eg. deallocates
  485. * blocks). This way, pagecache will always stay logically coherent
  486. * with on-disk format, and the filesystem would not have to deal with
  487. * situations such as writepage being called for a page that has already
  488. * had its underlying blocks deallocated.
  489. */
  490. void truncate_pagecache(struct inode *inode, loff_t oldsize, loff_t newsize)
  491. {
  492. struct address_space *mapping = inode->i_mapping;
  493. loff_t holebegin = round_up(newsize, PAGE_SIZE);
  494. /*
  495. * unmap_mapping_range is called twice, first simply for
  496. * efficiency so that truncate_inode_pages does fewer
  497. * single-page unmaps. However after this first call, and
  498. * before truncate_inode_pages finishes, it is possible for
  499. * private pages to be COWed, which remain after
  500. * truncate_inode_pages finishes, hence the second
  501. * unmap_mapping_range call must be made for correctness.
  502. */
  503. unmap_mapping_range(mapping, holebegin, 0, 1);
  504. truncate_inode_pages(mapping, newsize);
  505. unmap_mapping_range(mapping, holebegin, 0, 1);
  506. }
  507. EXPORT_SYMBOL(truncate_pagecache);
  508. /**
  509. * truncate_setsize - update inode and pagecache for a new file size
  510. * @inode: inode
  511. * @newsize: new file size
  512. *
  513. * truncate_setsize updates i_size and performs pagecache truncation (if
  514. * necessary) to @newsize. It will be typically be called from the filesystem's
  515. * setattr function when ATTR_SIZE is passed in.
  516. *
  517. * Must be called with inode_mutex held and before all filesystem specific
  518. * block truncation has been performed.
  519. */
  520. void truncate_setsize(struct inode *inode, loff_t newsize)
  521. {
  522. loff_t oldsize;
  523. oldsize = inode->i_size;
  524. i_size_write(inode, newsize);
  525. truncate_pagecache(inode, oldsize, newsize);
  526. }
  527. EXPORT_SYMBOL(truncate_setsize);
  528. /**
  529. * vmtruncate - unmap mappings "freed" by truncate() syscall
  530. * @inode: inode of the file used
  531. * @newsize: file offset to start truncating
  532. *
  533. * This function is deprecated and truncate_setsize or truncate_pagecache
  534. * should be used instead, together with filesystem specific block truncation.
  535. */
  536. int vmtruncate(struct inode *inode, loff_t newsize)
  537. {
  538. int error;
  539. error = inode_newsize_ok(inode, newsize);
  540. if (error)
  541. return error;
  542. truncate_setsize(inode, newsize);
  543. if (inode->i_op->truncate)
  544. inode->i_op->truncate(inode);
  545. return 0;
  546. }
  547. EXPORT_SYMBOL(vmtruncate);
  548. /**
  549. * truncate_pagecache_range - unmap and remove pagecache that is hole-punched
  550. * @inode: inode
  551. * @lstart: offset of beginning of hole
  552. * @lend: offset of last byte of hole
  553. *
  554. * This function should typically be called before the filesystem
  555. * releases resources associated with the freed range (eg. deallocates
  556. * blocks). This way, pagecache will always stay logically coherent
  557. * with on-disk format, and the filesystem would not have to deal with
  558. * situations such as writepage being called for a page that has already
  559. * had its underlying blocks deallocated.
  560. */
  561. void truncate_pagecache_range(struct inode *inode, loff_t lstart, loff_t lend)
  562. {
  563. struct address_space *mapping = inode->i_mapping;
  564. loff_t unmap_start = round_up(lstart, PAGE_SIZE);
  565. loff_t unmap_end = round_down(1 + lend, PAGE_SIZE) - 1;
  566. /*
  567. * This rounding is currently just for example: unmap_mapping_range
  568. * expands its hole outwards, whereas we want it to contract the hole
  569. * inwards. However, existing callers of truncate_pagecache_range are
  570. * doing their own page rounding first; and truncate_inode_pages_range
  571. * currently BUGs if lend is not pagealigned-1 (it handles partial
  572. * page at start of hole, but not partial page at end of hole). Note
  573. * unmap_mapping_range allows holelen 0 for all, and we allow lend -1.
  574. */
  575. /*
  576. * Unlike in truncate_pagecache, unmap_mapping_range is called only
  577. * once (before truncating pagecache), and without "even_cows" flag:
  578. * hole-punching should not remove private COWed pages from the hole.
  579. */
  580. if ((u64)unmap_end > (u64)unmap_start)
  581. unmap_mapping_range(mapping, unmap_start,
  582. 1 + unmap_end - unmap_start, 0);
  583. truncate_inode_pages_range(mapping, lstart, lend);
  584. }
  585. EXPORT_SYMBOL(truncate_pagecache_range);