From nobody Wed Aug 06 15:58:09 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 4bxw1s17KRz63tf2 for ; Wed, 06 Aug 2025 15:58:25 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bxw1r0tjJz3Hf7; Wed, 06 Aug 2025 15:58:24 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-6153a19dddfso49778a12.1; Wed, 06 Aug 2025 08:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754495901; x=1755100701; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=obRV6xsQSulSOH7tsr1FTHowAS4cV2auN8U67wQGz64=; b=jjyTO73sTbJCep2tqPCyEi8yJl1XCBWTrGoHpS9GVyR0jYib9uqx+fR1YHKhT/1e9T z6/+37YpprDHoZet9+/kE0Q86PoJpT9e9rLZBd7Oq8gizYFxZ52uNJRXuR7bymBxbfOG aF/+tiHFgdrbDyWZMLIjwoqBOxR+elrPJVd4qcVfrnccAuFQv5uAWnFeBJTbVhli63p9 gj7Tt11umVj3D8MNgOMr2/nGGtLV/YSTfg84D2qBWyN3yk/fth00aaWg1Zq9vCGbwgDI clDZNS3nJPbh41Wdks15QedMjKNiBSraPi6NEye4kDfIPwgLexAtFsfK/NOcqoOBJoX4 3OOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754495901; x=1755100701; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=obRV6xsQSulSOH7tsr1FTHowAS4cV2auN8U67wQGz64=; b=GNJopIGWkrjGOJ0gHqoMjCmu2wj2ikwViGOaZxSbXGHdsUtSFtF0jMCamWKTMVSHTo Zj2BkbTHxOisGeAEWNlSy1ZmxpGhR7LoeFfOKdNu1IK5QaNx0hwOSl1w07xvZdSdedRm PqcApJvpN4beTGBBSgV0KxXwV7/Mx/rTDDyrarnPcH32ObOHmECMJ0z953ha2LOxkYwE Ckk4WLKkN6gF/emQwP4nNfAamM6KST/aN6J0k8jtom+jYt8LxZopVj5PkiawOLCkbV2g 0l/4aiKseyXfjVHIdL6wSdKRkp03Y5bSOscKrV4diB8mpoNPiiq0fSin8U7kJhmz6EPy kIQQ== X-Gm-Message-State: AOJu0YyomxTU6VS/NLgIG2P1SouF9x+tUf0OZA/frIYMYQvWK+127IcG dvPC2dupcz0baUZRypVxcxUBnoADc+kGM/7PfodoWfitlOLl35ng3bNg3BMIkgE/nFeqx6P3Ws2 ZuldQkaPGgCppFezXoDgmVJXsI0kOGrim X-Gm-Gg: ASbGncsEoZm60qVPwEFfMl/KTh1Ep81D3ydJKBJ9+/zFbuEdSh5zxsXl9696gMmzSuc tz+75QLxVGMIyzCbxY2jV3EZRfQwpArpMdq74hxpaMa8V7UizGbbps/KD8KuzJ76kKQ4ALT6qD+ CUmebqih81ACkp4QORWf4XLDwnwrJRDOA87xUjGFxInWZZLp7ToQ7IG9KrV6zf3Ij4Na1ICOw+Z T+oaZmNDnK3pXCOi+t67uohFe4PerH5x8brKyQ= X-Google-Smtp-Source: AGHT+IFzNY0CclbqkqNhf80paMysvschaXPsUieAKy8Tz3ru8SpO1TF/K4GSmIecPh1YLOp6u8NPCMPuO/0g5PZ8TN0= X-Received: by 2002:a05:6402:13c2:b0:608:50ab:7e38 with SMTP id 4fb4d7f45d1cf-617960daf3fmr3169474a12.14.1754495900570; Wed, 06 Aug 2025 08:58:20 -0700 (PDT) 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 References: <86bjos5tsh.fsf@ltc.des.dev> In-Reply-To: <86bjos5tsh.fsf@ltc.des.dev> From: Rick Macklem Date: Wed, 6 Aug 2025 08:58:09 -0700 X-Gm-Features: Ac12FXzC4k1lWGoZaOMns2qJqDcaGeCz1IE2jheEVqSZFmn5yXz3ufSWoaN6S-s Message-ID: Subject: Re: RFC: Does ZFS block cloning do this? To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: FreeBSD CURRENT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4bxw1r0tjJz3Hf7 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] On Wed, Aug 6, 2025 at 8:55=E2=80=AFAM Dag-Erling Sm=C3=B8rgrav wrote: > > 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 prov= ide > 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. Yes, as I just posted, I think a flag should be sufficient. > > 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. For the CLONE case (indicated by the flag) it would need to run to completi= on. (It can only be allowed if that is guaranteed to not take more than 1-2sec. That is why NFSv4.2 has a separate CLONE operation.) rick > > DES > -- > Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org