1MPAGE_READPAGES(9) The Linux VFS MPAGE_READPAGES(9)
2
3
4
6 mpage_readpages - populate an address space with some pages & start
7 reads against them
8
10 int mpage_readpages(struct address_space * mapping,
11 struct list_head * pages, unsigned nr_pages,
12 get_block_t get_block);
13
15 mapping
16 the address_space
17
18 pages
19 The address of a list_head which contains the target pages. These
20 pages have their ->index populated and are otherwise uninitialised.
21 The page at pages->prev has the lowest file offset, and reads
22 should be issued in pages->prev to pages->next order.
23
24 nr_pages
25 The number of pages at *pages
26
27 get_block
28 The filesystem´s block mapper function.
29
31 This function walks the pages and the blocks within each page, building
32 and emitting large BIOs.
33
34 If anything unusual happens, such as:
35
36 - encountering a page which has buffers - encountering a page which has
37 a non-hole after a hole - encountering a page with non-contiguous
38 blocks
39
40 then this code just gives up and calls the buffer_head-based read
41 function. It does handle a page which has holes at the end - that is a
42 common case: the end-of-file on blocksize < PAGE_CACHE_SIZE setups.
43
45 There is a problem. The mpage read code assembles several pages, gets
46 all their disk mappings, and then submits them all. That´s fine, but
47 obtaining the disk mappings may require I/O. Reads of indirect blocks,
48 for example.
49
50 So an mpage read of the first 16 blocks of an ext2 file will cause I/O
51 to be
52
54 12 0 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16
55
56 because the indirect block has to be read to get the mappings of blocks
57 13,14,15,16. Obviously, this impacts performance.
58
59 So what we do it to allow the filesystem´s get_block function to set
60 BH_Boundary when it maps block 11. BH_Boundary says: mapping of the
61 block after this one will require I/O against a block which is probably
62 close to this one. So you should push what I/O you have currently
63 accumulated.
64
65 This all causes the disk requests to be issued in the correct order.
66
68Kernel Hackers Manual 2.6. June 2019 MPAGE_READPAGES(9)