page flow in IO flow
1. page add to bio
int f2fs_submit_page_bio(struct f2fs_io_info *fio) /* Allocate a new bio */ bio = __bio_alloc(fio, 1); if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) { bio_put(bio); return -EFAULT; } __submit_bio(fio->sbi, bio, fio->type);
2. blo map to scatterlist(sg)
blk_rq_map_sg
blk_rq_map_sg+0x0/0x544 mmc_blk_data_prep+0x220/0x2c8 mmc_blk_rw_rq_prep+0x50/0x16c mmc_blk_mq_issue_rq+0x238/0xd88 mmc_mq_queue_rq+0x1fc/0x26c blk_mq_dispatch_rq_list+0x154/0x4ec blk_mq_do_dispatch_sched+0x64/0x1e8 blk_mq_sched_dispatch_requests+0x12c/0x1b0 __blk_mq_run_hw_queue+0xe4/0x11c blk_mq_run_work_fn+0x18/0x20
这里的scatterlist应该是在init的时候alloc的(而不需要runtime处理request时再不断地去alloc),mmc_mq_init_request里根据hostg的max_segs调用mmc_alloc_sg分配scatterlist数组,数组大小是host driver里定义的max_segs,分配的scatterlist数组指针保存到mmc_queue_req.sg,调用mmc_alloc_sg的callstack:
[ 0.274469] dump_stack+0xac/0x104 [ 0.274472] mmc_mq_init_request+0x44/0x84 [ 0.274475] blk_mq_alloc_rqs+0x1ac/0x238 [ 0.274478] blk_mq_alloc_tag_set+0x1b0/0x370 [ 0.274480] mmc_init_queue+0xf0/0x354 [ 0.274483] mmc_blk_alloc_req+0xdc/0x2bc [ 0.274485] mmc_blk_probe+0x418/0x66c [ 0.274488] mmc_bus_probe+0x34/0x64 [ 0.274491] really_probe+0x244/0x640 [ 0.274494] driver_probe_device+0x60/0xf8 [ 0.274497] __device_attach_driver+0x128/0x164 [ 0.274499] bus_for_each_drv+0x98/0x108 [ 0.274502] __device_attach.llvm.6744517518758298417+0xb4/0x14c [ 0.274505] bus_probe_device+0x38/0xd4 [ 0.274507] device_add+0x910/0xb38 [ 0.274509] mmc_add_card+0x210/0x230 [ 0.274512] mmc_attach_mmc+0xc4/0x16c [ 0.274514] mmc_rescan+0x2e0/0x41c [ 0.274516] process_one_work+0x208/0x558 [ 0.274519] worker_thread+0x27c/0x504 [ 0.274523] kthread+0x14c/0x184 [ 0.274525] ret_from_fork+0x10/0x18
3. dma_map_sg,get dma_address