bin/118069: [PATCH] camcontrol should be able to leave device specific data alone when editing mode pages

Andre Albsmeier Andre.Albsmeier at siemens.com
Thu Nov 15 03:40:03 PST 2007


>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:


More information about the freebsd-bugs mailing list