From nobody Wed Aug 06 15:55:26 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bxvyR5dQgz63t5l for ; Wed, 06 Aug 2025 15:55:27 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bxvyR4B1xz3FSw; Wed, 06 Aug 2025 15:55:27 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754495727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJcktqiq8gW3zffx9heO6SSK+hI/ZcUccufE4luur+I=; b=XX23rogwdU4iToHbAsNP4sbn5YoKEKNtYa1IomjIYcqwcVg/WkToqe/V7dNsuqvggWKMut Z2PtkmWD9yypDC3jGrjtIQ4NDRZiLBul8uN/N2ir5cwNuFdEMnrCb4UEH6QKzL92aXtLzt X77Wb1Jf+wKvHxdBMcW4Ki2MqzdlahmOHpRN2jFbq8b7UkNAq/s/xyERHZJuF9BzUeMQeu NmYOMHo4Rn+/N7k3I7nPX615yp/9g2OoFNRP9D10bSjHvt3mjZQGGXNviLsdrTnyBWTXDF M4uBo4eYj2GZRWs36vo4dXkhZUzLKWt2krdNcdNHj9GiRslPgesWYPx2XcVDiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754495727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJcktqiq8gW3zffx9heO6SSK+hI/ZcUccufE4luur+I=; b=TXiREw2Nyx6Njq8L1DcjQIPn7hRkzpbSU2vKvcnwpT5aR6xbNaE2snL6ITNQQeyhFuE1o1 M/DM5HR1ybpUPwifjRt6j3N8eDTBRihy6idv8H8t9zLoS33B8h3n6SYzH7gvQ4XgWnijTp JwnVsfXNPvmaaReGDnjjIzOd6EPJc72o4tUARduWLks7oE4JRHG2Qh9x7C6dfVEfhgFUuS U2oPac6U9/b9RJZGqdBwCT/ETCnEcXQsmujakQf6ykyCz/7toBL/JBvjMGBtRyCA6ui+0d dJM+FcPyvM0yO54nxv+dItps77zB/xBhdy2Bu4TCZjHHpT9CWHDrRKPc/DyN0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754495727; a=rsa-sha256; cv=none; b=EqkE/fxlb8GVdIqiSfhPUP10GnT3DAAOfs7ld5leYb2uv5E12fEqTUj/fZtW4etXXJQhp+ 8M6gTk7q+OxCQm7DHsRuJCx9QULIZdduZuNDWJC5p9DL/p1kELzA2FGM8T1KHVvId0kxHm BtjRtrDKyea2Jz7/VcZBkzZsKojbwEAHy3aPpirDQ0yqowNfbq63as2Gd77xdKJiI035LX AbEL/YVK5EnnOIHi5aD775ExlG0yurX1ifrm6qm1z/AtvaR5JDosQZ0oQmfLCo8Eyau/hY mTlcwKJ6XtY0nboW52i2SMcQEtZPOIot45tJg9vz3+AxxFPf9IeH+7d54M7l6g== Received: from ltc.des.dev (unknown [IPv6:2a01:e0a:c54:bed0:922e:16ff:fef1:acef]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: des) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bxvyR2mgWzGdd; Wed, 06 Aug 2025 15:55:27 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 2228B12643; Wed, 06 Aug 2025 17:55:26 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Rick Macklem Cc: FreeBSD CURRENT Subject: Re: RFC: Does ZFS block cloning do this? In-Reply-To: (Rick Macklem's message of "Wed, 6 Aug 2025 08:17:10 -0700") References: User-Agent: Gnus/5.13 (Gnus v5.13) Date: Wed, 06 Aug 2025 17:55:26 +0200 Message-ID: <86bjos5tsh.fsf@ltc.des.dev> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Rick Macklem writes: > NFSv4.2 has a CLONE operation. It is described as doing: > The CLONE operation is used to clone file content from a source file > specified by the SAVED_FH value into a destination file specified by > CURRENT_FH without actually copying the data, e.g., by using a > copy-on-write mechanism. > [...] > Does ZFS block cloning do this? The question you should be asking is =E2=80=9Cdoes FreeBSD currently provide something that could be used to implement this=E2=80=9D and the answer is VOP_COPY_FILE_RANGE(9). It will copy the data if the underlying filesystem does not provide a no-copy mechanism or if that mechanism can't be used (e.g. the files are in different pools), but it shouldn't be difficult to add a flag; calling VOP_COPY_FILE_RANGE() with that flag would implement intra-server CLONE, and calling it without the flag would implement intra-server COPY. Note that VOP_COPY_FILE_RANGE() does not always copy the entire file in a single operation; you will have to call it in a loop until len is zero or an error occurs. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org