Re: What is needed for ZFS block cloning to work?

Rick Macklem <[email protected]> Sat, 11 Jul 2026 15:00:24 -0700
Newsgroups gmane.os.freebsd.devel.file-systems
Message-ID <CAM5tNy5goFZb=GLyd8f73b9oyQOHpn=n8nf487Q0FAzi+cfifg@mail.gmail.com>
On Sat, Jul 11, 2026 at 2:35=E2=80=AFPM John F Carr <[email protected]> wrote:
>
> 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 (0x1=
fbf4f2)
> 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
On my system, this is "active", but not being a ZFS guy, I have
no idea what it takes to go from enabled->active?

rick

>
> (kgdb) p zfs_bclone_enabled
> $1 =3D 1
>
>
>