Skip to content

Commit 801d9b4

Browse files
committed
debug: move all of the debug bits out of the spl
Pull all of the internal debug infrastructure up in to the zfs code to clean up the layering. Remove all the dodgy usage of SET_ERROR and DTRACE_PROBE from the spl. Luckily it was lightly used in the spl layer so we're not losing much. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17861
1 parent eceb5b3 commit 801d9b4

File tree

16 files changed

+71
-82
lines changed

16 files changed

+71
-82
lines changed

include/os/freebsd/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ noinst_HEADERS = \
4444
%D%/spl/sys/procfs_list.h \
4545
%D%/spl/sys/random.h \
4646
%D%/spl/sys/rwlock.h \
47-
%D%/spl/sys/sdt.h \
4847
%D%/spl/sys/sid.h \
4948
%D%/spl/sys/sig.h \
5049
%D%/spl/sys/simd.h \
@@ -63,7 +62,6 @@ noinst_HEADERS = \
6362
%D%/spl/sys/time.h \
6463
%D%/spl/sys/timer.h \
6564
%D%/spl/sys/trace.h \
66-
%D%/spl/sys/trace_zfs.h \
6765
%D%/spl/sys/types.h \
6866
%D%/spl/sys/types32.h \
6967
%D%/spl/sys/uio.h \
@@ -82,10 +80,12 @@ noinst_HEADERS = \
8280
%D%/zfs/sys/arc_os.h \
8381
%D%/zfs/sys/freebsd_crypto.h \
8482
%D%/zfs/sys/freebsd_event.h \
83+
%D%/zfs/sys/trace_zfs.h \
8584
%D%/zfs/sys/vdev_os.h \
8685
%D%/zfs/sys/zfs_bootenv_os.h \
8786
%D%/zfs/sys/zfs_context_os.h \
8887
%D%/zfs/sys/zfs_ctldir.h \
88+
%D%/zfs/sys/zfs_debug_os.h \
8989
%D%/zfs/sys/zfs_dir.h \
9090
%D%/zfs/sys/zfs_ioctl_compat.h \
9191
%D%/zfs/sys/zfs_vfsops_os.h \
File renamed without changes.

include/os/freebsd/spl/sys/sdt.h renamed to include/os/freebsd/zfs/sys/zfs_debug_os.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
* $FreeBSD$
2828
*/
2929

30-
#ifndef _OPENSOLARIS_SYS_SDT_H_
31-
#define _OPENSOLARIS_SYS_SDT_H_
30+
#ifndef _SYS_ZFS_DEBUG_OS_H
31+
#define _SYS_ZFS_DEBUG_OS_H
32+
33+
#include <sys/sdt.h>
3234

33-
#include_next <sys/sdt.h>
3435
#ifdef KDTRACE_HOOKS
3536
SDT_PROBE_DECLARE(sdt, , , set__error);
3637

@@ -44,4 +45,4 @@ SDT_PROBE_DECLARE(sdt, , , set__error);
4445
#define SET_ERROR(err) (err)
4546
#endif
4647

47-
#endif /* _OPENSOLARIS_SYS_SDT_H_ */
48+
#endif /* _SYS_ZFS_DEBUG_OS_H */

include/os/linux/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ kernel_sys_HEADERS = \
4141
%D%/zfs/sys/zfs_bootenv_os.h \
4242
%D%/zfs/sys/zfs_context_os.h \
4343
%D%/zfs/sys/zfs_ctldir.h \
44+
%D%/zfs/sys/zfs_debug_os.h \
4445
%D%/zfs/sys/zfs_dir.h \
4546
%D%/zfs/sys/zfs_vfsops_os.h \
4647
%D%/zfs/sys/zfs_vnops_os.h \
@@ -97,7 +98,6 @@ kernel_spl_sys_HEADERS = \
9798
%D%/spl/sys/time.h \
9899
%D%/spl/sys/timer.h \
99100
%D%/spl/sys/trace.h \
100-
%D%/spl/sys/trace_spl.h \
101101
%D%/spl/sys/trace_taskq.h \
102102
%D%/spl/sys/tsd.h \
103103
%D%/spl/sys/types.h \

include/os/linux/spl/sys/sysmacros.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
#include <sys/signal.h>
3535
#include <asm/page.h>
3636

37-
38-
#ifndef _KERNEL
39-
#define _KERNEL __KERNEL__
40-
#endif
41-
4237
#define FALSE 0
4338
#define TRUE 1
4439

@@ -202,9 +197,6 @@ makedev(unsigned int major, unsigned int minor)
202197
#define P2SAMEHIGHBIT_TYPED(x, y, type) \
203198
(((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
204199

205-
#define SET_ERROR(err) \
206-
(__set_error(__FILE__, __func__, __LINE__, err), err)
207-
208200
#include <linux/sort.h>
209201
#define qsort(base, num, size, cmp) \
210202
sort(base, num, size, cmp, NULL)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: CDDL-1.0
2+
/*
3+
* CDDL HEADER START
4+
*
5+
* The contents of this file are subject to the terms of the
6+
* Common Development and Distribution License (the "License").
7+
* You may not use this file except in compliance with the License.
8+
*
9+
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10+
* or https://opensource.org/licenses/CDDL-1.0.
11+
* See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
*
14+
* When distributing Covered Code, include this CDDL HEADER in each
15+
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16+
* If applicable, add the following below this CDDL HEADER, with the
17+
* fields enclosed by brackets "[]" replaced with your own identifying
18+
* information: Portions Copyright [yyyy] [name of copyright owner]
19+
*
20+
* CDDL HEADER END
21+
*/
22+
23+
#ifndef _SYS_ZFS_DEBUG_OS_H
24+
#define _SYS_ZFS_DEBUG_OS_H
25+
26+
#define SET_ERROR(err) \
27+
(__set_error(__FILE__, __func__, __LINE__, err), err)
28+
29+
#endif /* _SYS_ZFS_DEBUG_OS_H */

include/sys/zfs_context.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ extern "C" {
109109
#include <sys/sysevent/eventdefs.h>
110110
#include <sys/sunddi.h>
111111
#include <sys/debug.h>
112-
#include <sys/trace_zfs.h>
113112
#include <sys/zone.h>
114113

115114
#include <sys/mutex.h>

include/sys/zfs_debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern "C" {
4040
#endif
4141

4242
#include <sys/nvpair.h>
43+
#include <sys/zfs_debug_os.h>
4344

4445
extern int zfs_flags;
4546
extern int zfs_recover;

lib/libspl/include/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ libspl_sys_HEADERS = \
6969
%D%/sys/time.h \
7070
%D%/sys/timer.h \
7171
%D%/sys/trace.h \
72-
%D%/sys/trace_spl.h \
7372
%D%/sys/tsd.h \
7473
%D%/sys/tunables.h \
7574
%D%/sys/types.h \

lib/libspl/include/sys/trace_spl.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)