Add a tunable to disable BRT support.
Copy the disable parameter that FreeBSD implemented, and extend it to work on Linux as well, until we're sure this is stable. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #15529
This commit is contained in:
parent
5796e3a742
commit
03e9caaec0
|
@ -285,6 +285,7 @@ typedef struct zfid_long {
|
||||||
#define LONG_FID_LEN (sizeof (zfid_long_t) - sizeof (uint16_t))
|
#define LONG_FID_LEN (sizeof (zfid_long_t) - sizeof (uint16_t))
|
||||||
|
|
||||||
extern int zfs_super_owner;
|
extern int zfs_super_owner;
|
||||||
|
extern int zfs_bclone_enabled;
|
||||||
|
|
||||||
extern void zfs_init(void);
|
extern void zfs_init(void);
|
||||||
extern void zfs_fini(void);
|
extern void zfs_fini(void);
|
||||||
|
|
|
@ -45,6 +45,8 @@ extern "C" {
|
||||||
typedef struct zfsvfs zfsvfs_t;
|
typedef struct zfsvfs zfsvfs_t;
|
||||||
struct znode;
|
struct znode;
|
||||||
|
|
||||||
|
extern int zfs_bclone_enabled;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This structure emulates the vfs_t from other platforms. It's purpose
|
* This structure emulates the vfs_t from other platforms. It's purpose
|
||||||
* is to facilitate the handling of mount options and minimize structural
|
* is to facilitate the handling of mount options and minimize structural
|
||||||
|
|
|
@ -1154,6 +1154,11 @@ Selecting any option other than
|
||||||
results in vector instructions
|
results in vector instructions
|
||||||
from the respective CPU instruction set being used.
|
from the respective CPU instruction set being used.
|
||||||
.
|
.
|
||||||
|
.It Sy zfs_bclone_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int
|
||||||
|
Enable the experimental block cloning feature.
|
||||||
|
If this setting is 0, then even if feature@block_cloning is enabled,
|
||||||
|
attempts to clone blocks will act as though the feature is disabled.
|
||||||
|
.
|
||||||
.It Sy zfs_blake3_impl Ns = Ns Sy fastest Pq string
|
.It Sy zfs_blake3_impl Ns = Ns Sy fastest Pq string
|
||||||
Select a BLAKE3 implementation.
|
Select a BLAKE3 implementation.
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -89,6 +89,10 @@ int zfs_debug_level;
|
||||||
SYSCTL_INT(_vfs_zfs, OID_AUTO, debug, CTLFLAG_RWTUN, &zfs_debug_level, 0,
|
SYSCTL_INT(_vfs_zfs, OID_AUTO, debug, CTLFLAG_RWTUN, &zfs_debug_level, 0,
|
||||||
"Debug level");
|
"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 {
|
struct zfs_jailparam {
|
||||||
int mount_snapshot;
|
int mount_snapshot;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6250,6 +6250,11 @@ zfs_freebsd_copy_file_range(struct vop_copy_file_range_args *ap)
|
||||||
int error;
|
int error;
|
||||||
uint64_t len = *ap->a_lenp;
|
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
|
* TODO: If offset/length is not aligned to recordsize, use
|
||||||
* vn_generic_copy_file_range() on this fragment.
|
* vn_generic_copy_file_range() on this fragment.
|
||||||
|
|
|
@ -4249,4 +4249,8 @@ EXPORT_SYMBOL(zfs_map);
|
||||||
module_param(zfs_delete_blocks, ulong, 0644);
|
module_param(zfs_delete_blocks, ulong, 0644);
|
||||||
MODULE_PARM_DESC(zfs_delete_blocks, "Delete files larger than N blocks async");
|
MODULE_PARM_DESC(zfs_delete_blocks, "Delete files larger than N blocks async");
|
||||||
|
|
||||||
|
/* CSTYLED */
|
||||||
|
module_param(zfs_bclone_enabled, uint, 0644);
|
||||||
|
MODULE_PARM_DESC(zfs_bclone_enabled, "Enable block cloning");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include <sys/zfs_vnops.h>
|
#include <sys/zfs_vnops.h>
|
||||||
#include <sys/zfeature.h>
|
#include <sys/zfeature.h>
|
||||||
|
|
||||||
|
int zfs_bclone_enabled = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clone part of a file via block cloning.
|
* Clone part of a file via block cloning.
|
||||||
*
|
*
|
||||||
|
@ -50,6 +52,9 @@ __zpl_clone_file_range(struct file *src_file, loff_t src_off,
|
||||||
fstrans_cookie_t cookie;
|
fstrans_cookie_t cookie;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (!zfs_bclone_enabled)
|
||||||
|
return (-EOPNOTSUPP);
|
||||||
|
|
||||||
if (!spa_feature_is_enabled(
|
if (!spa_feature_is_enabled(
|
||||||
dmu_objset_spa(ITOZSB(dst_i)->z_os), SPA_FEATURE_BLOCK_CLONING))
|
dmu_objset_spa(ITOZSB(dst_i)->z_os), SPA_FEATURE_BLOCK_CLONING))
|
||||||
return (-EOPNOTSUPP);
|
return (-EOPNOTSUPP);
|
||||||
|
|
|
@ -3334,6 +3334,21 @@ function set_tunable_impl
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_tunable
|
||||||
|
{
|
||||||
|
[[ ! -d $TEST_BASE_DIR ]] && return 1
|
||||||
|
[[ -e $TEST_BASE_DIR/tunable-$1 ]] && return 2
|
||||||
|
echo "$(get_tunable """$1""")" > "$TEST_BASE_DIR"/tunable-"$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function restore_tunable
|
||||||
|
{
|
||||||
|
[[ ! -e $TEST_BASE_DIR/tunable-$1 ]] && return 1
|
||||||
|
val="$(cat $TEST_BASE_DIR/tunable-"""$1""")"
|
||||||
|
set_tunable64 "$1" "$val"
|
||||||
|
rm $TEST_BASE_DIR/tunable-$1
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Get a global system tunable
|
# Get a global system tunable
|
||||||
#
|
#
|
||||||
|
|
|
@ -93,6 +93,7 @@ VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
|
||||||
VOL_MODE vol.mode zvol_volmode
|
VOL_MODE vol.mode zvol_volmode
|
||||||
VOL_RECURSIVE vol.recursive UNSUPPORTED
|
VOL_RECURSIVE vol.recursive UNSUPPORTED
|
||||||
VOL_USE_BLK_MQ UNSUPPORTED zvol_use_blk_mq
|
VOL_USE_BLK_MQ UNSUPPORTED zvol_use_blk_mq
|
||||||
|
BCLONE_ENABLED zfs_bclone_enabled zfs_bclone_enabled
|
||||||
XATTR_COMPAT xattr_compat zfs_xattr_compat
|
XATTR_COMPAT xattr_compat zfs_xattr_compat
|
||||||
ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
|
ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
|
||||||
ZEVENT_RETAIN_MAX zevent.retain_max zfs_zevent_retain_max
|
ZEVENT_RETAIN_MAX zevent.retain_max zfs_zevent_retain_max
|
||||||
|
|
|
@ -31,4 +31,8 @@ verify_runnable "global"
|
||||||
|
|
||||||
default_cleanup_noexit
|
default_cleanup_noexit
|
||||||
|
|
||||||
|
if tunable_exists BCLONE_ENABLED ; then
|
||||||
|
log_must restore_tunable BCLONE_ENABLED
|
||||||
|
fi
|
||||||
|
|
||||||
log_pass
|
log_pass
|
||||||
|
|
|
@ -33,4 +33,9 @@ fi
|
||||||
|
|
||||||
verify_runnable "global"
|
verify_runnable "global"
|
||||||
|
|
||||||
|
if tunable_exists BCLONE_ENABLED ; then
|
||||||
|
log_must save_tunable BCLONE_ENABLED
|
||||||
|
log_must set_tunable32 BCLONE_ENABLED 1
|
||||||
|
fi
|
||||||
|
|
||||||
log_pass
|
log_pass
|
||||||
|
|
Loading…
Reference in New Issue