What is needed for ZFS block cloning to work?

John F Carr <[email protected]> Sat, 11 Jul 2026 21:34:50 +0000
Newsgroups gmane.os.freebsd.devel.file-systems
Message-ID <[email protected]>
I enabled block cloning on 15.1-STABLE but copy_file_range
between two files in the same directory does not cause
bcloneused to change.  I have vfs.zfs.bclone_enabled=3D1
and feature@block_cloning=3Denabled.  Is anything more
needed?

I looked at zfs_clone_range and zfs_freebsd_copy_file_range
and saw nothing obvious that would make the copy fail.

zpool list shows ALLOC changing by an amount similar to the
size of the copied file.

John Carr


$ zpool get bcloneused data
NAME  PROPERTY    VALUE        SOURCE
data  bcloneused  0            -
$ df .
Filesystem   1K-blocks   Used     Avail Capacity  Mounted on
data/scratch 104857600 129665 104727934     0%    /data/scratch
$ truss -o /tmp/t cp IMG_6998.CR3 tmp2
$ zpool get bcloneused data
NAME  PROPERTY    VALUE        SOURCE
data  bcloneused  0            -
$ grep copy_file_range /tmp/t
copy_file_range(0x3,0x0,0x4,0x0,0x7fffffffffffffff,0x0) =3D 33289458 (0x1fb=
f4f2)
copy_file_range(0x3,0x0,0x4,0x0,0x7fffffffffffffff,0x0) =3D 0 (0x0)
$ sysctl vfs.zfs.bclone_enabled
vfs.zfs.bclone_enabled: 1
$ zpool get feature@block_cloning data
NAME  PROPERTY               VALUE                  SOURCE
data  feature@block_cloning  enabled                local

(kgdb) p zfs_bclone_enabled
$1 =3D 1