if (!add_to_page_cache_lru(page, mapping, page->index, GFP_KERNEL)) { bio = do_mpage_readpage(bio, page, nr_pages - page_idx, &last_block_in_bio, &map_bh, &first_logical_block, get_block);


The pages are installed both in the page cache and in the kernel's LRU list using add_to_page_cache_lru.

When do_mpage_readpage builds the bio request, the BIO data of the preceding pages are also included so that a combined request can be constructed. If several successive pages are to be read from the block device, this can be done in a single request rather than submitting an individual request for each page. Notice that the buffer_head passed to do_mpage_readpage is usually not required. However, if an unusual situation is encountered (e.g., a page that contains buffers), then it falls back to using the old-fashioned, blockwise read routines.

If, at the end of the loop, a BIO request is left unprocessed by do_mpage_readpage, it is now submitted:

Continue reading here: Page Cache Readahead

Was this article helpful?

0 0