mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
OpenZFS release 2.2.7 Notable upstream pull request merges: #15457022bf8637Increase L2ARC write rate and headroom #155271ba5b2ef8freebsd: remove __FBSDID macro use #157929e7af55e8Add custom debug printing for your asserts #15793a1ea40af8libzfs: use zfs_strerror() in place of strerror() #16181 -multiple zdb/ztest: improve and harmonise crash output #16208e5e4957a5Allow block cloning to be interrupted by a signal #16210ba4e582a6FreeBSD: Add const qualifier to members of struct opensolaris_utsname #16225a6198f34bSimplify issig() #1633525ec9a903zdb: fix BRT dump #16364cf80a803dzvol: ensure device minors are properly cleaned up #16404384b53be8FreeBSD: Add missing memory reclamation accounting #16492 -multiple Split "shared" userspace & kernel code into separate files #16496f1694496azfs_file: rename zfs_file_fallocate to zfs_file_deallocate #16511bc0d89bfcFix an uninitialized data access #165292dc8529d9Fix handling of DNS names with '-' in them for sharenfs #1653930ea44296zfs_log: add flex array fields to log record structs #16546098789216Evicting too many bytes from MFU metadata #1655154278533aReduce and handle EAGAIN errors on AIO label reads #1655484ad1d536FreeBSD: restore zfs_znode_update_vfs() #1656521c40e6d9FreeBSD: Sync taskq_cancel_id() returns with Linux #1656748482bb2fProperly release key in spa_keystore_dsl_key_hold_dd() #16584e8f4592a1Avoid computing strlen() inside loops #16605acc8a3186ARC: Cache arc_c value during arc_evict() #16650fc60e0c6efreebsd: Use compiler.h from FreeBSD's base's linuxkpi #16667b32b35ceazdb: show bp in uberblock dump #166841f5e1b919Pack dmu_buf_impl_t by 16 bytes #1668873b3e8aceFix gcc uninitialized warning in FreeBSD zio_crypt.c #16690727506c94On the first vdev open ignore impossible ashift hints #16692d83cd5307zdb: add extra -T flag to show histograms of BRT refcounts #1669382ab837a0Fix gcc unused value warning in FreeBSD simd.h #167402bba6e3c5BRT: Don't call brt_pending_remove() on holes/embedded #16801299da6aceFix race in libzfs_run_process_impl Obtained from: OpenZFS OpenZFS commit:e269af1b3cOpenZFS tag: zfs-2.2.7
106 lines
2.8 KiB
C
106 lines
2.8 KiB
C
/*
|
|
* CDDL HEADER START
|
|
*
|
|
* 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 in compliance with the License.
|
|
*
|
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
* or https://opensource.org/licenses/CDDL-1.0.
|
|
* See the License for the specific language governing permissions
|
|
* and limitations under the License.
|
|
*
|
|
* When distributing Covered Code, include this CDDL HEADER in each
|
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
* If applicable, add the following below this CDDL HEADER, with the
|
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
|
*
|
|
* CDDL HEADER END
|
|
*/
|
|
/*
|
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
|
* Copyright (c) 2012, 2014 by Delphix. All rights reserved.
|
|
* Copyright (c) 2024, Rob Norris <robn@despairlabs.com>
|
|
*/
|
|
|
|
#include <sys/zfs_context.h>
|
|
|
|
typedef struct zfs_dbgmsg {
|
|
list_node_t zdm_node;
|
|
uint64_t zdm_timestamp;
|
|
uint_t zdm_size;
|
|
char zdm_msg[]; /* variable length allocation */
|
|
} zfs_dbgmsg_t;
|
|
|
|
static list_t zfs_dbgmsgs;
|
|
static kmutex_t zfs_dbgmsgs_lock;
|
|
|
|
int zfs_dbgmsg_enable = B_TRUE;
|
|
|
|
void
|
|
zfs_dbgmsg_init(void)
|
|
{
|
|
list_create(&zfs_dbgmsgs, sizeof (zfs_dbgmsg_t),
|
|
offsetof(zfs_dbgmsg_t, zdm_node));
|
|
mutex_init(&zfs_dbgmsgs_lock, NULL, MUTEX_DEFAULT, NULL);
|
|
}
|
|
|
|
void
|
|
zfs_dbgmsg_fini(void)
|
|
{
|
|
zfs_dbgmsg_t *zdm;
|
|
while ((zdm = list_remove_head(&zfs_dbgmsgs)))
|
|
umem_free(zdm, zdm->zdm_size);
|
|
mutex_destroy(&zfs_dbgmsgs_lock);
|
|
}
|
|
|
|
void
|
|
__set_error(const char *file, const char *func, int line, int err)
|
|
{
|
|
if (zfs_flags & ZFS_DEBUG_SET_ERROR)
|
|
__dprintf(B_FALSE, file, func, line, "error %lu",
|
|
(ulong_t)err);
|
|
}
|
|
|
|
void
|
|
__zfs_dbgmsg(char *buf)
|
|
{
|
|
uint_t size = sizeof (zfs_dbgmsg_t) + strlen(buf) + 1;
|
|
zfs_dbgmsg_t *zdm = umem_zalloc(size, KM_SLEEP);
|
|
zdm->zdm_size = size;
|
|
zdm->zdm_timestamp = gethrestime_sec();
|
|
strcpy(zdm->zdm_msg, buf);
|
|
|
|
mutex_enter(&zfs_dbgmsgs_lock);
|
|
list_insert_tail(&zfs_dbgmsgs, zdm);
|
|
mutex_exit(&zfs_dbgmsgs_lock);
|
|
}
|
|
|
|
void
|
|
zfs_dbgmsg_print(int fd, const char *tag)
|
|
{
|
|
ssize_t ret __attribute__((unused));
|
|
|
|
mutex_enter(&zfs_dbgmsgs_lock);
|
|
|
|
/*
|
|
* We use write() in this function instead of printf()
|
|
* so it is safe to call from a signal handler.
|
|
*/
|
|
ret = write(fd, "ZFS_DBGMSG(", 11);
|
|
ret = write(fd, tag, strlen(tag));
|
|
ret = write(fd, ") START:\n", 9);
|
|
|
|
for (zfs_dbgmsg_t *zdm = list_head(&zfs_dbgmsgs); zdm != NULL;
|
|
zdm = list_next(&zfs_dbgmsgs, zdm)) {
|
|
ret = write(fd, zdm->zdm_msg, strlen(zdm->zdm_msg));
|
|
ret = write(fd, "\n", 1);
|
|
}
|
|
|
|
ret = write(fd, "ZFS_DBGMSG(", 11);
|
|
ret = write(fd, tag, strlen(tag));
|
|
ret = write(fd, ") END\n", 6);
|
|
|
|
mutex_exit(&zfs_dbgmsgs_lock);
|
|
}
|