Posted Nov 28, 2010 19:06 UTC (Sun) by kolk (guest, #36699)
Parent article: Punching holes in files
Actually, there is traditional interface for both hole punching in files and releasing DASD blocks.
Standard long ago has specified that holes in sparse files are read as zeros.
Similarly, block should be freed or punched out automatically when it's overwritten with zeros, may be conditionally if it's not optimal thing to do.
There is no need for any special interfaces on any level.
And any such interface should just zero-fill underlaying storage if not supported as is, and never return its own error code.
Posted Nov 29, 2010 1:04 UTC (Mon) by nybble41 (subscriber, #55106)
[Link]
Sometimes you can't use sparse files. For example, swap files need to have all blocks allocated, even if those blocks happen to contain only zeroes. Also, a program may wish to fully allocate a file to ensure that later writes will be able to succeed without running out of disk space, which could happen if sparse blocks were overwritten with non-zero data.
So a separate interface is required after all.
Traditional interface is zero-filling
Posted Nov 29, 2010 12:17 UTC (Mon) by mfedyk (guest, #55303)
[Link]
maybe you can write ones instead if you don't want the blocks deallocated
Traditional interface is zero-filling
Posted Dec 29, 2010 15:33 UTC (Wed) by yoe (subscriber, #25743)
[Link]
That would be a horrible, horrible hack.
Traditional interface is zero-filling
Posted Jan 20, 2011 2:22 UTC (Thu) by jzbiciak (✭ supporter ✭, #5246)
[Link]
And here's hoping you never swap a page full of zeros by accident...
Traditional interface is zero-filling
Posted Jan 20, 2011 3:23 UTC (Thu) by brouhaha (subscriber, #1698)
[Link]
If I want to punch a 5GB hole in the middle of a file, I don't want to have to do 5GB of writes to make it happen.
And yes, I actually have a use for punching really big holes.
Traditional interface is zero-filling
Posted Jan 27, 2011 18:16 UTC (Thu) by mcortese (guest, #52099)
[Link]
If I want to punch a 5GB hole in the middle of a file, I don't want to have to do 5GB of writes to make it happen.
Wouldn't you need to do it anyway when you allocate that space again?
Traditional interface is zero-filling
Posted Jan 27, 2011 21:34 UTC (Thu) by brouhaha (subscriber, #1698)
[Link]
I wouldn't be punching a hole if I intended to fill it any time soon.
In any case, supposing that I did want to punch a big hole, then fill it, I wouldn't want to have to write the whole region twice.