Skip to content

Commit

Permalink
Reference_tracking_enable should be a module param
Browse files Browse the repository at this point in the history
To make use of zfs_refcount_held tunable it should be a module 
parameter in open-zfs.  Also, since the macros will auto-generate OS 
specific tunables, removed the existing zfs_refcount_held reference 
in module/os/freebsd/zfs/sysctl_os.c.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Don Brady <don.brady@delphix.com>
Closes #11753
  • Loading branch information
Don Brady authored Mar 16, 2021
1 parent 9305ff2 commit dd0b5c8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
25 changes: 24 additions & 1 deletion man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'\" te
.\" Copyright (c) 2013 by Turbo Fredriksson <turbo@bayour.com>. All rights reserved.
.\" Copyright (c) 2019, 2020 by Delphix. All rights reserved.
.\" Copyright (c) 2019, 2021 by Delphix. All rights reserved.
.\" Copyright (c) 2019 Datto Inc.
.\" The contents of this file are subject to the terms of the Common Development
.\" and Distribution License (the "License"). You may not use this file except
Expand Down Expand Up @@ -691,6 +691,29 @@ will occur.
Default value: \fB600000\fR (ten minutes).
.RE

.sp
.ne 2
.na
\fBreference_history\fR (int)
.ad
.RS 12n
Maximum reference holders being tracked when reference_tracking_enable is
active.
.sp
Default value: \fB3\fR.
.RE

.sp
.ne 2
.na
\fBreference_tracking_enable\fR (int)
.ad
.RS 12n
Track reference holders to refcount_t objects (debug builds only).
.sp
Use \fB1\fR for yes and \fB0\fR for no (default).
.RE

.sp
.ne 2
.na
Expand Down
6 changes: 0 additions & 6 deletions module/os/freebsd/zfs/sysctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,6 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, preload_limit, CTLFLAG_RWTUN,
&metaslab_preload_limit, 0,
"Max number of metaslabs per group to preload");

/* refcount.c */
extern int reference_tracking_enable;
SYSCTL_INT(_vfs_zfs, OID_AUTO, reference_tracking_enable, CTLFLAG_RDTUN,
&reference_tracking_enable, 0,
"Track reference holders to refcount_t objects, used mostly by ZFS");

/* spa.c */
extern int zfs_ccw_retry_interval;
SYSCTL_INT(_vfs_zfs, OID_AUTO, ccw_retry_interval, CTLFLAG_RWTUN,
Expand Down
10 changes: 9 additions & 1 deletion module/zfs/refcount.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
* Copyright (c) 2012, 2021 by Delphix. All rights reserved.
*/

#include <sys/zfs_context.h>
Expand Down Expand Up @@ -324,4 +324,12 @@ zfs_refcount_not_held(zfs_refcount_t *rc, const void *holder)
mutex_exit(&rc->rc_mtx);
return (B_TRUE);
}

/* BEGIN CSTYLED */
ZFS_MODULE_PARAM(zfs, ,reference_tracking_enable, INT, ZMOD_RW,
"Track reference holders to refcount_t objects");

ZFS_MODULE_PARAM(zfs, ,reference_history, INT, ZMOD_RW,
"Maximum reference holders being tracked");
/* END CSTYLED */
#endif /* ZFS_DEBUG */

0 comments on commit dd0b5c8

Please sign in to comment.