zinject: count matches and injections for each handler
commit2aa3fbe761a2f38c1fe743467635b1323bebe093
authorRob Norris <rob.norris@klarasystems.com>
Mon, 13 Jan 2025 13:33:31 +0000 (14 00:33 +1100)
committerGitHub <noreply@github.com>
Mon, 13 Jan 2025 13:33:31 +0000 (13 08:33 -0500)
treeac76c474e429c9e9038e13b9733461285ca6c07a
parentfae4c664a4a67f51d13520ab432d96315d880af8
zinject: count matches and injections for each handler

When building tests with zinject, it can be quite difficult to work out
if you're producing the right kind of IO to match the rules you've set
up.

So, here we extend injection records to count the number of times a
handler matched the operation, and how often an error was actually
injected (ie after frequency and other exclusions are applied).

Then, display those counts in the `zinject` output.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #16938
cmd/zinject/zinject.c
include/sys/zfs_ioctl.h
module/zfs/zio_inject.c
tests/runfiles/common.run
tests/zfs-tests/tests/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zinject/zinject_counts.ksh [new file with mode: 0755]