Subject: Re: hexdumping large sparce files
To: Bill Studenmund <wrstuden@netbsd.org>
From: Curt Sampson <cjs@cynic.net>
List: tech-kern
Date: 01/25/2003 14:47:18
On Fri, 24 Jan 2003, Bill Studenmund wrote:

> On Fri, 24 Jan 2003, David Laight wrote:
>
> > For instance I would like to be able to verify the non-zero parts of
> > the following [large] file...
> > without actually transferring 14Gb of data from kernel to user.
> > (and maybe without filling all of physical memory with 0 bytes).
>
> No. Our (and I believe POSIX) file semantics don't permit it.

What does mmap do with holes in files? I've got this weird idea that you
might be able to map all of the holes that cover complete pages to a
single physical page filled with zeros that's marked copy-on-write, so
you could read it for only the cost of the memory access. (And even that
could be dirt, dirt cheap if you happen to have a physically-addressed
cache.)

Or did I take one too many hits from the crack pipe before coming up
with this? :-)

cjs
-- 
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC