From nobody Mon Apr 17 10:39:27 2023 X-Original-To: dev-commits-src-main@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 4Q0NpS4Cq1z45jD4; Mon, 17 Apr 2023 10:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q0NpR3p1xz3vSQ; Mon, 17 Apr 2023 10:39:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681727967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sHnVJuOPIlGbWeDfjqADbxjOCKgudd6Lwf2CZ+fxnME=; b=HzI02XDhgG3zsSnYaelIMgfwBqb5+h3ujFUbGDJLQKEHnMDAoEcVM/F5DUWUgfhRISNGkd JIKFrxNprobkq315Kr+oEkzktoHtPwQqaaZAgRw15h1mx19LpdhzDnscC+QS0BxDdx2o+m 6xd1Wn+NtF2HOOBXe7oUjh5SVASzhH3JYu2sxv8OWl/vABxmy3qmtUFEQDlNADxyVNYsdx HCgDZD+QcSTvV90y173t2m2GGch4qAdp/cgYVT1uhJor9ABvd3DwsazR547ZuzG1yxZxTv vC5Uz9x9HwwGfikyK3KtinkuM32rMMrCnv7IBh0aFP+ixlBuXAM5PTturNgHKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681727967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sHnVJuOPIlGbWeDfjqADbxjOCKgudd6Lwf2CZ+fxnME=; b=W7tonFkMxsjNIaGZZ86eWjdS1DC07QTwmq/9AqjEIzU8MZ2rLMu7EG5RPMRY/4/ZRyAy20 qjfbP+cKa8UbUpHRpe7102+Zu0XMGkGyF2/A5u/ZKgVmnknKLzfPUkRSX5UvwlCSRRaop0 +pKUBp5vmwYraSpod9rAJxf7cJp71NiJ5XPNlj1BdcZ1oFjjExZ4Hvl8dn7ExSbCAoQLeA 703dlE6oG4hbN8f8vDvLtzp89haFcoQtwc7Jk1IT0ppg0O+4TqO++Zs/JJ3p3sKadkuj12 Bx82S4eQwcHaUHwD8twGPGxKWenIQ9y+nomn4oyiuvhavN926gnH/LukXIY2uA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681727967; a=rsa-sha256; cv=none; b=Vr2/8Q+Pzr540uTE4AuNpIREjWJb8sWN9hLbTR++ENoi+udbc7YTi5od9SlQe6Nr6slUEm bc54Y3i5tDYx8tkKe5xGFWFC3w9TeUowXioRZvXcCbqtlD5WuF5gCm0wHPjP39137Nd2vh YvTW7CVpo+r/Z+MgSLxZnnV0xZDG0HCiXNTc5aKhR2t6fzvjxGosYNnhVE8xQiIMGmCx+k Ce87/qXOU2V7pI2QSssUD3TQvXs1jrnTaAcOiJQBmdLg2+L8YPwNFPzFviboxi234Yoydt +9gkmzd8bqR/cKUGMBvIi5bIozAgC0CIs6cTOfkMtE23YbMb6fLmhalcSz86JQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q0NpR2hn8zQDC; Mon, 17 Apr 2023 10:39:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33HAdRJK058798; Mon, 17 Apr 2023 10:39:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33HAdR0k058797; Mon, 17 Apr 2023 10:39:27 GMT (envelope-from git) Date: Mon, 17 Apr 2023 10:39:27 GMT Message-Id: <202304171039.33HAdR0k058797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pawel Jakub Dawidek Subject: git: 068913e4ba3d - main - zfs: Add vfs.zfs.bclone_enabled sysctl. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pjd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 068913e4ba3dd9b3067056e832cefc5ed264b5cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pjd: URL: https://cgit.FreeBSD.org/src/commit/?id=068913e4ba3dd9b3067056e832cefc5ed264b5cc commit 068913e4ba3dd9b3067056e832cefc5ed264b5cc Author: Pawel Jakub Dawidek AuthorDate: 2023-04-17 10:38:30 +0000 Commit: Pawel Jakub Dawidek CommitDate: 2023-04-17 10:38:30 +0000 zfs: Add vfs.zfs.bclone_enabled sysctl. Keep block cloning disabled by default for now, but allow to enable and use it after setting vfs.zfs.bclone_enabled to 1, so people can easily try it. Approved by: oshogbo Reviewed by: mm, oshogbo Differential Revision: https://reviews.freebsd.org/D39613 --- sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h | 1 + sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 4 ++++ sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 8 ++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h index f765d38dbac8..5948e44daab1 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h @@ -287,6 +287,7 @@ typedef struct zfid_long { extern uint_t zfs_fsyncer_key; extern int zfs_super_owner; +extern int zfs_bclone_enabled; extern void zfs_init(void); extern void zfs_fini(void); diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 30851f5273a2..b63899ddede0 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -89,6 +89,10 @@ int zfs_debug_level; SYSCTL_INT(_vfs_zfs, OID_AUTO, debug, CTLFLAG_RWTUN, &zfs_debug_level, 0, "Debug level"); +int zfs_bclone_enabled; +SYSCTL_INT(_vfs_zfs, OID_AUTO, bclone_enabled, CTLFLAG_RWTUN, + &zfs_bclone_enabled, 0, "Enable block cloning"); + struct zfs_jailparam { int mount_snapshot; }; diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 7b5fe8a3abe0..5079d0afa9e4 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -6214,7 +6214,6 @@ zfs_deallocate(struct vop_deallocate_args *ap) } #endif -#if 0 #ifndef _SYS_SYSPROTO_H_ struct vop_copy_file_range_args { struct vnode *a_invp; @@ -6245,6 +6244,11 @@ zfs_freebsd_copy_file_range(struct vop_copy_file_range_args *ap) int error; uint64_t len = *ap->a_lenp; + if (!zfs_bclone_enabled) { + mp = NULL; + goto bad_write_fallback; + } + /* * TODO: If offset/length is not aligned to recordsize, use * vn_generic_copy_file_range() on this fragment. @@ -6310,7 +6314,6 @@ bad_write_fallback: ap->a_incred, ap->a_outcred, ap->a_fsizetd); return (error); } -#endif struct vop_vector zfs_vnodeops; struct vop_vector zfs_fifoops; @@ -6375,6 +6378,7 @@ struct vop_vector zfs_vnodeops = { #if __FreeBSD_version >= 1400043 .vop_add_writecount = vop_stdadd_writecount_nomsync, #endif + .vop_copy_file_range = zfs_freebsd_copy_file_range, }; VFS_VOP_VECTOR_REGISTER(zfs_vnodeops);