[zfs-discuss] When create file with zero-filled, L0 blocks are not holes

Gregor Kopka (@zfs-discuss) zfs-discuss at kopka.net
Sat Aug 20 11:41:38 EDT 2016


IIRC this only happens in case of compression is not off.

Gregor


Am 20.08.2016 um 15:14 schrieb Neil Sun via zfs-discuss:
> Hello,
>
> As described in source code: "A block is a hole when it has either 1)
> never been written to, or 2) is zero-filled."
> However, when I create a file with all zero-filled, L0 level blocks
> are not holes.
> So how can I understand that a block is a hole with zero-filled?
>
> # zpool create vpool sdb -f -o listsnapshots=on
> # zfs create vpool/hb
> # dd if=/dev/zero of=/vpool/hb/large_file bs=128k count=10 2> /dev/null
> # zdb -ddddd vpool/hb 7 > /root/vpool_hb_zdb.txt
> # cat /root/vpool_hb_zdb.txt
>
> Dataset vpool/hb [ZPL], ID 42, cr_txg 5, 1.27M, 7 objects, rootbp
> DVA[0]=<0:14b400:200> DVA[1]=<0:7800b400:200> [L0 DMU objset]
> fletcher4 lz4 LE contiguous unique double size=800L/200P birth=6L/6P
> fill=7 cksum=87fc81735:338ddf2dd98:a17ae4e6b036:15c3db57d1dc3f
>
>     Object  lvl   iblk   dblk  dsize  lsize   %full  type
>          7    2    16K   128K  1.25M  1.25M  100.00  ZFS plain file
>                                         168   bonus  System attributes
>     dnode flags: USED_BYTES USERUSED_ACCOUNTED
>     dnode maxblkid: 9
>     path    /large_file
>     uid     0
>     gid     0
>     atime    Sat Aug 20 20:22:03 2016
>     mtime    Sat Aug 20 20:22:03 2016
>     ctime    Sat Aug 20 20:22:03 2016
>     crtime    Sat Aug 20 20:22:03 2016
>     gen    6
>     mode    100644
>     size    1310720
>     parent    4
>     links    1
>     pflags    40800000004
> Indirect blocks:
>                0 L1  0:148c00:200 4000L/200P F=10 B=6/6
>                0  L0 0:8c00:20000 20000L/20000P F=1 B=6/6
>            20000  L0 0:28c00:20000 20000L/20000P F=1 B=6/6
>            40000  L0 0:48c00:20000 20000L/20000P F=1 B=6/6
>            60000  L0 0:68c00:20000 20000L/20000P F=1 B=6/6
>            80000  L0 0:88c00:20000 20000L/20000P F=1 B=6/6
>            a0000  L0 0:a8c00:20000 20000L/20000P F=1 B=6/6
>            c0000  L0 0:c8c00:20000 20000L/20000P F=1 B=6/6
>            e0000  L0 0:e8c00:20000 20000L/20000P F=1 B=6/6
>           100000  L0 0:108c00:20000 20000L/20000P F=1 B=6/6
>           120000  L0 0:128c00:20000 20000L/20000P F=1 B=6/6
>
>         segment [0000000000000000, 0000000000140000) size 1.25M
>
>
> _______________________________________________
> zfs-discuss mailing list
> zfs-discuss at list.zfsonlinux.org
> http://list.zfsonlinux.org/cgi-bin/mailman/listinfo/zfs-discuss



More information about the zfs-discuss mailing list