Skip to content

events: include zio type in IO error reports #17381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12070,6 +12070,11 @@ zpool_do_events_nvprint(nvlist_t *nvl, int depth)
zfs_valstr_zio_stage(i32, flagstr,
sizeof (flagstr));
printf(gettext("0x%x [%s]"), i32, flagstr);
} else if (strcmp(name,
FM_EREPORT_PAYLOAD_ZFS_ZIO_TYPE) == 0) {
zfs_valstr_zio_type(i32, flagstr,
sizeof (flagstr));
printf(gettext("0x%x [%s]"), i32, flagstr);
} else if (strcmp(name,
FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY) == 0) {
zfs_valstr_zio_priority(i32, flagstr,
Expand Down
1 change: 1 addition & 0 deletions include/sys/fm/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ extern "C" {
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_FLAGS "zio_flags"
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_STAGE "zio_stage"
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY "zio_priority"
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_TYPE "zio_type"
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_PIPELINE "zio_pipeline"
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_DELAY "zio_delay"
#define FM_EREPORT_PAYLOAD_ZFS_ZIO_TIMESTAMP "zio_timestamp"
Expand Down
1 change: 1 addition & 0 deletions include/zfs_valstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ extern "C" {
_ZFS_VALSTR_DECLARE_BITFIELD(zio_flag)
_ZFS_VALSTR_DECLARE_BITFIELD(zio_stage)

_ZFS_VALSTR_DECLARE_ENUM(zio_type)
_ZFS_VALSTR_DECLARE_ENUM(zio_priority)

#undef _ZFS_VALSTR_DECLARE_BITFIELD
Expand Down
7 changes: 7 additions & 0 deletions lib/libzfs/libzfs.abi
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@
<elf-symbol name='zfs_valstr_zio_stage' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_valstr_zio_stage_bits' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_valstr_zio_stage_pairs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_valstr_zio_type' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_version_kernel' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_version_nvlist' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_version_print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
Expand Down Expand Up @@ -10080,6 +10081,12 @@
<parameter type-id='b59d7dce' name='outlen'/>
<return type-id='b59d7dce'/>
</function-decl>
<function-decl name='zfs_valstr_zio_type' mangled-name='zfs_valstr_zio_type' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_type'>
<parameter type-id='95e97e5e' name='v'/>
<parameter type-id='26a90f95' name='out'/>
<parameter type-id='b59d7dce' name='outlen'/>
<return type-id='b59d7dce'/>
</function-decl>
<function-decl name='zfs_valstr_zio_priority' mangled-name='zfs_valstr_zio_priority' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_priority'>
<parameter type-id='95e97e5e' name='v'/>
<parameter type-id='26a90f95' name='out'/>
Expand Down
59 changes: 57 additions & 2 deletions man/man8/zpool-events.8
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
.\" Copyright 2017 Nexenta Systems, Inc.
.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
.\" Copyright (c) 2024, Klara Inc.
.\" Copyright (c) 2024, 2025, Klara, Inc.
.\"
.Dd February 28, 2024
.Dd May 27, 2025
.Dt ZPOOL-EVENTS 8
.Os
.
Expand Down Expand Up @@ -308,6 +308,16 @@ The valid pipeline stages for the I/O.
See the
.Sy I/O STAGES
section for a full list of all the I/O stages.
.It Sy zio_priority
The queue priority of the I/O request.
See the
.Sy I/O PRIORITIES
section for a full list of all the I/O priorities.
.It Sy zio_tyoe
The type of the I/O request.
See the
.Sy I/O TYPES
section for a full list of all the I/O types.
.It Sy zio_delay
The time elapsed (in nanoseconds) waiting for the block layer to complete the
I/O request.
Expand Down Expand Up @@ -477,6 +487,51 @@ ZIO_FLAG_DELEGATED:0x40000000
ZIO_FLAG_FASTWRITE:0x80000000
.TE
.
.Sh I/O TYPES
Every I/O request in the pipeline has a single type value.
This value describes the kind of low-level work the I/O represents.
This value will be set in an event as a
.Sy zio_type
payload entry.
.Pp
.TS
tab(:);
l l l .
Type:Value:Description
_:_:_
ZIO_TYPE_NULL:0x0:internal I/O sync point
ZIO_TYPE_READ:0x1:data read
ZIO_TYPE_WRITE:0x2:data write
ZIO_TYPE_FREE:0x3:block free
ZIO_TYPE_CLAIM:0x4:block claim (ZIL replay)
ZIO_TYPE_FLUSH:0x5:disk cache flush request
ZIO_TYPE_TRIM:0x6:trim (discard)
.TE
.
.Sh I/O PRIORITIES
Every I/O request in the pipeline has a single priority value.
This value is used by the queuing code to decide which I/O to issue next.
This value will be set in an event as a
.Sy zio_priority
payload entry.
.Pp
.TS
tab(:);
l l l .
Type:Value:Description
_:_:_
ZIO_PRIORITY_SYNC_READ:0x0:
ZIO_PRIORITY_SYNC_WRITE:0x1:ZIL
ZIO_PRIORITY_ASYNC_READ:0x2:prefetch
ZIO_PRIORITY_ASYNC_WRITE:0x3:spa_sync()
ZIO_PRIORITY_SCRUB:0x4:asynchronous scrub/resilver reads
ZIO_PRIORITY_REMOVAL:0x5:reads/writes for vdev removal
ZIO_PRIORITY_INITIALIZING:0x6:initializing I/O
ZIO_PRIORITY_TRIM:0x7:trim I/O (discard)
ZIO_PRIORITY_REBUILD:0x8:reads/writes for vdev rebuild
ZIO_PRIORITY_NOW:0xa:non-queued i/os (e.g. free)
.TE
.
.Sh SEE ALSO
.Xr zfs 4 ,
.Xr zed 8 ,
Expand Down
11 changes: 11 additions & 0 deletions module/zcommon/zfs_valstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,17 @@ _VALSTR_BITFIELD_IMPL(zio_stage,
{ 'X', "X ", "DONE" },
)

/* ZIO type: zio_type_t, typically zio->io_type */
_VALSTR_ENUM_IMPL(zio_type,
"NULL",
"READ",
"WRITE",
"FREE",
"CLAIM",
"FLUSH",
"TRIM",
)

/* ZIO priority: zio_priority_t, typically zio->io_priority */
_VALSTR_ENUM_IMPL(zio_priority,
"SYNC_READ",
Expand Down
2 changes: 2 additions & 0 deletions module/zfs/zfs_fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out,
DATA_TYPE_UINT64, zio->io_timestamp, NULL);
fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_ZIO_DELTA,
DATA_TYPE_UINT64, zio->io_delta, NULL);
fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_ZIO_TYPE,
DATA_TYPE_UINT32, zio->io_type, NULL);
fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY,
DATA_TYPE_UINT32, zio->io_priority, NULL);

Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/cmd/ereports.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static const char *const criteria_name[] = {
FM_EREPORT_PAYLOAD_ZFS_ZIO_ERR,
FM_EREPORT_PAYLOAD_ZFS_ZIO_SIZE,
FM_EREPORT_PAYLOAD_ZFS_ZIO_OFFSET,
FM_EREPORT_PAYLOAD_ZFS_ZIO_TYPE,
FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY,

/* logical zio criteriai (optional) */
Expand Down