我想找到那个地方并在那个请求中设置一个标志,这样我就可以在块 io 层中识别这些请求。我改变了生物结构并添加了一个额外的标志,我想为所有发送到磁盘的间接块请求设置这个标志。
1 回答
我相信您正在寻找的是对ext3_get_branch
in /fs/ext3/inode.c的调用是您正在寻找的。它读取导致数据的间接块链。
直到读取系统调用的调用跟踪如下: /fs/ext3/inode.c
ext3_get_branch
被称为ext3_get_blocks_handle
ext3_get_blocks_handle
被称为ext3_get_block
ext3_get_block
作为函数指针传递,mpage_readpage
在/fs/mpage.c中被调用ext3_readpage
/mm/filemap.c
ext3_readpage
被 mapping->a_ops->readpage(filp, page);
in调用do_generic_file_read
do_generic_file_read
被称为generic_file_aio_read
/fs/read_write.c
generic_file_aio_read
由 /fs/ext3/inode.c 中定义的ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos);`` in
do_sync_read where
filp->f_op->aio_read is the function pointer of
generic_file_aio_read`调用
do_sync_read
映射到read
的结构定义中的系统调用generic_ro_fops
。