Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Sep 1997 21:48:12 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.ORG
Subject:   Re: Tape question
Message-ID:  <19970909214812.EW16886@uriah.heep.sax.de>
In-Reply-To: <199709082106.OAA08434@usr09.primenet.com>; from Terry Lambert on Sep 8, 1997 21:06:22 %2B0000
References:  <19970908073710.TX24990@uriah.heep.sax.de> <199709082106.OAA08434@usr09.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
As Terry Lambert wrote:

> Similarly, you may *request* a 8192 byte read, and the driver may
> not accept a shorter block being returned by the device in response
> to the larger request.

Terry, again: the latter was exactly what the originator of the
question was suspecting for the FreeBSD driver.  This would IMNSHO be
broken behaviour.  My entire case was to prove that the FreeBSD driver
does *not* behave this way.  (And no, it doesn't pad garbage when
writing either.)

So in short, for variable-length recording media (*), the FreeBSD
driver does:

. Write a tape block of whatever size has been passed down to the
  write(2) syscall, with a lower limit of 1 byte (**) per tape block,
  and an upper limit of 64 KB per tape block.  The latter is mainly
  caused by known limitations of physio(9).

. Read a tape block of whatever size has been recorded onto the tape,
  provided the read(2) syscall has been requested with at least this
  size (or more).  If the tape block is shorter than the requested
  size, a short read byte count will be returned.  If the request was
  shorter than the next tape block, the read will fail, and an error
  condition will be returned (IMHO an EINVAL).  Again, the upper limit
  is 64 KB, so if your source machine could record larger tape blocks,
  you cannot read them on FreeBSD.  IRIX machines are known to be
  notorious suckers in this respect, by writing 256 KB blocks, regard-
  less of claiming to default to 10 KB blocks in their tar(1) man
  page.  (They do this in the name of performance, albeit this is
  bogus.  The block overhead is neglicible between ~ 32 KB and larger
  blocking.)

The above is believed to be compatible behaviour to other operating
systems as well.  The second part of the above hasn't been this way
all the time, IMHO it was broken up to and including FreeBSD 2.0.


(*) QIC >= 525 MB, DAT, Exb 8 mm, DLT

(**) Here's the prove that 1-byte tape blocking is possible.  (Someone
was suspecting it weren't.)

j@uriah 52% dd if=/dev/zero bs=1 count=10 of=/dev/rst0
10+0 records in
10+0 records out
10 bytes transferred in 0.107958 secs (93 bytes/sec)
j@uriah 53% dd of=/dev/zero bs=100 count=10 if=/dev/rst0
0+10 records in
0+10 records out
10 bytes transferred in 1.503833 secs (7 bytes/sec)


-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970909214812.EW16886>