Default to zfs_bclone_wait_dirty=1

Update the default FICLONE and FICLONERANGE ioctl behavior to wait
on dirty blocks.  While this does remove some control from the
application, in practice ZFS is better positioned to the optimial
thing and immediately force a TXG sync.

Reviewed-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #17455
This commit is contained in:
Brian Behlendorf
2025-07-25 07:42:23 -07:00
committed by GitHub
parent 4bd7a2eaa5
commit cf146460c1
4 changed files with 39 additions and 14 deletions
+7 -6
View File
@@ -67,13 +67,14 @@
int zfs_bclone_enabled = 1;
/*
* When set zfs_clone_range() waits for dirty data to be written to disk.
* This allows the clone operation to reliably succeed when a file is modified
* and then immediately cloned. For small files this may be slower than making
* a copy of the file and is therefore not the default. However, in certain
* scenarios this behavior may be desirable so a tunable is provided.
* When set to 1 the FICLONE and FICLONERANGE ioctls will wait for any dirty
* data to be written to disk before proceeding. This ensures that the clone
* operation reliably succeeds, even if a file is modified and then immediately
* cloned. Note that for small files this may be slower than simply copying
* the file. When set to 0 the clone operation will immediately fail if it
* encounters any dirty blocks. By default waiting is enabled.
*/
int zfs_bclone_wait_dirty = 0;
int zfs_bclone_wait_dirty = 1;
/*
* Enable Direct I/O. If this setting is 0, then all I/O requests will be