绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
硬盘扇区的读写函数及其调用路径
2020-07-06 10:50:51


硬盘扇区的读写函数及其调用

几种情况下的调用路径

1)
8044 "pdflush" c68be034 { } | __ide_do_rw_disk | ide_do_rw_disk | start_request | ide_do_request | do_ide_request | __generic_unplug_device | __elv_add_request | __make_request | generic_make_request | submit_bio | mpage_bio_submit | __mpage_writepage | mpage_writepages | ext2_writepages | do_writepages | __sync_single_inode | __writeback_single_inode | generic_sync_sb_inodes | sync_sb_inodes | writeback_inodes | wb_kupdate | __pdflush | pdflush | kthread | kernel_thread_helper

2)
1288 "kjournald" de850034 { } | __ide_do_rw_disk | ide_do_rw_disk | start_request | ide_do_request | do_ide_request | __generic_unplug_device | generic_unplug_device | blk_backing_dev_unplug | sync_buffer | __wait_on_bit | out_of_line_wait_on_bit | __wait_on_buffer | sync_dirty_buffer | journal_write_commit_record | journal_commit_transaction | kjournald | kernel_thread_helper

3)
4409 "syslog-ng" dccf6034 { } | __ide_do_rw_disk | ide_do_rw_disk | start_request | ide_do_request | do_ide_request | __generic_unplug_device | cfq_start_queueing | cfq_crq_enqueued | cfq_enqueue | cfq_insert_request | __elv_add_request | __make_request | generic_make_request | submit_bio | submit_bh | __block_write_full_page | block_write_full_page | ext3_ordered_writepage | mpage_writepages | do_writepages | __filemap_fdatawrite_range | filemap_fdatawrite | do_fsync | sys_fsync | sysenter_past_esp

4)
448 "kblockd/0" dfe20034 { } | __ide_do_rw_disk | ide_do_rw_disk | start_request | ide_do_request | do_ide_request | cfq_kick_queue | worker_thread | kthread | kernel_thread_helper

希望对分析DISK IO的关系有一点帮助。


//in drivers/ide/ide-disk.c
/*
* __ide_do_rw_disk() issues READ and WRITE commands to a disk,
* using LBA if supported, or CHS otherwise, to address sectors.
*/

ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block)
{
ide_hwif_t *hwif = HWIF(drive);
unsigned int dma = drive->using_dma;
u8 lba48 = (drive->addressing == 1) ? 1 : 0;
task_ioreg_t command = WIN_NOP;
ata_nsector_t nsectors;

nsectors.all = (u16) rq->nr_sectors;


if (hwif->no_lba48_dma && lba48 && dma) {
if (block + rq->nr_sectors > 1ULL << 28)
dma = 0;
else
lba48 = 0;
}
......................
}


文章来源CU社区:硬盘扇区的读写函数及其调用路径

分享好友

分享这个小栈给你的朋友们,一起进步吧。

内核源码
创建时间:2020-05-18 13:36:55
内核源码精华帖内容汇总
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • 飘絮絮絮丶
    专家
戳我,来吐槽~