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
22
24 Truncate the page cache, removing the pages that are between specified
25 offsets (and zeroing out partial page (if lstart is not page aligned)).
26
27 Truncate takes two passes - the first pass is nonblocking. It will not
28 block on page locks and it will not block on writeback. The second pass
29 will wait. This is to prevent as much IO as possible in the affected
30 region. The first pass will remove most pages, so the search cost of
31 the second pass is low.
32
33 When looking at page->index outside the page lock we need to be careful
34 to copy it into a local to avoid races (it could change at any time).
35
36 We pass down the cache-hot hint to the page freeing code. Even if the
37 mapping is large, it is probably the case that the final pages are the
38 most recently touched, and freeing happens in ascending file offset
39 order.
40
42Kernel Hackers Manual 2.6. November 2011 TRUNCATE_INODE_PAGES(9)