<div dir="ltr">For any copy-on-write filesystem there is no point pre-zeroing a file to 'allocate' its blocks, because any overwrite will reallocate the block. Thus, the expectation is that most copy-on-write filesystems will detect blocks which contain all-zeros and not bother to actually allocate disk space for such blocks, instead just leaving a 'hole' in the file (which reads as zeros when the file is read). (If writing all zeros into a block which was previously non-zero, Hammer simply removes the block from the B+Tree to create a hole).<div><br></div><div>In the original UFS, writing zeros would actually write blocks full of zeros into the file, but this was desireable because UFS is not a copy-on-write filesystem. So the concept of preallocating space works. UFS also always supported file holes via lseek()/write() to skip the 'hole' you want to leave, as do numerous earlier filesystems. So 'Sparse Files' is actually a very old concept.</div><div><br></div><div><div>-Matt<br><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 28, 2016 at 9:25 AM, Tomohiro Kusumi <span dir="ltr"><<a href="mailto:kusumi.tomohiro@gmail.com" target="_blank">kusumi.tomohiro@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This might be off topic as I brought this from tux3 ml archive,<br>
but what does "FS converted zerod blocks to hole like hammerfs"<br>
supposed to mean here ?<br>
<br>
Is this talking about sparse file ?<br>
(and do BSDs including DragonFly even support sparse file ?)<br>
<br>
<a href="http://phunq.net/pipermail/tux3/2015-August/002327.html" rel="noreferrer" target="_blank">http://phunq.net/pipermail/<wbr>tux3/2015-August/002327.html</a><br>
> Also, if FS converted zerod blocks to hole like hammerfs, simply ENOSPC happens.<br>
<br>
<br>
This is the result of<br>
# dd if=/dev/zero of=xxx bs=16384 count=10<br>
against a newly created fs, and there are 10 zero-filled data records,<br>
which is what I was expecting to see in fs level from the way hammer<br>
is implemented.<br>
<br>
--<br>
HAMMER zone statistics<br>
zone # blocks items used[B] used[%]<br>
zone 0 0 0 0 0<br>
zone 1 0 0 0 0<br>
zone 2 0 0 0 0<br>
zone 3 0 0 0 0<br>
zone 4 0 0 0 0<br>
zone 5 0 0 0 0<br>
zone 6 0 0 0 0<br>
zone 7 0 0 0 0<br>
zone 8 1 1 4096 0.0488281<br>
zone 9 1 4 572 0.00681877<br>
zone 10 1 10 163840 1.95312<br>
zone 11 0 0 0 0<br>
zone 12 0 0 0 0<br>
zone 13 0 0 0 0<br>
zone 14 0 0 0 0<br>
zone 15 0 0 0 0<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
total 3 15 168508 0.669591<br>
</blockquote></div><br></div>