Subject: Re: Strange tape behavior
To: Ben Harris <bjh21@netbsd.org>
From: Paul Goyette <paul@quicky.whooppee.com>
List: current-users
Date: 10/14/2006 06:18:44
On Sat, 14 Oct 2006, Ben Harris wrote:

> I don't know much about it, but I have some idea where the confusion is.
> The write command I looked at in there has a length of 0x20.  NetBSD
> seems to be treating the device as having 1024-byte blocks, so that
> would make sense as a number of blocks to write if you're still testing
> with 32K blocks.  If something somewhere thought that blocks were 512
> bytes (which would be the correct value for older Travan formats), it
> would take that as a 16K write, which is what you're seeing.
>
> The questions remain: which block size is correct, and what is getting
> it wrong?

Thanks for the pointer, Ben.

Here's the MODE_SENSE data that results in picking 1kb blocks (based on
atapi_tape.h):

st0(viaide0:1:0): scsipi_done
st0(viaide0:1:0):  command: 
0x1a,0x8,0x2a,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0-[
24 bytes]
------------------------------
000: 17 95 12 00 2a 12 00 00 20 28 59 06 0f a0 00 00
016: 00 40 02 f3 40 00 00 00
------------------------------

2a    = ATAPI_CAPPAGE
12    = page length
00 00 = reserved
20    = supports "reverse direction"
28    = supports "ERASE formatting" and "QFA formats"
59    = supports "locking media", "break request > ctl", "compression",
         and "defaults to prevent state"
06    = supports 512b blocks, 1024b blocks <<<<<<<<<<<<<<<<
0f a0 = max speed = 4000.
00 00 = max stored defect entries
00 04 = continuous transfer limit
02 f3 = current speed = 755.
40 00 = buffer size in 512b = 16384 ---> 8MB?

It's probably pretty reasonable for scstart() to pick the larger block 
size of 1024, but I'm guessing that the drive probably requires some 
sort of positive command to select the block size;  it probably defaults 
to 512byte blocks.


----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | FA29 0E3B 35AF E8AE 6651 |  paul@whooppee.com   |
|                  | 0786 F758 55DE 53BA 7731 | pgoyette@juniper.net |
----------------------------------------------------------------------