From owner-freebsd-bugs@FreeBSD.ORG Thu Nov 15 11:40:03 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 865F216A41A for ; Thu, 15 Nov 2007 11:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 63D6713C46A for ; Thu, 15 Nov 2007 11:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id lAFBe2AR014728 for ; Thu, 15 Nov 2007 11:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id lAFBe2aS014727; Thu, 15 Nov 2007 11:40:02 GMT (envelope-from gnats) Resent-Date: Thu, 15 Nov 2007 11:40:02 GMT Resent-Message-Id: <200711151140.lAFBe2aS014727@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 [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AD1716A419 for ; Thu, 15 Nov 2007 11:34:03 +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 AE16013C461 for ; Thu, 15 Nov 2007 11:34:02 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from mail3.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.6/8.12.6) with ESMTP id lAFACvLD029998 for ; Thu, 15 Nov 2007 11:12:58 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail3.siemens.de (8.12.6/8.12.6) with ESMTP id lAFACvaU021779 for ; Thu, 15 Nov 2007 11:12:57 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.2/8.14.2) id lAFACvQS068268 for FreeBSD-gnats-submit@freebsd.org; Thu, 15 Nov 2007 11:12:57 +0100 (CET) Message-Id: <200711151012.lAFACvbr024366@curry.mchp.siemens.de> Date: Thu, 15 Nov 2007 11:12:57 +0100 (CET) From: Andre Albsmeier To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/118069: [PATCH] camcontrol should be able to leave device specific data alone when editing mode pages 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, 15 Nov 2007 11:40:03 -0000 >Number: 118069 >Category: bin >Synopsis: [PATCH] camcontrol should be able to leave device specific data alone when editing mode pages >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 15 11:40:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Andre Albsmeier >Release: FreeBSD 6.2-STABLE i386 >Organization: >Environment: System: FreeBSD 6.2-STABLE #0: Wed Oct 31 16:26:40 CET 2007 with a Quantum SDLT drive attached. >Description: On SDLT drives bits 4-6 of byte 2 of the Mode Parameter Header define the so called "Buffered Mode". From the SCSI spec of a SDLT drive: Buffered Mode. Set to 1 by default. The drive implements immediate reporting on WRITE commands through its buffered mode. With Buffered Mode set to 1, the drive reports GOOD status on WRITE commands as soon as the data block has been transferred to the buffer. If this field is set to 0, the drive does not report GOOD status on WRITE commands until it writes the data blocks to tape. When Buffered Mode is not used, the drive suffers significant performance and capacity degradation. When using camcontrol to edit mode pages it gets the current values with MODE SENSE, modifies the data, and writes them back with MODE SELECT. However, the device specific data always gets cleared before performing MODE SELECT. For SDLT drives this results in disabling the Buffered Mode which leads to serious performance issues (in my case write speed dropped from 20MB/sec to 20kB/sec). >How-To-Repeat: Take a SLDT drive (sa0 in our case), insert a tape and wait for the unit to become ready. Run camcontrol cmd sa0 -v -t 3 -c "1a 8 f 0 3 0" -i 3 "*i2 *b1 b3 *b4" and check the result. If it is != 0, Buffered Mode is enabled (the default). Write data to the tape and observe the write speed using iostat. Do something like: echo "Data Compression Enabled: 0" | camcontrol modepage sa0 -m 15 -P 0 -e echo "Data Compression Enabled: 1" | camcontrol modepage sa0 -m 15 -P 0 -e Run camcontrol cmd sa0 -v -t 3 -c "1a 8 f 0 3 0" -i 3 "*i2 *b1 b3 *b4" and check the result. Now it should be 0 which means Buffered Mode has been disabled. Write data to the tape and observe the write speed using iostat. >Fix: We can simply leave the device specific data alone after running MODE SENSE and before MODE SELECT: --- sbin/camcontrol/modeedit.c.ORI 2006-04-12 09:03:39.000000000 +0200 +++ sbin/camcontrol/modeedit.c 2007-11-15 10:33:43.000000000 +0100 @@ -592,7 +592,9 @@ /* Recalculate headers & offsets. */ mh->blk_desc_len = 0; /* No block descriptors. */ +#if 0 mh->dev_spec = 0; /* Clear device-specific parameters. */ +#endif mph = MODE_PAGE_HEADER(mh); mode_pars = MODE_PAGE_DATA(mph); This way, the same data gets written as it has been retrieved with MODE SENSE. If this must not be done unconditionally a command line option might help. >Release-Note: >Audit-Trail: >Unformatted: