aboutsummaryrefslogtreecommitdiffstats
path: root/module/os/freebsd/zfs/zfs_vfsops.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2024-02-05 16:44:45 -0800
committerGitHub <[email protected]>2024-02-05 16:44:45 -0800
commit6dccdf501ea47bb8a45f00e4904d26efcb917ad4 (patch)
treec3a3f8525e4202edc8c8a97759fc354e5673664c /module/os/freebsd/zfs/zfs_vfsops.c
parenta0d3fe72bf78e9035d231b00583cc5408c5cc63d (diff)
BRT: Fix FICLONE/FICLONERANGE shortened copy
On Linux the ioctl_ficlonerange() and ioctl_ficlone() system calls are expected to either fully clone the specified range or return an error. The range may be for an entire file. While internally ZFS supports cloning partial ranges there's no way to return the length cloned to the caller so we need to make this all or nothing. As part of this change support for the REMAP_FILE_CAN_SHORTEN flag has been added. When REMAP_FILE_CAN_SHORTEN is set zfs_clone_range() will return a shortened range when encountering pending dirty records. When it's clear zfs_clone_range() will block and wait for the records to be written out allowing the blocks to be cloned. Furthermore, the file range lock is held over the region being cloned to prevent it from being modified while cloning. This doesn't quite provide an atomic semantics since if an error is encountered only a portion of the range may be cloned. This will be converted to an error if REMAP_FILE_CAN_SHORTEN was not provided and returned to the caller. However, the destination file range is left in an undefined state. A test case has been added which exercises this functionality by verifying that `cp --reflink=never|auto|always` works correctly. Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #15728 Closes #15842
Diffstat (limited to 'module/os/freebsd/zfs/zfs_vfsops.c')
-rw-r--r--module/os/freebsd/zfs/zfs_vfsops.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/module/os/freebsd/zfs/zfs_vfsops.c b/module/os/freebsd/zfs/zfs_vfsops.c
index f2d539103..a972c720d 100644
--- a/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/module/os/freebsd/zfs/zfs_vfsops.c
@@ -89,10 +89,6 @@ int zfs_debug_level;
SYSCTL_INT(_vfs_zfs, OID_AUTO, debug, CTLFLAG_RWTUN, &zfs_debug_level, 0,
"Debug level");
-int zfs_bclone_enabled = 1;
-SYSCTL_INT(_vfs_zfs, OID_AUTO, bclone_enabled, CTLFLAG_RWTUN,
- &zfs_bclone_enabled, 0, "Enable block cloning");
-
struct zfs_jailparam {
int mount_snapshot;
};