Skip to content

Commit 576d34c

Browse files
0mpbehlendorf
authored andcommitted
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 <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Mateusz Piotrowski <[email protected]> Sponsored-by: Wasabi Technology, Inc. Closes #14293
1 parent 6281b5c commit 576d34c

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

man/man4/zfs.4

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.\" own identifying information:
1616
.\" Portions Copyright [yyyy] [name of copyright owner]
1717
.\"
18-
.Dd June 1, 2021
18+
.Dd January 10, 2023
1919
.Dt ZFS 4
2020
.Os
2121
.
@@ -233,6 +233,12 @@ relative to the pool.
233233
Make some blocks above a certain size be gang blocks.
234234
This option is used by the test suite to facilitate testing.
235235
.
236+
.It Sy zfs_default_bs Ns = Ns Sy 9 Po 512 B Pc Pq int
237+
Default dnode block size as a power of 2.
238+
.
239+
.It Sy zfs_default_ibs Ns = Ns Sy 17 Po 128 KiB Pc Pq int
240+
Default dnode indirect block size as a power of 2.
241+
.
236242
.It Sy zfs_history_output_max Ns = Ns Sy 1048576 Ns B Ns B Po 1MB Pc Pq int
237243
When attempting to log an output nvlist of an ioctl in the on-disk history,
238244
the output will not be stored if it is larger than this size (in bytes).

module/os/freebsd/zfs/sysctl_os.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,6 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_idistance, CTLFLAG_RWTUN,
356356
/* dsl_pool.c */
357357

358358
/* dnode.c */
359-
extern int zfs_default_bs;
360-
SYSCTL_INT(_vfs_zfs, OID_AUTO, default_bs, CTLFLAG_RWTUN,
361-
&zfs_default_bs, 0, "Default dnode block shift");
362-
363-
extern int zfs_default_ibs;
364-
SYSCTL_INT(_vfs_zfs, OID_AUTO, default_ibs, CTLFLAG_RWTUN,
365-
&zfs_default_ibs, 0, "Default dnode indirect block shift");
366-
367359

368360
/* dsl_scan.c */
369361

module/zfs/dnode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,3 +2714,8 @@ EXPORT_SYMBOL(dnode_free_range);
27142714
EXPORT_SYMBOL(dnode_evict_dbufs);
27152715
EXPORT_SYMBOL(dnode_evict_bonus);
27162716
#endif
2717+
2718+
ZFS_MODULE_PARAM(zfs, zfs_, default_bs, INT, ZMOD_RW,
2719+
"Default dnode block shift");
2720+
ZFS_MODULE_PARAM(zfs, zfs_, default_ibs, INT, ZMOD_RW,
2721+
"Default dnode indirect block shift");

0 commit comments

Comments
 (0)