Skip to content

Commit

Permalink
Turn default_bs and default_ibs into ZFS_MODULE_PARAMs
Browse files Browse the repository at this point in the history
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 <mateusz.piotrowski@klarasystems.com>
  • Loading branch information
0mp committed Dec 15, 2022
1 parent fb11b15 commit 2b5ceb9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
8 changes: 7 additions & 1 deletion man/man4/zfs.4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.\" own identifying information:
.\" Portions Copyright [yyyy] [name of copyright owner]
.\"
.Dd November 9, 2022
.Dd December 15, 2022
.Dt ZFS 4
.Os
.
Expand Down Expand Up @@ -239,6 +239,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 Po 1 MiB Pc Pq u64
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).
Expand Down
14 changes: 0 additions & 14 deletions module/os/freebsd/zfs/sysctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,20 +459,6 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_idistance,

/* dnode.c */

extern int zfs_default_bs;

/* BEGIN CSTYLED */
SYSCTL_INT(_vfs_zfs, OID_AUTO, default_bs, CTLFLAG_RWTUN,
&zfs_default_bs, 0, "Default dnode block shift");
/* END CSTYLED */

extern int zfs_default_ibs;

/* BEGIN CSTYLED */
SYSCTL_INT(_vfs_zfs, OID_AUTO, default_ibs, CTLFLAG_RWTUN,
&zfs_default_ibs, 0, "Default dnode indirect block shift");
/* END CSTYLED */

/* dsl_scan.c */

/* metaslab.c */
Expand Down
5 changes: 5 additions & 0 deletions module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2696,3 +2696,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");

0 comments on commit 2b5ceb9

Please sign in to comment.