Re: Is there a "make hole" (truncate in middle) syscall?

Andy Isaacson
2003-12-11T19:58:57Z

On Thu, Dec 11, 2003 at 08:48:15PM +0100, Jörn Engel wrote:
> On Thu, 11 December 2003 11:15:28 -0800, Hua Zhong wrote:
> > Hey, I think when I get some cycles I can try to implement this for
> > tmpfs (since it's simpler) myself, and post a patch. :-) But before
> > that, I want to make sure it's doable.
>
> If you really do it, please don't add a syscall for it. Simply check
> each written page if it is completely filled with zero. (This will be
> a very quick check for most pages, as they will contain something
> nonzero in the first couple of words)

Um, no.

That is a very bad idea. Your suggestion would make it impossible to
actually write a block of all-zeros to the disk. That makes it
impossible to pre-allocate disk space.

Another syscall is precisely the correct thing to do. (I don't think
make_hole() is a special case of any extant syscall.)

-andy