-#define __print_rwbs_flags(rwbs) \
- __print_flags(rwbs, "", \
- { RWBS_FLAG_FLUSH, "F" }, \
- { RWBS_FLAG_WRITE, "W" }, \
- { RWBS_FLAG_DISCARD, "D" }, \
- { RWBS_FLAG_READ, "R" }, \
- { RWBS_FLAG_FUA, "F" }, \
- { RWBS_FLAG_RAHEAD, "A" }, \
- { RWBS_FLAG_BARRIER, "B" }, \
- { RWBS_FLAG_SYNC, "S" }, \
- { RWBS_FLAG_META, "M" }, \
- { RWBS_FLAG_SECURE, "E" })
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
-
-#define blk_fill_rwbs(rwbs, rw, bytes) \
- tp_assign(rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,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)
+
+#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))
+
+#elif (LINUX_VERSION_CODE >= 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)
+
+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
+ ctf_integer(type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \