On 5/18/19 2:02 PM, Sean Fagan wrote:
On May 18, 2019, at 1:47 AM, Allan Jude <[email protected]> wrote:

Writing a file of all zeros doesn't test the compression, since if compress != 
off, we check for the 'all zeros' case and write a hole, rather than actually 
allocating space.

That has not been my experience, on FreeBSD or ZoL:

root@linux-vm:/tank# stat */bigfile
   File: DS1/bigfile
   Size: 1073741824   Blocks: 1          IO Block: 131072 regular file
Device: 33h/51d       Inode: 2           Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-05-17 19:15:05.755556266 +0000
Modify: 2019-05-17 19:15:08.069527862 +0000
Change: 2019-05-17 19:15:08.069527862 +0000
  Birth: -
   File: DS2/bigfile
   Size: 1073741824   Blocks: 2097365    IO Block: 131072 regular file
Device: 34h/52d       Inode: 2           Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-05-18 18:00:37.259314881 +0000
Modify: 2019-05-18 18:00:46.794556728 +0000
Change: 2019-05-18 18:00:46.794556728 +0000
  Birth: -

(DS2 was "zfs create -o compression=off tank/DS2", and bigfile was created the 
same way on both datasets).


It looks like I expect there, DS1 uses 1 block, and DS2 uses 2 million blocks. It would be easier to see by comparing 'du file' and 'du -A file'.

If you write something else compressible, you should be able to use zdb to see 
if it ended up using lzjb or lz4.

How? :)


cat /usr/src/sys/kern/*.c /usr/src/sys/kern/*.c  > DS1/srcfile

or even write a file of all 1s instead of all 0s.

Sean.





--
Allan Jude

------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/Tcfdc8da2da71e1c0-M93b508b74b540c48194256b0
Delivery options: https://openzfs.topicbox.com/groups/developer/subscription

Reply via email to