Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 1997 11:24:38 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        ssigala@globalnet.it (S Sigala)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Making holes in files with lseek()
Message-ID:  <199704031824.LAA16584@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.96.970403160625.645A-100000@lattice.latte.it> from "S Sigala" at Apr 3, 97 04:08:41 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Hello, i have just written this little program that replaces sequences
> of nul bytes with holes (using lseek()).  This seem to work, but i would
> like to know the ideal length of the nul bytes sequence where a hole is
> better (requires less space on disk) than the sequence.
> In other words, how much disk space is wasted by a hole?  Does every
> lseek() call (a seek below the end of the file) create a hole?
> 
> Thanks in advance.

This requires that there be enough space for the file and a "holified"
version of the file.

I think one could use a script containing a tar in of the source file
and a tar out of the destination file, using the "--sparse" or "-S"
argument, and achieve the same effect...


May I suggest implementing F_FREESP for fcntl(2) instead, and operating
on the existing file?  This would allow you to make an existing file
sparse by "marking" holes with F_FREESP.


					Regards,
					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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