zinject: make iotype extendable

I'm about to add a new "type", and I need somewhere to put it!

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16947
This commit is contained in:
Rob Norris
2025-01-08 17:14:33 +11:00
committed by Ameer Hamza
parent cf55fdea24
commit 0dfcfe023e
3 changed files with 79 additions and 29 deletions
+18
View File
@@ -456,6 +456,24 @@ typedef enum zinject_type {
ZINJECT_DELAY_EXPORT,
} zinject_type_t;
typedef enum zinject_iotype {
/*
* Compatibility: zi_iotype used to be set to ZIO_TYPE_, so make sure
* the corresponding ZINJECT_IOTYPE_ matches. Note that existing here
* does not mean that injections are possible for all these types.
*/
ZINJECT_IOTYPE_NULL = ZIO_TYPE_NULL,
ZINJECT_IOTYPE_READ = ZIO_TYPE_READ,
ZINJECT_IOTYPE_WRITE = ZIO_TYPE_WRITE,
ZINJECT_IOTYPE_FREE = ZIO_TYPE_FREE,
ZINJECT_IOTYPE_CLAIM = ZIO_TYPE_CLAIM,
ZINJECT_IOTYPE_FLUSH = ZIO_TYPE_FLUSH,
ZINJECT_IOTYPE_TRIM = ZIO_TYPE_TRIM,
ZINJECT_IOTYPE_ALL = ZIO_TYPES,
/* Room for future expansion for ZIO_TYPE_* */
ZINJECT_IOTYPES = 16,
} zinject_iotype_t;
typedef struct zfs_share {
uint64_t z_exportdata;
uint64_t z_sharedata;