+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
+LTTNG_TRACEPOINT_ENUM(block_rq_type,
+ TP_ENUM_VALUES(
+ ctf_enum_value("RWBS_FLAG_WRITE", RWBS_FLAG_WRITE)
+ ctf_enum_value("RWBS_FLAG_DISCARD", RWBS_FLAG_DISCARD)
+ ctf_enum_value("RWBS_FLAG_READ", RWBS_FLAG_READ)
+ ctf_enum_value("RWBS_FLAG_RAHEAD", RWBS_FLAG_RAHEAD)
+ ctf_enum_value("RWBS_FLAG_BARRIER", RWBS_FLAG_BARRIER)
+ ctf_enum_value("RWBS_FLAG_SYNC", RWBS_FLAG_SYNC)
+ ctf_enum_value("RWBS_FLAG_META", RWBS_FLAG_META)
+ ctf_enum_value("RWBS_FLAG_SECURE", RWBS_FLAG_SECURE)
+ ctf_enum_value("RWBS_FLAG_FLUSH", RWBS_FLAG_FLUSH)
+ ctf_enum_value("RWBS_FLAG_FUA", RWBS_FLAG_FUA)
+ ctf_enum_value("RWBS_FLAG_PREFLUSH", RWBS_FLAG_PREFLUSH)
+ )
+)
+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,8,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
+ LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
+
+#define lttng_req_op(rq) req_op(rq)
+#define lttng_req_rw(rq) ((rq)->cmd_flags)
+#define lttng_bio_op(bio) bio_op(bio)
+#define lttng_bio_rw(bio) ((bio)->bi_opf)
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_enum(block_rq_type, type, rwbs, \
+ ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
+ ( 0 )))))) \
+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
+#else
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_integer(type, rwbs, \
+ ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
+ ( 0 )))))) \
+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
+#else
+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_enum(block_rq_type, type, rwbs, \
+ (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
+ ( 0 )))))) \
+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
+#else
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_integer(type, rwbs, \
+ (((op) == REQ_OP_WRITE || (op) == REQ_OP_WRITE_SAME) ? RWBS_FLAG_WRITE : \
+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
+ ( 0 )))))) \
+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
+#endif
+
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
+
+#define lttng_req_op(rq)
+#define lttng_req_rw(rq) ((rq)->cmd_flags)
+#define lttng_bio_op(bio)
+#define lttng_bio_rw(bio) ((bio)->bi_rw)
+
+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
+ ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
+ ( (bytes) ? RWBS_FLAG_READ : \
+ ( 0 )))) \
+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
+ | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
+ | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
+#else
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
+ ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD : \
+ ( (bytes) ? RWBS_FLAG_READ : \
+ ( 0 )))) \
+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
+ | ((rw) & REQ_SECURE ? RWBS_FLAG_SECURE : 0) \
+ | ((rw) & REQ_FLUSH ? RWBS_FLAG_FLUSH : 0) \
+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
+
+#else
+
+#define lttng_req_op(rq)
+#define lttng_req_rw(rq) ((rq)->cmd_flags)
+#define lttng_bio_op(bio)
+#define lttng_bio_rw(bio) ((bio)->bi_rw)
+
+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \