From owner-svn-src-all@FreeBSD.ORG Sat Jul 12 02:28:11 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0C7BBCB; Sat, 12 Jul 2014 02:28:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1042217C; Sat, 12 Jul 2014 02:28:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6C2SBQN029207; Sat, 12 Jul 2014 02:28:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6C2SBfj029206; Sat, 12 Jul 2014 02:28:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407120228.s6C2SBfj029206@svn.freebsd.org> From: Alexander Motin Date: Sat, 12 Jul 2014 02:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268552 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jul 2014 02:28:12 -0000 Author: mav Date: Sat Jul 12 02:28:11 2014 New Revision: 268552 URL: http://svnweb.freebsd.org/changeset/base/268552 Log: MFC r267933: Simplify statistics calculation. Instead of trying to guess size of disk I/O operations (it just won't work that way for newly added commands, and is equal to data move size for old ones), account data move traffic. If disk I/Os are that interesting, then backends have to account and provide that information. Block backend already exports the information about disk I/Os via devstat, so having it here too is excessive. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Sat Jul 12 02:26:11 2014 (r268551) +++ stable/10/sys/cam/ctl/ctl.c Sat Jul 12 02:28:11 2014 (r268552) @@ -13127,132 +13127,34 @@ ctl_process_done(union ctl_io *io, int h * * XXX KDM should we also track I/O latency? */ - if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { - uint32_t blocksize; + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && + io->io_hdr.io_type == CTL_IO_SCSI) { #ifdef CTL_TIME_IO struct bintime cur_bt; #endif + int type; - if ((lun->be_lun != NULL) - && (lun->be_lun->blocksize != 0)) - blocksize = lun->be_lun->blocksize; + if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == + CTL_FLAG_DATA_IN) + type = CTL_STATS_READ; + else if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == + CTL_FLAG_DATA_OUT) + type = CTL_STATS_WRITE; else - blocksize = 512; - - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: { - int isread; - struct ctl_lba_len_flags *lbalen; - - isread = 0; - switch (io->scsiio.cdb[0]) { - case READ_6: - case READ_10: - case READ_12: - case READ_16: - isread = 1; - /* FALLTHROUGH */ - case WRITE_6: - case WRITE_10: - case WRITE_12: - case WRITE_16: - case WRITE_VERIFY_10: - case WRITE_VERIFY_12: - case WRITE_VERIFY_16: - lbalen = (struct ctl_lba_len_flags *) - &io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; - - if (isread) { - lun->stats.ports[targ_port].bytes[CTL_STATS_READ] += - lbalen->len * blocksize; - lun->stats.ports[targ_port].operations[CTL_STATS_READ]++; - -#ifdef CTL_TIME_IO - bintime_add( - &lun->stats.ports[targ_port].dma_time[CTL_STATS_READ], - &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[CTL_STATS_READ] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); - bintime_sub(&cur_bt, - &io->io_hdr.start_bt); - - bintime_add( - &lun->stats.ports[targ_port].time[CTL_STATS_READ], - &cur_bt); - -#if 0 - cs_prof_gettime(&cur_ticks); - lun->stats.time[CTL_STATS_READ] += - cur_ticks - - io->io_hdr.start_ticks; -#endif -#if 0 - lun->stats.time[CTL_STATS_READ] += - jiffies - io->io_hdr.start_time; -#endif -#endif /* CTL_TIME_IO */ - } else { - lun->stats.ports[targ_port].bytes[CTL_STATS_WRITE] += - lbalen->len * blocksize; - lun->stats.ports[targ_port].operations[ - CTL_STATS_WRITE]++; - -#ifdef CTL_TIME_IO - bintime_add( - &lun->stats.ports[targ_port].dma_time[CTL_STATS_WRITE], - &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[CTL_STATS_WRITE] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); - bintime_sub(&cur_bt, - &io->io_hdr.start_bt); - - bintime_add( - &lun->stats.ports[targ_port].time[CTL_STATS_WRITE], - &cur_bt); -#if 0 - cs_prof_gettime(&cur_ticks); - lun->stats.ports[targ_port].time[CTL_STATS_WRITE] += - cur_ticks - - io->io_hdr.start_ticks; - lun->stats.ports[targ_port].time[CTL_STATS_WRITE] += - jiffies - io->io_hdr.start_time; -#endif -#endif /* CTL_TIME_IO */ - } - break; - default: - lun->stats.ports[targ_port].operations[CTL_STATS_NO_IO]++; + type = CTL_STATS_NO_IO; + lun->stats.ports[targ_port].bytes[type] += + io->scsiio.kern_total_len; + lun->stats.ports[targ_port].operations[type]++; #ifdef CTL_TIME_IO - bintime_add( - &lun->stats.ports[targ_port].dma_time[CTL_STATS_NO_IO], - &io->io_hdr.dma_bt); - lun->stats.ports[targ_port].num_dmas[CTL_STATS_NO_IO] += - io->io_hdr.num_dmas; - getbintime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - - bintime_add(&lun->stats.ports[targ_port].time[CTL_STATS_NO_IO], - &cur_bt); - -#if 0 - cs_prof_gettime(&cur_ticks); - lun->stats.ports[targ_port].time[CTL_STATS_NO_IO] += - cur_ticks - - io->io_hdr.start_ticks; - lun->stats.ports[targ_port].time[CTL_STATS_NO_IO] += - jiffies - io->io_hdr.start_time; + 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); + bintime_sub(&cur_bt, &io->io_hdr.start_bt); + bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); #endif -#endif /* CTL_TIME_IO */ - break; - } - break; - } - default: - break; - } } TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links);