"tar tfv /dev/cd0" speedup patch
kientzle at freebsd.org
Sun Feb 21 05:22:38 UTC 2010
Duane H. Hesser wrote:
> I have a couple of suggestions which may help you with what you are
> trying to do.
> First, though, I can confirm that Unix character special tape
> drivers since at least V7 have always ignored seeks. They happily
> return the requested offset without feeling the need to actually
> *do* anything. The FreeBSD scsi_sa driver continues this tradition.
Thank you very, very much for taking the time to write
up this information. I'm going to definitely archive
your message for future reference.
To clarify "what we are trying to do": For some time now,
libarchive format handlers have issued "skip" requests
internally for things like skipping unnecessary file bodies.
Depending on the device you're talking to, these internal
skip requests can be translated into seek operations or
can be handled by reading and discarding data.
As Juergen found when he tried to do "tar tf /dev/cd0", my
earlier code was pretty conservative: It only translated
skip requests into lseek() operations for regular files.
Juergen took a stab at improving that so that operations
on raw disk devices would use lseek().
With your information, it should be pretty easy to
translate skip requests into mtio operations on tape
drives. Libarchive's core already supports rounding
skip operations to multiples of the block size, so this
should be an easy addition.
As it happens, I'm just starting this week to look into
multi-volume support for libarchive. I'm hoping to get
that into good shape this year. Your notes on size
estimation will be quite helpful once I get further
Thanks again, and I may be in touch over the next few
months with more questions.... ;-)
More information about the freebsd-hackers