From 2f327a2457b48092a79f69d7eefe2e3762abe185 Mon Sep 17 00:00:00 2001 From: Mateusz Piotrowski Date: Wed, 11 Jan 2023 18:38:20 +0100 Subject: [PATCH] Turn default_bs and default_ibs into ZFS_MODULE_PARAMs The default_bs and default_ibs tunables control the default block size and indirect block size. So far, default_bs and default_ibs were tunable only on FreeBSD, e.g., sysctl vfs.zfs.default_ibs Remove the FreeBSD-specific sysctl code and expose default_bs and default_ibs as tunables on both Linux and FreeBSD using ZFS_MODULE_PARAM. One of the use cases for changing the values of those tunables is to lower the indirect block size, which may improve performance of large directories (as discussed during the OpenZFS Leadership Meeting on 2022-08-16). Reviewed-by: Brian Behlendorf Reviewed-by: Richard Yao Signed-off-by: Mateusz Piotrowski Sponsored-by: Wasabi Technology, Inc. Closes #14293 (cherry picked from commit 926715b9fcf043d5302e2fe07b7f2e29a29a57b4) --- man/man4/zfs.4 | 8 +++++++- module/zfs/dnode.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/man/man4/zfs.4 b/man/man4/zfs.4 index 50c13b67bb..ac6474770a 100644 --- a/man/man4/zfs.4 +++ b/man/man4/zfs.4 @@ -15,7 +15,7 @@ .\" own identifying information: .\" Portions Copyright [yyyy] [name of copyright owner] .\" -.Dd December 21, 2022 +.Dd January 10, 2023 .Dt ZFS 4 .Os . @@ -228,6 +228,12 @@ relative to the pool. Make some blocks above a certain size be gang blocks. This option is used by the test suite to facilitate testing. . +.It Sy zfs_default_bs Ns = Ns Sy 9 Po 512 B Pc Pq int +Default dnode block size as a power of 2. +. +.It Sy zfs_default_ibs Ns = Ns Sy 17 Po 128 KiB Pc Pq int +Default dnode indirect block size as a power of 2. +. .It Sy zfs_history_output_max Ns = Ns Sy 1048576 Ns B Ns B Po 1MB Pc Pq int When attempting to log an output nvlist of an ioctl in the on-disk history, the output will not be stored if it is larger than this size (in bytes). diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 8e55d54479..b0d00adf42 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -2595,3 +2595,8 @@ EXPORT_SYMBOL(dnode_free_range); EXPORT_SYMBOL(dnode_evict_dbufs); EXPORT_SYMBOL(dnode_evict_bonus); #endif + +ZFS_MODULE_PARAM(zfs, zfs_, default_bs, INT, ZMOD_RW, + "Default dnode block shift"); +ZFS_MODULE_PARAM(zfs, zfs_, default_ibs, INT, ZMOD_RW, + "Default dnode indirect block shift");