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

Rob Landley
2003-12-11T20:32:35Z

On Thursday 11 December 2003 13:48, Jörn Engel wrote:
> On Thu, 11 December 2003 11:15:28 -0800, Hua Zhong wrote:
> > > The abstract interface for make_hole() is simple, but it turns into a
> > > pretty expensive filesystem operation, I think. After many cycles of
> > > free/allocate, your file would be badly fragmented across the
> > > filesystem.
> >
> > Understood. Two filesystems we are using: tmpfs and ext3. For the
> > former, fragmentation doesn't matter.
> >
> > 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)

Cache poisoning, streaming writes to large RAID arrays... There are about 8
zllion reasons not to do this. Really. (It defeats the whole purpose of
DMA, doesn't it?)

> Jörn

Rob