From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 18 20:43:18 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A70201065676; Thu, 18 Feb 2010 20:43:18 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 648188FC15; Thu, 18 Feb 2010 20:43:18 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 8F63F1E00772; Thu, 18 Feb 2010 21:43:17 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id o1IKe0DH004616; Thu, 18 Feb 2010 21:40:00 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id o1IKe0NZ004615; Thu, 18 Feb 2010 21:40:00 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Thu, 18 Feb 2010 21:39:59 +0100 To: Juergen Lock Message-ID: <20100218203959.GA4457@triton8.kn-bremen.de> References: <20100217215940.GA19713@triton8.kn-bremen.de> <4B7CE066.4030403@freebsd.org> <20100218183459.GA65508@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100218183459.GA65508@triton8.kn-bremen.de> User-Agent: Mutt/1.5.20 (2009-06-14) X-Mailman-Approved-At: Thu, 18 Feb 2010 20:49:32 +0000 Cc: freebsd-hackers@freebsd.org, Tim Kientzle Subject: Re: "tar tfv /dev/cd0" speedup patch X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2010 20:43:18 -0000 On Thu, Feb 18, 2010 at 07:34:59PM +0100, Juergen Lock wrote: > On Wed, Feb 17, 2010 at 10:38:30PM -0800, Tim Kientzle wrote: > > Juergen Lock wrote: > > > > > > ... since bsdtar/libarchive know iso9660 I just did the command in the > > > Subject. It worked, but it was sloow... :( Apparently it read all of > > > the disc without seeking. The following patch fixes this, is something > > > like this desired? If yes I could look how to do the same for Linux, > > > > Juergen, > > > > This is great! If you can figure out how to get this > > right, I would really appreciate it. If you have a > > tape drive handy, definitely test with that. My first > > attempts here actually broke reading from tape drives, > > which is why the current code is so conservative. > > > Hmm I can't test on a tape atm but if I look at the kernel, > http://fxr.watson.org/fxr/ident?i=DIOCGMEDIASIZE > DIOCGMEDIASIZE is only handled for geom, xen block devices, old CD drives > and pc98 floppies, and I'm pretty sure tapes don't use geom. :) > > > Minor style comments: > > > else if (S_ISCHR(st.st_mode) && > > > !ioctl(fd, DIOCGMEDIASIZE, &mediasize) && mediasize) { > > > > Please be explicit: S_ISCHR() && ioctl() == 0 && mediasize > 0 > > > > > archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino); > > > > extract_skip_file isn't needed here; we don't read the > > contents of device nodes. > > > > Let me know as soon as you have something you're confident of. > > Ok here is a new version of the patch with these things fixed and the > Linux case added: (Linux case not tested yet, and yes I did this on > stable/8.) Ok just tested the patch on libarchive-2.8.0.tar.gz on debian sid on /dev/sr0 (optical drive) and it worked. (Had to use the tarball from code.google.com since sid's own libarchive version still was at 2.6.something where the patch didn't apply...) Cheers, Juergen