"tar tfv /dev/cd0" speedup patch
kientzle at freebsd.org
Mon Feb 22 01:16:38 UTC 2010
Could you try the current version of read_open_filename from:
You should be able to just copy it into your FreeBSD source
tree and recompile.
Duane Hesser's comments clarified for me that disk and tape
I/O do require fundamentally different strategies, so I
refactored this code to clearly break out those
strategies. This in turn allowed me to do some
straightforward I/O optimization of the disk case,
which sped up your example by about 100x. I have a 2G
DVD here on which "tar tvf /dev/acd0" took 90s originally,
takes 14s with your patch, and now takes only 0.6s.
For comparison, after mounting the disk, "find /mnt"
takes 1.6s (which drops to .1s after the cache is warmed).
It would be interesting to also compare two ways of
copying all of the files: "tar xvf /dev/acd0"
on an unmounted disk and "cp -R" on a mounted disk.
The non-disk cases are all still handled generically, but
there are now clearly-labeled holes where someone could
add optimized I/O strategies for tapes, sockets, etc.
I've even included a number of TODO comments about
what strategies I think are worth exploring, including
tricks like using MTIO ioctls on tape, mmap() for disk,
and nonblocking I/O for sockets and pipes. I expect
any one of these is around a dozen lines of code, so
should be within the reach of even fairly junior
More information about the freebsd-hackers