fix: block: remove the error argument to the block_bio_complete (v5.8)
[lttng-modules.git] / instrumentation / events / lttng-module / block.h
index 9f77526db0aaec415cf82f017a35d4fbb90ccaee..748a5c8510bf6be686dd3f562aa3a577c18bdd48 100644 (file)
@@ -34,6 +34,22 @@ enum {
 
 #endif /* _TRACE_BLOCK_DEF_ */
 
+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)
+       )
+)
+
 #if (LINUX_VERSION_CODE >= 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) || \
@@ -49,7 +65,7 @@ enum {
 #define lttng_bio_rw(bio)      ((bio)->bi_opf)
 
 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes)                              \
-               ctf_integer(type, rwbs,                                       \
+               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) : \
@@ -70,7 +86,7 @@ enum {
 #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 :     \
+               ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE : \
                        ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD :            \
                        ( (bytes) ? RWBS_FLAG_READ :                          \
                        ( 0 ))))                                              \
@@ -89,7 +105,7 @@ enum {
 #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 :     \
+               ctf_enum(block_rq_type, type, rwbs, ((rw) & WRITE ? RWBS_FLAG_WRITE :     \
                        ( (rw) & REQ_DISCARD ? RWBS_FLAG_DISCARD :            \
                        ( (bytes) ? RWBS_FLAG_READ :                          \
                        ( 0 ))))                                              \
@@ -607,6 +623,34 @@ LTTNG_TRACEPOINT_EVENT(block_bio_bounce,
        )
 )
 
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
+/**
+ * block_bio_complete - completed all work on the block operation
+ * @q: queue holding the block operation
+ * @bio: block operation completed
+ * @error: io error value
+ *
+ * This tracepoint indicates there is no further work to do on this
+ * block IO operation @bio.
+ */
+LTTNG_TRACEPOINT_EVENT(block_bio_complete,
+
+       TP_PROTO(struct request_queue *q, struct bio *bio),
+
+       TP_ARGS(q, bio),
+
+       TP_FIELDS(
+               ctf_integer(dev_t, dev, bio_dev(bio))
+               ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
+               ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
+               ctf_integer(int, error, blk_status_to_errno(bio->bi_status))
+               blk_rwbs_ctf_integer(unsigned int, rwbs,
+                       lttng_bio_op(bio), lttng_bio_rw(bio),
+                       bio->bi_iter.bi_size)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
 /**
  * block_bio_complete - completed all work on the block operation
  * @q: queue holding the block operation
@@ -623,27 +667,67 @@ LTTNG_TRACEPOINT_EVENT(block_bio_complete,
        TP_ARGS(q, bio, error),
 
        TP_FIELDS(
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
                ctf_integer(dev_t, dev, bio_dev(bio))
-#else
+               ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
+               ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
+               ctf_integer(int, error, error)
+               blk_rwbs_ctf_integer(unsigned int, rwbs,
+                       lttng_bio_op(bio), lttng_bio_rw(bio),
+                       bio->bi_iter.bi_size)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
+/**
+ * block_bio_complete - completed all work on the block operation
+ * @q: queue holding the block operation
+ * @bio: block operation completed
+ * @error: io error value
+ *
+ * This tracepoint indicates there is no further work to do on this
+ * block IO operation @bio.
+ */
+LTTNG_TRACEPOINT_EVENT(block_bio_complete,
+
+       TP_PROTO(struct request_queue *q, struct bio *bio, int error),
+
+       TP_ARGS(q, bio, error),
+
+       TP_FIELDS(
                ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
                ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
                ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
                ctf_integer(int, error, error)
                blk_rwbs_ctf_integer(unsigned int, rwbs,
                        lttng_bio_op(bio), lttng_bio_rw(bio),
                        bio->bi_iter.bi_size)
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
+       )
+)
+#else
+/**
+ * block_bio_complete - completed all work on the block operation
+ * @q: queue holding the block operation
+ * @bio: block operation completed
+ * @error: io error value
+ *
+ * This tracepoint indicates there is no further work to do on this
+ * block IO operation @bio.
+ */
+LTTNG_TRACEPOINT_EVENT(block_bio_complete,
+
+       TP_PROTO(struct request_queue *q, struct bio *bio, int error),
+
+       TP_ARGS(q, bio, error),
+
+       TP_FIELDS(
+               ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev)
                ctf_integer(sector_t, sector, bio->bi_sector)
                ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9)
                ctf_integer(int, error, error)
                blk_rwbs_ctf_integer(unsigned int, rwbs,
                        lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_size)
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */
        )
 )
+#endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
 LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge,
This page took 0.025628 seconds and 4 git commands to generate.