From 06a6d5a7e3b17cc5d5954391a0381bd879162cd9 Mon Sep 17 00:00:00 2001 From: mav Date: Mon, 5 Oct 2015 11:01:18 +0000 Subject: MFC r288215: Switch I/O time accounting from system time to uptime. While there, make num_dmas accounted independently of CTL_TIME_IO. --- sys/cam/ctl/ctl.c | 20 ++++++++++---------- sys/cam/ctl/ctl_backend_block.c | 20 ++++++++++---------- sys/cam/ctl/ctl_backend_ramdisk.c | 6 +++--- sys/cam/ctl/ctl_io.h | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index fed9910..7e20fce 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -1329,7 +1329,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) io->scsiio.tag_type = msg->scsi.tag_type; #ifdef CTL_TIME_IO io->io_hdr.start_time = time_uptime; - getbintime(&io->io_hdr.start_bt); + getbinuptime(&io->io_hdr.start_bt); #endif /* CTL_TIME_IO */ io->scsiio.cdb_len = msg->scsi.cdb_len; memcpy(io->scsiio.cdb, msg->scsi.cdb, @@ -1368,7 +1368,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) if (msg->dt.sg_sequence == 0) { #ifdef CTL_TIME_IO - getbintime(&io->io_hdr.dma_start_bt); + getbinuptime(&io->io_hdr.dma_start_bt); #endif i = msg->dt.kern_sg_entries + msg->dt.kern_data_len / @@ -1518,7 +1518,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) taskio->tag_type = msg->task.tag_type; #ifdef CTL_TIME_IO taskio->io_hdr.start_time = time_uptime; - getbintime(&taskio->io_hdr.start_bt); + getbinuptime(&taskio->io_hdr.start_bt); #endif /* CTL_TIME_IO */ ctl_run_task((union ctl_io *)taskio); break; @@ -2777,7 +2777,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, __func__, ooa_hdr->fill_len); } - getbintime(&ooa_hdr->cur_bt); + getbinuptime(&ooa_hdr->cur_bt); if (cur_fill_num > ooa_hdr->alloc_num) { ooa_hdr->dropped_num = cur_fill_num -ooa_hdr->alloc_num; @@ -12656,11 +12656,11 @@ ctl_send_datamove_done(union ctl_io *io, int have_lock) msg.scsi.sense_len, M_WAITOK); #ifdef CTL_TIME_IO - getbintime(&cur_bt); + getbinuptime(&cur_bt); bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); bintime_add(&io->io_hdr.dma_bt, &cur_bt); - io->io_hdr.num_dmas++; #endif + io->io_hdr.num_dmas++; } /* @@ -13169,12 +13169,12 @@ ctl_process_done(union ctl_io *io) #ifdef CTL_TIME_IO bintime_add(&lun->stats.ports[targ_port].dma_time[type], &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[type] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); + getbinuptime(&cur_bt); bintime_sub(&cur_bt, &io->io_hdr.start_bt); bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); #endif + lun->stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; } /* @@ -13319,7 +13319,7 @@ ctl_queue(union ctl_io *io) #ifdef CTL_TIME_IO io->io_hdr.start_time = time_uptime; - getbintime(&io->io_hdr.start_bt); + getbinuptime(&io->io_hdr.start_bt); #endif /* CTL_TIME_IO */ /* Map FE-specific LUN ID into global one. */ diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 29009a9..5985993 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -408,11 +408,11 @@ ctl_be_block_move_done(union ctl_io *io) DPRINTF("entered\n"); #ifdef CTL_TIME_IO - getbintime(&cur_bt); + getbinuptime(&cur_bt); bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); bintime_add(&io->io_hdr.dma_bt, &cur_bt); +#endif io->io_hdr.num_dmas++; -#endif io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; /* @@ -566,8 +566,8 @@ ctl_be_block_biodone(struct bio *bio) ctl_serseq_done(io); } #ifdef CTL_TIME_IO - getbintime(&io->io_hdr.dma_start_bt); -#endif + getbinuptime(&io->io_hdr.dma_start_bt); +#endif ctl_datamove(io); } } @@ -788,8 +788,8 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, ctl_serseq_done(io); } #ifdef CTL_TIME_IO - getbintime(&io->io_hdr.dma_start_bt); -#endif + getbinuptime(&io->io_hdr.dma_start_bt); +#endif ctl_datamove(io); } } @@ -959,8 +959,8 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, ctl_serseq_done(io); } #ifdef CTL_TIME_IO - getbintime(&io->io_hdr.dma_start_bt); -#endif + getbinuptime(&io->io_hdr.dma_start_bt); +#endif ctl_datamove(io); } } @@ -1666,8 +1666,8 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, } else { SDT_PROBE(cbb, kernel, write, alloc_done, 0, 0, 0, 0, 0); #ifdef CTL_TIME_IO - getbintime(&io->io_hdr.dma_start_bt); -#endif + getbinuptime(&io->io_hdr.dma_start_bt); +#endif ctl_datamove(io); } } diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 4c95d5c..e79769c 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -235,11 +235,11 @@ ctl_backend_ramdisk_move_done(union ctl_io *io) CTL_PRIV_BACKEND_LUN].ptr; be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun; #ifdef CTL_TIME_IO - getbintime(&cur_bt); + getbinuptime(&cur_bt); bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); bintime_add(&io->io_hdr.dma_bt, &cur_bt); - io->io_hdr.num_dmas++; #endif + io->io_hdr.num_dmas++; if (io->scsiio.kern_sg_entries > 0) free(io->scsiio.kern_data_ptr, M_RAMDISK); io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; @@ -339,7 +339,7 @@ ctl_backend_ramdisk_continue(union ctl_io *io) io->io_hdr.flags |= CTL_FLAG_ALLOCATED; io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer -= len_filled; #ifdef CTL_TIME_IO - getbintime(&io->io_hdr.dma_start_bt); + getbinuptime(&io->io_hdr.dma_start_bt); #endif ctl_datamove(io); } diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 17fce7e..7b3636e 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -223,8 +223,8 @@ struct ctl_io_hdr { struct bintime start_bt; /* Timer start ticks */ struct bintime dma_start_bt; /* DMA start ticks */ struct bintime dma_bt; /* DMA total ticks */ - uint32_t num_dmas; /* Number of DMAs */ #endif /* CTL_TIME_IO */ + uint32_t num_dmas; /* Number of DMAs */ union ctl_io *original_sc; union ctl_io *serializing_sc; void *pool; /* I/O pool */ -- cgit v1.1