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

Rob Landley
2003-12-12T13:39:28Z

On Friday 12 December 2003 06:55, Jörn Engel wrote:
> On Thu, 11 December 2003 14:32:12 -0600, Rob Landley wrote:
> > On Thursday 11 December 2003 13:48, Jörn Engel wrote:
> > > 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?)
>
> Yes, the obvious and stupid implementation has a ton of problems.
> Most likely the right approach is some sort of background deamon
> (garbage collector, defragmenter, journald, whatever you may call it)
> that does exacly this even after the fact for the last unchecked
> writes. Asyncronous under load, possibly even synchronous when almost
> idle.

Actually, I'd planned on implementing a cron job that could do it. We're
talking a dozen lines of Python code (which can be optimized to only look at
files with timestamps since the last time it ran). And doesn't need anything
from the kernel but the syscall...

Rob