1TRUNCATE_INODE_PAGES(9) Memory Management in Linux TRUNCATE_INODE_PAGES(9)
2
3
4
6 truncate_inode_pages_range - truncate range of pages specified by start
7 & end byte offsets
8
10 void truncate_inode_pages_range(struct address_space * mapping,
11 loff_t lstart, loff_t lend);
12
14 mapping
15 mapping to truncate
16
17 lstart
18 offset from which to truncate
19
20 lend
21 offset to which to truncate (inclusive)
22
24 Truncate the page cache, removing the pages that are between specified
25 offsets (and zeroing out partial pages if lstart or lend + 1 is not
26 page aligned).
27
28 Truncate takes two passes - the first pass is nonblocking. It will not
29 block on page locks and it will not block on writeback. The second pass
30 will wait. This is to prevent as much IO as possible in the affected
31 region. The first pass will remove most pages, so the search cost of
32 the second pass is low.
33
34 We pass down the cache-hot hint to the page freeing code. Even if the
35 mapping is large, it is probably the case that the final pages are the
36 most recently touched, and freeing happens in ascending file offset
37 order.
38
39 Note that since ->invalidatepage accepts range to invalidate
40 truncate_inode_pages_range is able to handle cases where lend + 1 is
41 not
42
44Kernel Hackers Manual 3.10 June 2019 TRUNCATE_INODE_PAGES(9)