]> git.proxmox.com Git - mirror_zfs.git/commitdiff
value strings: pretty printers for flags and enums
authorRob Norris <rob.norris@klarasystems.com>
Thu, 29 Feb 2024 00:25:24 +0000 (11:25 +1100)
committerTony Hutter <hutter2@llnl.gov>
Thu, 5 Sep 2024 20:40:05 +0000 (13:40 -0700)
This adds zfs_valstr, a collection of pretty printers for bitfields and
enums. These are useful in debugging, logging and other display contexts
where raw values are difficult for the untrained (or even trained!) eye
to decipher.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
include/Makefile.am
include/sys/zio.h
include/sys/zio_impl.h
include/sys/zio_priority.h
include/zfs_valstr.h [new file with mode: 0644]
lib/libzfs/Makefile.am
lib/libzfs/libzfs.abi
lib/libzpool/Makefile.am
module/Kbuild.in
module/Makefile.bsd
module/zcommon/zfs_valstr.c [new file with mode: 0644]

index fa725c2e7a5f894a4a37df837a67618a3d9533ef..f173064efc99b35fb42509ee9c7d63a8697c7027 100644 (file)
@@ -14,6 +14,7 @@ COMMON_H = \
        zfs_fletcher.h \
        zfs_namecheck.h \
        zfs_prop.h \
+       zfs_valstr.h \
        \
        sys/abd.h \
        sys/abd_impl.h \
index 446b64ccd8ab529fdb2e60edddf3bcba6204ef33..3a756949a422b5456f84315b03ac33081427c2cf 100644 (file)
@@ -167,6 +167,9 @@ typedef enum zio_suspend_reason {
  * This was originally an enum type. However, those are 32-bit and there is no
  * way to make a 64-bit enum type. Since we ran out of bits for flags, we were
  * forced to upgrade it to a uint64_t.
+ *
+ * NOTE: PLEASE UPDATE THE BITFIELD STRINGS IN zfs_valstr.c IF YOU ADD ANOTHER
+ * FLAG.
  */
 typedef uint64_t zio_flag_t;
        /*
index 2b026d48675af2547514afc7fd7c4ef195384e6c..2c846a5d41f6d3a9933416242225a3cbef70d098 100644 (file)
@@ -120,6 +120,9 @@ extern "C" {
 
 /*
  * zio pipeline stage definitions
+ *
+ * NOTE: PLEASE UPDATE THE BITFIELD STRINGS IN zfs_valstr.c IF YOU ADD ANOTHER
+ * FLAG.
  */
 enum zio_stage {
        ZIO_STAGE_OPEN                  = 1 << 0,       /* RWFCXT */
index 2d8e7fc36bae6f833caa739515a28ac705a68a52..bdf5f9b8ff352ae07fc7455bdce8918f560f53f5 100644 (file)
 extern "C" {
 #endif
 
+/*
+ * NOTE: PLEASE UPDATE THE ENUM STRINGS IN zfs_valstr.c IF YOU ADD ANOTHER
+ * VALUE.
+ */
 typedef enum zio_priority {
        ZIO_PRIORITY_SYNC_READ,
        ZIO_PRIORITY_SYNC_WRITE,        /* ZIL */
diff --git a/include/zfs_valstr.h b/include/zfs_valstr.h
new file mode 100644 (file)
index 0000000..77c26ce
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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) 2024, Klara Inc.
+ */
+
+#ifndef        _ZFS_VALSTR_H
+#define        _ZFS_VALSTR_H extern __attribute__((visibility("default")))
+
+#include <sys/fs/zfs.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * These macros create function prototypes for pretty-printing or stringifying
+ * certain kinds of numeric types.
+ *
+ * _ZFS_VALSTR_DECLARE_BITFIELD(name) creates:
+ *
+ *   size_t zfs_valstr_<name>_bits(uint64_t bits, char *out, size_t outlen);
+ *     expands single char for each set bit, and space for each clear bit
+ *
+ *   size_t zfs_valstr_<name>_pairs(uint64_t bits, char *out, size_t outlen);
+ *     expands two-char mnemonic for each bit set in `bits`, separated by `|`
+ *
+ *   size_t zfs_valstr_<name>(uint64_t bits, char *out, size_t outlen);
+ *     expands full name of each bit set in `bits`, separated by spaces
+ *
+ * _ZFS_VALSTR_DECLARE_ENUM(name) creates:
+ *
+ *   size_t zfs_valstr_<name>(int v, char *out, size_t outlen);
+ *     expands full name of enum value
+ *
+ * Each _ZFS_VALSTR_DECLARE_xxx needs a corresponding _VALSTR_xxx_IMPL string
+ * table in vfs_valstr.c.
+ */
+
+#define        _ZFS_VALSTR_DECLARE_BITFIELD(name)                      \
+       _ZFS_VALSTR_H size_t zfs_valstr_ ## name ## _bits(      \
+           uint64_t bits, char *out, size_t outlen);           \
+       _ZFS_VALSTR_H size_t zfs_valstr_ ## name ## _pairs(     \
+           uint64_t bits, char *out, size_t outlen);           \
+       _ZFS_VALSTR_H size_t zfs_valstr_ ## name(               \
+           uint64_t bits, char *out, size_t outlen);           \
+
+#define        _ZFS_VALSTR_DECLARE_ENUM(name)                          \
+       _ZFS_VALSTR_H size_t zfs_valstr_ ## name(               \
+           int v, char *out, size_t outlen);                   \
+
+_ZFS_VALSTR_DECLARE_BITFIELD(zio_flag)
+_ZFS_VALSTR_DECLARE_BITFIELD(zio_stage)
+
+_ZFS_VALSTR_DECLARE_ENUM(zio_priority)
+
+#undef _ZFS_VALSTR_DECLARE_BITFIELD
+#undef _ZFS_VALSTR_DECLARE_ENUM
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZFS_VALSTR_H */
index 5e74d908de3d260eff56470734fce831ba070c7e..a976faaf9913e969559fde7a3e3be5947554b473 100644 (file)
@@ -47,6 +47,7 @@ nodist_libzfs_la_SOURCES = \
        module/zcommon/zfs_fletcher_superscalar4.c \
        module/zcommon/zfs_namecheck.c \
        module/zcommon/zfs_prop.c \
+       module/zcommon/zfs_valstr.c \
        module/zcommon/zpool_prop.c \
        module/zcommon/zprop_common.c
 
index 88dd8b3c679d927d3a34d7e3e38b10a5ba7b75f0..51b29643ee0ce139ccc880ff4aca9486a21fec8b 100644 (file)
     <elf-symbol name='zfs_userns' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
     <elf-symbol name='zfs_userspace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
     <elf-symbol name='zfs_valid_proplist' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='zfs_valstr_zio_flag' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='zfs_valstr_zio_flag_bits' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='zfs_valstr_zio_flag_pairs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='zfs_valstr_zio_priority' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <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_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'/>
       <return type-id='c19b74c3'/>
     </function-decl>
   </abi-instr>
+  <abi-instr address-size='64' path='module/zcommon/zfs_valstr.c' language='LANG_C99'>
+    <function-decl name='zfs_valstr_zio_flag' mangled-name='zfs_valstr_zio_flag' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_flag'>
+      <parameter type-id='9c313c2d' name='bits'/>
+      <parameter type-id='26a90f95' name='out'/>
+      <parameter type-id='b59d7dce' name='outlen'/>
+      <return type-id='b59d7dce'/>
+    </function-decl>
+    <function-decl name='zfs_valstr_zio_flag_bits' mangled-name='zfs_valstr_zio_flag_bits' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_flag_bits'>
+      <parameter type-id='9c313c2d' name='bits'/>
+      <parameter type-id='26a90f95' name='out'/>
+      <parameter type-id='b59d7dce' name='outlen'/>
+      <return type-id='b59d7dce'/>
+    </function-decl>
+    <function-decl name='zfs_valstr_zio_flag_pairs' mangled-name='zfs_valstr_zio_flag_pairs' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_flag_pairs'>
+      <parameter type-id='9c313c2d' name='bits'/>
+      <parameter type-id='26a90f95' name='out'/>
+      <parameter type-id='b59d7dce' name='outlen'/>
+      <return type-id='b59d7dce'/>
+    </function-decl>
+    <function-decl name='zfs_valstr_zio_stage' mangled-name='zfs_valstr_zio_stage' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_stage'>
+      <parameter type-id='9c313c2d' name='bits'/>
+      <parameter type-id='26a90f95' name='out'/>
+      <parameter type-id='b59d7dce' name='outlen'/>
+      <return type-id='b59d7dce'/>
+    </function-decl>
+    <function-decl name='zfs_valstr_zio_stage_bits' mangled-name='zfs_valstr_zio_stage_bits' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_stage_bits'>
+      <parameter type-id='9c313c2d' name='bits'/>
+      <parameter type-id='26a90f95' name='out'/>
+      <parameter type-id='b59d7dce' name='outlen'/>
+      <return type-id='b59d7dce'/>
+    </function-decl>
+    <function-decl name='zfs_valstr_zio_stage_pairs' mangled-name='zfs_valstr_zio_stage_pairs' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_stage_pairs'>
+      <parameter type-id='9c313c2d' name='bits'/>
+      <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'/>
+      <parameter type-id='b59d7dce' name='outlen'/>
+      <return type-id='b59d7dce'/>
+    </function-decl>
+  </abi-instr>
   <abi-instr address-size='64' path='module/zcommon/zpool_prop.c' language='LANG_C99'>
     <function-decl name='zpool_prop_string_to_index' mangled-name='zpool_prop_string_to_index' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zpool_prop_string_to_index'>
       <parameter type-id='5d0c23fb' name='prop'/>
index 81949bf9e5b81166568d84d4940ec59e6b747885..ff30af7d2b9ffa1bf2326e681238d16ffc00e6f6 100644 (file)
@@ -64,6 +64,7 @@ nodist_libzpool_la_SOURCES = \
        module/zcommon/zfs_fletcher_superscalar4.c \
        module/zcommon/zfs_namecheck.c \
        module/zcommon/zfs_prop.c \
+       module/zcommon/zfs_valstr.c \
        module/zcommon/zpool_prop.c \
        module/zcommon/zprop_common.c \
        \
index a119198dbfc00b8ee647274e75b7aa42791f1fd7..0472a9348c13b8a0938c3eb47f0a4e107ae7a853 100644 (file)
@@ -240,6 +240,7 @@ ZCOMMON_OBJS := \
        zfs_fletcher_superscalar4.o \
        zfs_namecheck.o \
        zfs_prop.o \
+       zfs_valstr.o \
        zpool_prop.o \
        zprop_common.o
 
index 534f3257132a4282569d87198e87195dbb93bb66..9161204c99d3ba63d12008e195d62049e308bde2 100644 (file)
@@ -233,6 +233,7 @@ SRCS+=      cityhash.c \
        zfs_fletcher_superscalar.c \
        zfs_namecheck.c \
        zfs_prop.c \
+       zfs_valstr.c \
        zpool_prop.c \
        zprop_common.c
 
diff --git a/module/zcommon/zfs_valstr.c b/module/zcommon/zfs_valstr.c
new file mode 100644 (file)
index 0000000..e2d4d1a
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * 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) 2024, Klara Inc.
+ */
+
+#include <sys/fs/zfs.h>
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+#include <sys/string.h>
+#include <sys/debug.h>
+#include "zfs_valstr.h"
+
+/*
+ * Each bit in a bitfield has three possible string representations:
+ * - single char
+ * - two-char pair
+ * - full name
+ */
+typedef struct {
+       const char      vb_bit;
+       const char      vb_pair[2];
+       const char      *vb_name;
+} valstr_bit_t;
+
+/*
+ * Emits a character for each bit in `bits`, up to the number of elements
+ * in the table. Set bits get the character in vb_bit, clear bits get a
+ * space. This results in all strings having the same width, for easier
+ * visual comparison.
+ */
+static size_t
+valstr_bitfield_bits(const valstr_bit_t *table, const size_t nelems,
+    uint64_t bits, char *out, size_t outlen)
+{
+       ASSERT(out);
+       size_t n = 0;
+       for (int b = 0; b < nelems; b++) {
+               if (n == outlen)
+                       break;
+               uint64_t mask = (1ULL << b);
+               out[n++] = (bits & mask) ? table[b].vb_bit : ' ';
+       }
+       if (n < outlen)
+               out[n++] = '\0';
+       return (n);
+}
+
+/*
+ * Emits a two-char pair for each bit set in `bits`, taken from vb_pair, and
+ * separated by a `|` character. This gives a concise representation of the
+ * whole value.
+ */
+static size_t
+valstr_bitfield_pairs(const valstr_bit_t *table, const size_t nelems,
+    uint64_t bits, char *out, size_t outlen)
+{
+       ASSERT(out);
+       size_t n = 0;
+       for (int b = 0; b < nelems; b++) {
+               ASSERT3U(n, <=, outlen);
+               if (n == outlen)
+                       break;
+               uint64_t mask = (1ULL << b);
+               if (bits & mask) {
+                       size_t len = (n > 0) ? 3 : 2;
+                       if (n > outlen-len)
+                               break;
+                       if (n > 0)
+                               out[n++] = '|';
+                       out[n++] = table[b].vb_pair[0];
+                       out[n++] = table[b].vb_pair[1];
+               }
+       }
+       if (n < outlen)
+               out[n++] = '\0';
+       return (n);
+}
+
+/*
+ * Emits the full name for each bit set in `bits`, taken from vb_name, and
+ * separated by a space. This unambiguously shows the entire set of bits, but
+ * can get very long.
+ */
+static size_t
+valstr_bitfield_str(const valstr_bit_t *table, const size_t nelems,
+    uint64_t bits, char *out, size_t outlen)
+{
+       ASSERT(out);
+       size_t n = 0;
+       for (int b = 0; b < nelems; b++) {
+               ASSERT3U(n, <=, outlen);
+               if (n == outlen)
+                       break;
+               uint64_t mask = (1ULL << b);
+               if (bits & mask) {
+                       size_t len = strlen(table[b].vb_name);
+                       if (n > 0)
+                               len++;
+                       if (n > outlen-len)
+                               break;
+                       if (n > 0) {
+                               out[n++] = ' ';
+                               len--;
+                       }
+                       memcpy(&out[n], table[b].vb_name, len);
+                       n += len;
+               }
+       }
+       if (n < outlen)
+               out[n++] = '\0';
+       return (n);
+}
+
+/*
+ * Emits the name of the given enum value in the table.
+ */
+static size_t
+valstr_enum_str(const char **table, const size_t nelems,
+    int v, char *out, size_t outlen)
+{
+       ASSERT(out);
+       ASSERT3U(v, <, nelems);
+       if (v >= nelems)
+               return (0);
+       return (MIN(strlcpy(out, table[v], outlen), outlen));
+}
+
+/*
+ * These macros create the string tables for the given name, and implement
+ * the public functions described in zfs_valstr.h.
+ */
+#define        _VALSTR_BITFIELD_IMPL(name, ...)                                \
+static const valstr_bit_t valstr_ ## name ## _table[] = { __VA_ARGS__ };\
+size_t                                                                 \
+zfs_valstr_ ## name ## _bits(uint64_t bits, char *out, size_t outlen)  \
+{                                                                      \
+       return (valstr_bitfield_bits(valstr_ ## name ## _table,         \
+           ARRAY_SIZE(valstr_ ## name ## _table), bits, out, outlen)); \
+}                                                                      \
+                                                                       \
+size_t                                                                 \
+zfs_valstr_ ## name ## _pairs(uint64_t bits, char *out, size_t outlen) \
+{                                                                      \
+       return (valstr_bitfield_pairs(valstr_ ## name ## _table,        \
+           ARRAY_SIZE(valstr_ ## name ## _table), bits, out, outlen)); \
+}                                                                      \
+                                                                       \
+size_t                                                                 \
+zfs_valstr_ ## name(uint64_t bits, char *out, size_t outlen)           \
+{                                                                      \
+       return (valstr_bitfield_str(valstr_ ## name ## _table,          \
+           ARRAY_SIZE(valstr_ ## name ## _table), bits, out, outlen)); \
+}                                                                      \
+
+#define        _VALSTR_ENUM_IMPL(name, ...)                                    \
+static const char *valstr_ ## name ## _table[] = { __VA_ARGS__ };      \
+size_t                                                                 \
+zfs_valstr_ ## name(int v, char *out, size_t outlen)                   \
+{                                                                      \
+       return (valstr_enum_str(valstr_ ## name ## _table,              \
+           ARRAY_SIZE(valstr_ ## name ## _table), v, out, outlen));    \
+}                                                                      \
+
+
+/* String tables */
+
+/* ZIO flags: zio_flag_t, typically zio->io_flags */
+/* BEGIN CSTYLED */
+_VALSTR_BITFIELD_IMPL(zio_flag,
+       { '.', "DA", "DONT_AGGREGATE" },
+       { '.', "RP", "IO_REPAIR" },
+       { '.', "SH", "SELF_HEAL" },
+       { '.', "RS", "RESILVER" },
+       { '.', "SC", "SCRUB" },
+       { '.', "ST", "SCAN_THREAD" },
+       { '.', "PH", "PHYSICAL" },
+       { '.', "CF", "CANFAIL" },
+       { '.', "SP", "SPECULATIVE" },
+       { '.', "CW", "CONFIG_WRITER" },
+       { '.', "DR", "DONT_RETRY" },
+       { '?', "??", "[UNUSED 11]" },
+       { '.', "ND", "NODATA" },
+       { '.', "ID", "INDUCE_DAMAGE" },
+       { '.', "AL", "IO_ALLOCATING" },
+       { '.', "RE", "IO_RETRY" },
+       { '.', "PR", "PROBE" },
+       { '.', "TH", "TRYHARD" },
+       { '.', "OP", "OPTIONAL" },
+       { '.', "DQ", "DONT_QUEUE" },
+       { '.', "DP", "DONT_PROPAGATE" },
+       { '.', "BY", "IO_BYPASS" },
+       { '.', "RW", "IO_REWRITE" },
+       { '.', "CM", "RAW_COMPRESS" },
+       { '.', "EN", "RAW_ENCRYPT" },
+       { '.', "GG", "GANG_CHILD" },
+       { '.', "DD", "DDT_CHILD" },
+       { '.', "GF", "GODFATHER" },
+       { '.', "NP", "NOPWRITE" },
+       { '.', "EX", "REEXECUTED" },
+       { '.', "DG", "DELEGATED" },
+)
+/* END CSTYLED */
+
+/*
+ * ZIO pipeline stage(s): enum zio_stage, typically zio->io_stage or
+ *                        zio->io_pipeline.
+ */
+/* BEGIN CSTYLED */
+_VALSTR_BITFIELD_IMPL(zio_stage,
+       { 'O', "O ", "OPEN" },
+       { 'I', "RI", "READ_BP_INIT" },
+       { 'I', "WI", "WRITE_BP_INIT" },
+       { 'I', "FI", "FREE_BP_INIT" },
+       { 'A', "IA", "ISSUE_ASYNC" },
+       { 'W', "WC", "WRITE_COMPRESS" },
+       { 'E', "EN", "ENCRYPT" },
+       { 'C', "CG", "CHECKSUM_GENERATE" },
+       { 'N', "NW", "NOP_WRITE" },
+       { 'B', "BF", "BRT_FREE" },
+       { 'd', "dS", "DDT_READ_START" },
+       { 'd', "dD", "DDT_READ_DONE" },
+       { 'd', "dW", "DDT_WRITE" },
+       { 'd', "dF", "DDT_FREE" },
+       { 'G', "GA", "GANG_ASSEMBLE" },
+       { 'G', "GI", "GANG_ISSUE" },
+       { 'D', "DT", "DVA_THROTTLE" },
+       { 'D', "DA", "DVA_ALLOCATE" },
+       { 'D', "DF", "DVA_FREE" },
+       { 'D', "DC", "DVA_CLAIM" },
+       { 'R', "R ", "READY" },
+       { 'V', "VS", "VDEV_IO_START" },
+       { 'V', "VD", "VDEV_IO_DONE" },
+       { 'V', "VA", "VDEV_IO_ASSESS" },
+       { 'C', "CV", "CHECKSUM_VERIFY" },
+       { 'X', "X ", "DONE" },
+)
+/* END CSTYLED */
+
+/* ZIO priority: zio_priority_t, typically zio->io_priority */
+/* BEGIN CSTYLED */
+_VALSTR_ENUM_IMPL(zio_priority,
+       "SYNC_READ",
+       "SYNC_WRITE",
+       "ASYNC_READ",
+       "ASYNC_WRITE",
+       "SCRUB",
+       "REMOVAL",
+       "INITIALIZING",
+       "TRIM",
+       "REBUILD",
+       "[NUM_QUEUEABLE]",
+       "NOW",
+)
+/* END CSTYLED */
+
+#undef _VALSTR_BITFIELD_IMPL
+#undef _VALSTR_ENUM_IMPL