调用df -h命令首先会执行execve,读取/bin/df文件,整个流程如下,其中涉及到了预读,页缓存及block层。
vfs read流程:
#0 submit_bio (rw=0, bio=0xf45c8880) at block/blk-core.c:1694
#1 0xc051605a in mpage_bio_submit (mapping=0xf3616840, pages=0xf59cfd6c, nr_pages=
get_block=0xc055f7c1
#2 mpage_readpages (mapping=0xf3616840, pages=0xf59cfd6c, nr_pages=
get_block=0xc055f7c1
#3 0xc055cb5b in ext4_readpages (file=
nr_pages=4) at fs/ext4/inode.c:2676
#4 0xc04b9a8a in read_pages (mapping=0xf3616840, filp=0xf455e300, offset=4, nr_to_read=4, lookahead_size=3)
at mm/readahead.c:119
#5 __do_page_cache_readahead (mapping=0xf3616840, filp=0xf455e300, offset=4, nr_to_read=4, lookahead_size=3)
at mm/readahead.c:199
#6 0xc04b9cf9 in ra_submit (ra=
#7 0xc04b9e98 in ondemand_readahead (mapping=0xf3616840, ra=0xf455e34c, filp=0xf455e300, hit_readahead_marker=false,
offset=0, req_size=1) at mm/readahead.c:486
#8 0xc04b9f58 in page_cache_sync_readahead (mapping=
offset=0, req_size=1) at mm/readahead.c:518
#9 page_cache_sync_readahead (mapping=
req_size=1) at mm/readahead.c:503
#10 0xc04b2fb6 in do_generic_file_read (iocb=0xf3616840, iov=0xf59cfefc, nr_segs=1, pos=0) at mm/filemap.c:1119
#11 generic_file_aio_read (iocb=0xf3616840, iov=0xf59cfefc, nr_segs=1, pos=0) at mm/filemap.c:1474
#12 0xc04ede8f in do_sync_read (filp=0xf455e300, buf=
at fs/read_write.c:350
#13 0xc04ee666 in vfs_read (file=0xf455e300, buf=0xf51c8b00 "", count=128, pos=0xf59cff38) at fs/read_write.c:379
#14 0xc04f25ce in kernel_read (file=
at fs/exec.c:810
#15 0xc04f26bb in prepare_binprm (bprm=0xf51c8b00) at fs/exec.c:1314
#16 0xc04f38e6 in do_execve_common (filename=0xf4507000 "/bin/df", __argv=0x8c30140, __envp=0x8c1c158, regs=0xf59cffb4)
at fs/exec.c:1522
#17 do_execve (filename=0xf4507000 "/bin/df", __argv=0x8c30140, __envp=0x8c1c158, regs=0xf59cffb4) at fs/exec.c:1586
#18 0xc0408f6a in sys_execve (name=
regs=0xf59cffb4) at arch/x86/kernel/process.c:317
结束流程,主要是设置读取到的页面的uptodate状态:
#0 mpage_end_io (bio=0xf45c8880, err=0) at fs/mpage.c:45
#1 0xc051128d in bio_endio (bio=
#2 0xc05da649 in req_bio_endio (rq=0xf51bd000, bio=0xf45c8880, nbytes=
at block/blk-core.c:176
#3 0xc05da795 in blk_update_request (req=0xf51bd000, error=0, nr_bytes=16384) at block/blk-core.c:2148
#4 0xc05dc2c0 in blk_update_bidi_request (rq=0xf51bd000, error=0, nr_bytes=
at block/blk-core.c:2249
#5 0xc05dcfb9 in blk_end_bidi_request (rq=0xf51bd000, error=0, nr_bytes=
at block/blk-core.c:2337
#6 0xc05dd006 in blk_end_request (rq=
at block/blk-core.c:2389
#7 0xc06af20a in scsi_end_request (cmd=0xf455e900, good_bytes=16384) at drivers/scsi/scsi_lib.c:554
#8 scsi_io_completion (cmd=0xf455e900, good_bytes=16384) at drivers/scsi/scsi_lib.c:826
#9 0xc06a83dc in scsi_finish_command (cmd=0xf455e900) at drivers/scsi/scsi.c:847
#10 0xc06aefad in scsi_softirq_done (rq=
#11 0xc05e0e45 in blk_done_softirq (h=