Skip to content

Commit 2245557

Browse files
committed
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). Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Mateusz Piotrowski <[email protected]>
1 parent 289f7e6 commit 2245557

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
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 November 9, 2022
18+
.Dd January 9, 2023
1919
.Dt ZFS 4
2020
.Os
2121
.
@@ -239,6 +239,12 @@ relative to the pool.
239239
Make some blocks above a certain size be gang blocks.
240240
This option is used by the test suite to facilitate testing.
241241
.
242+
.It Sy zfs_default_bs Ns = Ns Sy 9 Po 512 B Pc Pq int
243+
Default dnode block size as a power of 2.
244+
.
245+
.It Sy zfs_default_ibs Ns = Ns Sy 17 Po 128 KiB Pc Pq int
246+
Default dnode indirect block size as a power of 2.
247+
.
242248
.It Sy zfs_history_output_max Ns = Ns Sy 1048576 Ns B Po 1 MiB Pc Pq u64
243249
When attempting to log an output nvlist of an ioctl in the on-disk history,
244250
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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -472,20 +472,6 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_idistance,
472472

473473
/* dnode.c */
474474

475-
extern int zfs_default_bs;
476-
477-
/* BEGIN CSTYLED */
478-
SYSCTL_INT(_vfs_zfs, OID_AUTO, default_bs, CTLFLAG_RWTUN,
479-
&zfs_default_bs, 0, "Default dnode block shift");
480-
/* END CSTYLED */
481-
482-
extern int zfs_default_ibs;
483-
484-
/* BEGIN CSTYLED */
485-
SYSCTL_INT(_vfs_zfs, OID_AUTO, default_ibs, CTLFLAG_RWTUN,
486-
&zfs_default_ibs, 0, "Default dnode indirect block shift");
487-
/* END CSTYLED */
488-
489475
/* dsl_scan.c */
490476

491477
/* metaslab.c */

module/zfs/dnode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,3 +2696,8 @@ EXPORT_SYMBOL(dnode_free_range);
26962696
EXPORT_SYMBOL(dnode_evict_dbufs);
26972697
EXPORT_SYMBOL(dnode_evict_bonus);
26982698
#endif
2699+
2700+
ZFS_MODULE_PARAM(zfs, zfs_, default_bs, INT, ZMOD_RW,
2701+
"Default dnode block shift");
2702+
ZFS_MODULE_PARAM(zfs, zfs_, default_ibs, INT, ZMOD_RW,
2703+
"Default dnode indirect block shift");

0 commit comments

Comments
 (0)