On Tue, Dec 15, 2009 at 2:31 AM, Craig S. Bell <cb...@standard.com> wrote: > Mike, I believe that ZFS treats runs of zeros as holes in a sparse file, > rather than as regular data. So they aren't really present to be counted for > compressratio. > > http://blogs.sun.com/bonwick/entry/seek_hole_and_seek_data > http://mail.opensolaris.org/pipermail/zfs-discuss/2008-April/017565.html
But it only does so when compression is enabled, as such I would expect that compression would claim this as a win. Without it, someone may assume that they aren't getting much benefit from compression, turn it off, then run into problems down the road because sparseness that develops in files never turns into free space. Also, I would expect that: - If a file is created via a write to every block that it would be accounted for as non-sparse (regardless of compression=<on|off|...>) - If a file is sparse because the program that created the file used seek() or similar to skip past blocks, it should be accounted for as sparse (regardless of compression). - If a program overwrites a block with zeros to a file where it should not be considered sparse. In the below example, I would expect that writing 100MB of '\0' would contribute as much to compressratio as 100 MB of 'a'. Notice that a block of zeros does not turn into a sparse file with compression=off. # zfs create test/on # zfs create test/off # zfs set compression=off test/off # zfs get compression test/on test/off NAME PROPERTY VALUE SOURCE test/off compression off local test/on compression on inherited from test # mkfile 100m on/100m off/100m # ls -l o*/100m -rw------T 1 root root 104857600 Dec 15 14:27 off/100m -rw------T 1 root root 104857600 Dec 15 14:27 on/100m # du -h o*/100m 100M off/100m 0K on/100m # perl -e 'print "a" x 100000000' > on/a # perl -e 'print "a" x 100000000' > off/a # sync # ls -l */a -rw-r--r-- 1 root root 100000000 Dec 15 14:35 off/a -rw-r--r-- 1 root root 100000000 Dec 15 14:35 on/a # du -h */a 95M off/a 3.4M on/a # zfs get compressratio test/on test/off NAME PROPERTY VALUE SOURCE test/off compressratio 1.00x - test/on compressratio 28.27x - -- Mike Gerdts http://mgerdts.blogspot.com/ _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss