Author: mav
Date: Fri Sep 25 09:55:51 2015
New Revision: 288214
URL: https://svnweb.freebsd.org/changeset/base/288214

Log:
  Collect DMA statistics on secondary HA node.

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c      Fri Sep 25 09:14:29 2015        (r288213)
+++ head/sys/cam/ctl/ctl.c      Fri Sep 25 09:55:51 2015        (r288214)
@@ -1365,6 +1365,9 @@ ctl_isc_event_handler(ctl_ha_channel cha
                                io->io_hdr.status = msg->hdr.status;
 
                        if (msg->dt.sg_sequence == 0) {
+#ifdef CTL_TIME_IO
+                               getbintime(&io->io_hdr.dma_start_bt);
+#endif
                                i = msg->dt.kern_sg_entries +
                                    msg->dt.kern_data_len /
                                    CTL_HA_DATAMOVE_SEGMENT + 1;
@@ -12622,9 +12625,11 @@ static void
 ctl_send_datamove_done(union ctl_io *io, int have_lock)
 {
        union ctl_ha_msg msg;
+#ifdef CTL_TIME_IO
+       struct bintime cur_bt;
+#endif
 
        memset(&msg, 0, sizeof(msg));
-
        msg.hdr.msg_type = CTL_MSG_DATAMOVE_DONE;
        msg.hdr.original_sc = io;
        msg.hdr.serializing_sc = io->io_hdr.serializing_sc;
@@ -12640,15 +12645,20 @@ ctl_send_datamove_done(union ctl_io *io,
        msg.scsi.fetd_status = io->io_hdr.port_status;
        msg.scsi.residual = io->scsiio.residual;
        io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE;
-
        if (io->io_hdr.flags & CTL_FLAG_FAILOVER) {
                ctl_failover_io(io, /*have_lock*/ have_lock);
                return;
        }
-
        ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg,
            sizeof(msg.scsi) - sizeof(msg.scsi.sense_data) +
            msg.scsi.sense_len, M_WAITOK);
+
+#ifdef CTL_TIME_IO
+       getbintime(&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
 }
 
 /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to