Selectable block allocators

ZFS historically has had several space allocators that were
dynamically selectable.  While these have been retained in 
OpenZFS, only a single allocator has been statically compiled 
in. This patch compiles all allocators for OpenZFS and provides 
a module parameter to allow for manual selection between them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@ixsystems.com>
Closes #15218
This commit is contained in:
ednadolski-ix
2023-09-01 19:00:30 -06:00
committed by GitHub
parent 71472bf375
commit 95f71c019d
9 changed files with 127 additions and 31 deletions
+18
View File
@@ -503,6 +503,24 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_idistance,
/* metaslab.c */
int
param_set_active_allocator(SYSCTL_HANDLER_ARGS)
{
char buf[16];
int rc;
if (req->newptr == NULL)
strlcpy(buf, zfs_active_allocator, sizeof (buf));
rc = sysctl_handle_string(oidp, buf, sizeof (buf), req);
if (rc || req->newptr == NULL)
return (rc);
if (strcmp(buf, zfs_active_allocator) == 0)
return (0);
return (param_set_active_allocator_common(buf));
}
/*
* In pools where the log space map feature is not enabled we touch
* multiple metaslabs (and their respective space maps) with each
+12
View File
@@ -103,6 +103,18 @@ param_set_slop_shift(const char *buf, zfs_kernel_param_t *kp)
return (0);
}
int
param_set_active_allocator(const char *val, zfs_kernel_param_t *kp)
{
int error;
error = -param_set_active_allocator_common(val);
if (error == 0)
error = param_set_charp(val, kp);
return (error);
}
const char *
spa_history_zone(void)
{