From nobody Wed Aug 06 15:54:14 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 4bxvxP5Hqxz63t5P for ; Wed, 06 Aug 2025 15:54:33 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 4bxvxP21fSz3DPS; Wed, 06 Aug 2025 15:54:33 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-615622ed677so42370a12.1; Wed, 06 Aug 2025 08:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754495667; x=1755100467; 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=xyP9urK3i02getSzmFXV+7tQKgIgRks/rO3CUIqXcB0=; b=P/JGjuZwTeKewDQ2Mhe8NMA8Ulx0TnPRL9irgLrqqn38aNu0esphdqGzpMVzOGjbUY SrzKRJCm4/k6g9ENBwt5YfWrW5BlXFnF87+PjIz+9DGj9PR2NafoCRwtWwftr1jqnncV i3m1V/Se6ewrrK2gx5YWLQhAvtFJkdbRItPUgpnmyq5t4hzgJTARhp5d0ffZDqrfj4yE AwQeiMV7HLZIYvOh8e7t1OVkk6gQBBf+k08fJJi9ceXuQyMIsFRC9D9nMrgrYxJMnBZw N/rRboRiuga7992yVqO7VAtChW76uG8dg11Bn9UFklMrKHnBLImOMA+oMvFiwXpyYUu9 uDyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754495667; x=1755100467; 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=xyP9urK3i02getSzmFXV+7tQKgIgRks/rO3CUIqXcB0=; b=SRcoJU0byMxHWb3a4QNB0KYf7N0BrmCDd+8QxqCEV5bG5AS84qYzfinaEiEUuiyDfW XApC1l83eZYDkBiZmOJip6t4chCCAB55Jptfx7i5+tg8hZx2jwKWjkVfQOehhfypE/EN VNccOqzhvALudhq5IUIXlbdEv6Ia73LxZZAm0vFVQquyhIh9UBfiRsxMplmSSAaSMXzR 1YrYujJLpiMIR7/Z5mEL1IBHbWj8nNlJOq4kWwH0SnYnckQwtmCQen3WQBSjvqcAXM2C H2d5VTDbpBDd4XzCrxoBXOLKjKC4MegaocKmoAaGs3lkjpg/nzfsXeKx2+RZwhDHfNb7 PxyQ== X-Gm-Message-State: AOJu0YytsQns8THvyEkJM59//K9hob9hkUIi3jYgdmatcr4McyWKilUs Q+o6PrzDFjTDTYnFdccTMCZvvVxL2v7pY70KtbUN9iyFz8DId2BEhTapkSwLCri+Epy09qyO6yH 0u0/4IIOEB6SAEjBiHszz0eUNJX6SYCOh X-Gm-Gg: ASbGnctVGkdGy/iGhFjLIJf9i2uGvXPhUcCTikdSJIGLonULd34zg9TvLgm0GwKfoDc 60x2twKxkaSalv/h/70CQaPFnF5mSPgZQmC++DHMUYXCKpuWQka5LWgKA8m4HePgiR0ROCM9uOb PGGo7QFOfVqPTeMZTm05KlpNn3ZBnHImDdE5db0OMYqCtUB/gduTCdgYSVTiAn83U6TLI7LcAP3 294X2jzu+vHTrJAfUmeeb2LUE8sI6fazFwKMgc= X-Google-Smtp-Source: AGHT+IEhnHpZ3/QiwE01fRSOX7qJWgtNjNyORNLK3rxbQgVRrBInPGoQ/m6JfHa7nhZDVe4DgrGV06hWvssoanXwzmI= X-Received: by 2002:a17:906:d54e:b0:af7:37d1:93b6 with SMTP id a640c23a62f3a-af9902cf7d5mr334150666b.15.1754495665944; Wed, 06 Aug 2025 08:54:25 -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: In-Reply-To: From: Rick Macklem Date: Wed, 6 Aug 2025 08:54:14 -0700 X-Gm-Features: Ac12FXx5HK1pn1o0ZhS9WQQNuIRmb0X-KUsjx5Lj65O7l5LiuLCSGgxhQ0OBBxI Message-ID: Subject: Re: RFC: Does ZFS block cloning do this? To: Alan Somers Cc: FreeBSD CURRENT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4bxvxP21fSz3DPS 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:32=E2=80=AFAM Alan Somers wr= ote: > > On Wed, Aug 6, 2025 at 9:18=E2=80=AFAM Rick Macklem wrote: >> >> Hi, >> >> 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. >> (It takes arguments for 2 files, with byte offsets and a length.) >> The offsets must be aligned to a value returned by the NFSv4.2 server. >> 12.2.1. Attribute 77: clone_blksize >> >> The clone_blksize attribute indicates the granularity of a CLONE >> operation. >> >> Does ZFS block cloning do this? >> >> I am asking now, because although it might be too late, >> if the answer is "yes", I'd like to get VOP calls into 15.0 >> for it. (Hopefully with the VOP calls in place, the rest could >> go in sometime later, when I find the time to do it.) >> >> Thanks in advance for any comments, rick > > > Yes, it does that right now, if the feature@block_cloning pool attribute = is enabled. It works with VOP_COPY_FILE_RANGE. Does NFS really need a new= VOP? Either a new VOP or maybe a new flag argument for VOP_COPY_FILE_RANGE(). Linux defined a flag argument for their copy_file_range(), but they have ne= ver defined any flags. Of course, that doesn't mean there cannot be a "kernel internal" flag. So maybe adding a new VOP can be avoided. That would be nice, given the tim= ing of the 15.0 release and other churn going on. The difference for NFSv4.2 is that CLONE cannot return with partial complet= ion. (It assumes that a CLONE of any size will complete quickly enough for an RP= C. Although there is no fixed limit, most assume an RPC reply should happen in 1-2sec at most. For COPY, the server can return with only part of the copy done.) It also includes alignment restrictions for the byte offsets. There is also the alignment restriction on CLONE. There doesn't seem to be an alignment restriction on zfs_clone_range(), but maybe it is buried insid= e it? I think adding yet another pathconf name to get the alignment requirement a= nd whether or not the file system supports it would work without any VOP chang= e. rick