int mpage_readpages(struct address_space *mapping, struct list_head *pages,
unsigned nr_pages, get_block_t get_block)
{
for (page_idx = 0; page_idx < nr_pages; page_idx++){
struct page *page = list_entry(pages->prev, struct page, lru);
bio = do_mpage_readpage(bio, page,
nr_pages - page_idx,
&last_block_in_bio, &map_bh,
&first_logical_block,
get_block);
=>static struct bio *
do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
sector_t *last_block_in_bio, struct buffer_head *map_bh,
unsigned long *first_logical_block, get_block_t get_block)
{
if (bio && (*last_block_in_bio != blocks[0] - 1))
bio = mpage_bio_submit(READ, bio);
alloc_new:
if (bio == NULL) {
bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
min_t(int, nr_pages, bio_get_nr_vecs(bdev)),
GFP_KERNEL);
}
if (bio_add_page(bio, page, length, 0) < length) {
bio = mpage_bio_submit(READ, bio);
goto alloc_new;
}
}
}
if (bio)
mpage_bio_submit(READ, bio);
return 0;
}
bio与bio_vec
https://blog.csdn.net/zhufengtianya/article/details/42145985
宋宝华: 文件读写(BIO)波澜壮阔的一生
https://blog.csdn.net/juS3Ve/article/details/79890688