From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 13 17:40:20 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 29D7016A409 for ; Thu, 13 Apr 2006 17:40:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C1D043D48 for ; Thu, 13 Apr 2006 17:40:18 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k3DHeIEW069193 for ; Thu, 13 Apr 2006 17:40:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k3DHeIFk069192; Thu, 13 Apr 2006 17:40:18 GMT (envelope-from gnats) Resent-Date: Thu, 13 Apr 2006 17:40:18 GMT Resent-Message-Id: <200604131740.k3DHeIFk069192@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andre Albsmeier Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 44F5616A401 for ; Thu, 13 Apr 2006 17:33:38 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 938F643D45 for ; Thu, 13 Apr 2006 17:33:36 +0000 (GMT) (envelope-from Andre.Albsmeier@siemens.com) Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.6/8.12.6) with ESMTP id k3DHXZwc025091 for ; Thu, 13 Apr 2006 19:33:35 +0200 Received: from ims.mchp.siemens.de (ims.mchp.siemens.de [139.25.31.39]) by mail1.siemens.de (8.12.6/8.12.6) with ESMTP id k3DHXZDW027131 for ; Thu, 13 Apr 2006 19:33:35 +0200 Received: from mail-ct.mchp.siemens.de (mail-ct.mchp.siemens.de [139.25.31.51]) by ims.mchp.siemens.de with ESMTP id k3DHXYJQ023350 for ; Thu, 13 Apr 2006 19:33:34 +0200 (MEST) Received: from curry.mchp.siemens.de (curry [139.25.40.130]) by mail-ct.mchp.siemens.de (8.12.11/8.12.11) with ESMTP id k3DHXYeS003912 for ; Thu, 13 Apr 2006 19:33:34 +0200 (MEST) Received: (from localhost) by curry.mchp.siemens.de (8.13.6/8.13.6) id k3DHXY99086872 for FreeBSD-gnats-submit@freebsd.org; Thu, 13 Apr 2006 19:33:34 +0200 (CEST) Message-Id: <200604131733.k3DHXYIG004744@curry.mchp.siemens.de> Date: Thu, 13 Apr 2006 19:33:34 +0200 (CEST) From: Andre Albsmeier To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/95707: PATCH: iostat's transfer rate for cdroms is wrong X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Apr 2006 17:40:20 -0000 >Number: 95707 >Category: kern >Synopsis: PATCH: iostat's transfer rate for cdroms is wrong >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Apr 13 17:40:17 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Andre Albsmeier >Release: FreeBSD 5.4-STABLE i386 >Organization: >Environment: System: FreeBSD 5.4-STABLE Tue Mar 7 21:56:34 CET 2006 >Description: The transfer rate of cdroms shown by iostat is wrong (exactly twice as big as it should be). >How-To-Repeat: Copy a big file from cd (cd0 in this case) to an idle disk (da0 in this case) on an otherwise idle system. In another window run iostat for the two devices and compare the results: andre@voyager:~>iostat -d cd0 da0 1 da0 cd0 KB/t tps MB/s KB/t tps MB/s 5.74 23 0.13 0.00 0 0.00 6.24 17 0.10 0.00 0 0.00 66.26 35 2.24 64.00 73 4.58 11.08 247 2.67 64.00 30 1.86 115.63 30 3.35 64.00 93 5.82 123.20 25 2.98 64.00 95 5.94 77.72 40 3.01 64.00 95 5.94 107.14 29 3.00 64.00 95 5.94 119.70 27 3.12 64.00 97 6.06 65.98 49 3.13 64.00 97 6.06 107.30 30 3.11 64.00 99 6.19 86.63 38 3.18 64.00 99 6.19 58.17 59 3.37 64.00 99 6.19 108.19 31 3.24 64.00 101 6.31 111.45 29 3.13 64.00 101 6.31 77.29 45 3.36 64.00 103 6.44 73.47 47 3.34 64.00 103 6.44 63.23 55 3.42 64.00 103 6.44 ... If the cd is full and the read process reaches the outer (faster) areas of the cd, the cd0 transfer rate shown climbs up to 12MB/sec. This would mean my Plextor PX-40 reads at 80x speed :-). >Fix: [Don't know if this is correct...] When reading cdroms, devstat_end_transaction_bio() is called twice at the end of each transfer. One time from g_disk_done() in geom_disk.c and another time from biofinish() in vfs_bio.c which in turn was called from cddone() in scsi_cd.c. We can avoid accounting in the second case by passing NULL to biofinish() as devstat*: --- sys/cam/scsi/scsi_cd.c.ORI Mon Nov 28 06:57:04 2005 +++ sys/cam/scsi/scsi_cd.c Thu Apr 13 16:03:49 2006 @@ -1669,7 +1669,7 @@ if (softc->flags & CD_FLAG_CHANGER) cdchangerschedule(softc); - biofinish(bp, softc->disk->d_devstat, 0); + biofinish(bp, NULL, 0); break; } case CD_CCB_PROBE: >Release-Note: >Audit-Trail: >Unformatted: