硬盘扇区的读写函数及其调用
几种情况下的调用路径
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社区:硬盘扇区的读写函数及其调用路径