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

"Rob Norris" <[email protected]> Mon, 13 Jul 2026 09:50:39 +1000
Newsgroups gmane.os.freebsd.devel.file-systems
Message-ID <[email protected]>
--52709327ed8fa362fc4f3236e3221a0cbe3a10ef
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Mon, 13 Jul 2026, at 5:38 AM, Rich wrote:
> Unless it changed, it's very specifically "if the block is marked as deduplicated" (that is, the block pointer has the dedup bit set), because otherwise you'd have trouble reasoning about who managed lifecycle of blocks, because BRT isn't a bit set at the time the block is written, but dedup is, so you would either need to have replaced both lifecycle management systems with one, or let the one that was in control before BRT was added remain in control of anything in it.

It has not changed, so this is exactly it. Specifically, in brt_pending_apply_vdev() when BRT refcounts are bumped, if it sees the `D` bit, it will call out to ddt_addref() instead.

From the top, this will look like a "successful" clone; we just account for it differently.

Rob.
--52709327ed8fa362fc4f3236e3221a0cbe3a10ef
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html><html><head><title></title></head><body><div>On Mon, 13 J=
ul 2026, at 5:38 AM, Rich wrote:</div><blockquote type=3D"cite" id=3D"qt=
" style=3D""><div dir=3D"ltr"><div>Unless it changed, it's very specific=
ally "if the block is marked as deduplicated" (that is, the block pointe=
r has the dedup bit set), because otherwise you'd have trouble reasoning=
 about who managed lifecycle of blocks, because BRT isn't a bit set at t=
he time the block is written, but dedup is, so you would either need to =
have replaced both lifecycle management systems with one, or let the one=
 that was in control before BRT was added remain in control of anything =
in it.</div></div></blockquote><div><br></div><div>It has not changed, s=
o this is exactly it. Specifically, in brt_pending_apply_vdev() when BRT=
 refcounts are bumped, if it sees the `D` bit, it will call out to ddt_a=
ddref() instead.</div><div><br></div><div>From the top, this will look l=
ike a "successful" clone; we just account for it differently.</div><div>=
<br></div><div>Rob.<br></div></body></html>
--52709327ed8fa362fc4f3236e3221a0cbe3a10ef--