Skip to contentSkip to conversation

block: Add ioprio to block_rq tracepoint

PATCH In review Dongliang Cui 2 participants 2 messages Dec 26, 2023 – Jan 22, 2024 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Add ioprio to block_rq tracepoint

Sometimes we need to track the processing order of requests with ioprio set, especially when using mq-deadline. So the ioprio of request can be useful information.

---
 include/trace/events/block.h | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
include/trace/events/block.h +14 -6
index 0e128ad..e84ff93 100644
@@ -82,6 +82,7 @@
 		__field(  dev_t,	dev			)
 		__field(  sector_t,	sector			)
 		__field(  unsigned int,	nr_sector		)
+		__field(  unsigned int, ioprio			)
 		__array(  char,		rwbs,	RWBS_LEN	)
 		__dynamic_array( char,	cmd,	1		)
 	),
@@ -90,16 +91,17 @@
 		__entry->dev	   = rq->q->disk ? disk_devt(rq->q->disk) : 0;
 		__entry->sector    = blk_rq_trace_sector(rq);
 		__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
+		__entry->ioprio    = rq->ioprio;
 
 		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 	),
 
-	TP_printk("%d,%d %s (%s) %llu + %u [%d]",
+	TP_printk("%d,%d %s (%s) %llu + %u 0x%x [%d]",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  __entry->rwbs, __get_str(cmd),
 		  (unsigned long long)__entry->sector,
-		  __entry->nr_sector, 0)
+		  __entry->nr_sector, __entry->ioprio, 0)
 );
 
 DECLARE_EVENT_CLASS(block_rq_completion,
@@ -112,6 +114,7 @@
 		__field(  dev_t,	dev			)
 		__field(  sector_t,	sector			)
 		__field(  unsigned int,	nr_sector		)
+		__field(  unsigned int, ioprio			)
 		__field(  int	,	error			)
 		__array(  char,		rwbs,	RWBS_LEN	)
 		__dynamic_array( char,	cmd,	1		)
@@ -121,17 +124,19 @@
 		__entry->dev	   = rq->q->disk ? disk_devt(rq->q->disk) : 0;
 		__entry->sector    = blk_rq_pos(rq);
 		__entry->nr_sector = nr_bytes >> 9;
+		__entry->ioprio    = rq->ioprio;
 		__entry->error     = blk_status_to_errno(error);
 
 		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 	),
 
-	TP_printk("%d,%d %s (%s) %llu + %u [%d]",
+	TP_printk("%d,%d %s (%s) %llu + %u 0x%x [%d]",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  __entry->rwbs, __get_str(cmd),
 		  (unsigned long long)__entry->sector,
-		  __entry->nr_sector, __entry->error)
+		  __entry->nr_sector, __entry->ioprio,
+		  __entry->error)
 );
 
 /**
@@ -180,6 +185,7 @@
 		__field(  sector_t,	sector			)
 		__field(  unsigned int,	nr_sector		)
 		__field(  unsigned int,	bytes			)
+		__field(  unsigned int, ioprio			)
 		__array(  char,		rwbs,	RWBS_LEN	)
 		__array(  char,         comm,   TASK_COMM_LEN   )
 		__dynamic_array( char,	cmd,	1		)
@@ -190,17 +196,19 @@
 		__entry->sector    = blk_rq_trace_sector(rq);
 		__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
 		__entry->bytes     = blk_rq_bytes(rq);
+		__entry->ioprio    = rq->ioprio;
 
 		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
 
-	TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
+	TP_printk("%d,%d %s %u (%s) %llu + %u 0x%x [%s]",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  __entry->rwbs, __entry->bytes, __get_str(cmd),
 		  (unsigned long long)__entry->sector,
-		  __entry->nr_sector, __entry->comm)
+		  __entry->nr_sector, __entry->ioprio,
+		  __entry->comm)
 );
 
 /**
Signature · 1 line
1.9.1
#1 lore raw

Hi,

Can this submission be uploaded,or is there anything that needs to be modified?

Quoted 106 lines · Dongliang Cui

Sometimes we need to track the processing order of requests with ioprio set, especially when using mq-deadline. So the ioprio of request can be useful information.

---
 include/trace/events/block.h | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
include/trace/events/block.h +14 -7
index 0e128ad..e84ff93 100644
@@ -82,6 +82,7 @@
                __field(  dev_t,        dev                     )
                __field(  sector_t,     sector                  )
                __field(  unsigned int, nr_sector               )
+               __field(  unsigned int, ioprio                  )
                __array(  char,         rwbs,   RWBS_LEN        )
                __dynamic_array( char,  cmd,    1               )
        ),
@@ -90,16 +91,17 @@
                __entry->dev       = rq->q->disk ? disk_devt(rq->q->disk) : 0;
                __entry->sector    = blk_rq_trace_sector(rq);
                __entry->nr_sector = blk_rq_trace_nr_sectors(rq);
+               __entry->ioprio    = rq->ioprio;
 
                blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
                __get_str(cmd)[0] = '\0';
        ),
 
-       TP_printk("%d,%d %s (%s) %llu + %u [%d]",
+       TP_printk("%d,%d %s (%s) %llu + %u 0x%x [%d]",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->rwbs, __get_str(cmd),
                  (unsigned long long)__entry->sector,
-                 __entry->nr_sector, 0)
+                 __entry->nr_sector, __entry->ioprio, 0)
 );
 
 DECLARE_EVENT_CLASS(block_rq_completion,
@@ -112,6 +114,7 @@
                __field(  dev_t,        dev                     )
                __field(  sector_t,     sector                  )
                __field(  unsigned int, nr_sector               )
+               __field(  unsigned int, ioprio                  )
                __field(  int   ,       error                   )
                __array(  char,         rwbs,   RWBS_LEN        )
                __dynamic_array( char,  cmd,    1               )
@@ -121,17 +124,19 @@
                __entry->dev       = rq->q->disk ? disk_devt(rq->q->disk) : 0;
                __entry->sector    = blk_rq_pos(rq);
                __entry->nr_sector = nr_bytes >> 9;
+               __entry->ioprio    = rq->ioprio;
                __entry->error     = blk_status_to_errno(error);
 
                blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
                __get_str(cmd)[0] = '\0';
        ),
 
-       TP_printk("%d,%d %s (%s) %llu + %u [%d]",
+       TP_printk("%d,%d %s (%s) %llu + %u 0x%x [%d]",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->rwbs, __get_str(cmd),
                  (unsigned long long)__entry->sector,
-                 __entry->nr_sector, __entry->error)
+                 __entry->nr_sector, __entry->ioprio,
+                 __entry->error)
 );
 
 /**
@@ -180,6 +185,7 @@
                __field(  sector_t,     sector                  )
                __field(  unsigned int, nr_sector               )
                __field(  unsigned int, bytes                   )
+               __field(  unsigned int, ioprio                  )
                __array(  char,         rwbs,   RWBS_LEN        )
                __array(  char,         comm,   TASK_COMM_LEN   )
                __dynamic_array( char,  cmd,    1               )
@@ -190,17 +196,19 @@
                __entry->sector    = blk_rq_trace_sector(rq);
                __entry->nr_sector = blk_rq_trace_nr_sectors(rq);
                __entry->bytes     = blk_rq_bytes(rq);
+               __entry->ioprio    = rq->ioprio;
 
                blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
                __get_str(cmd)[0] = '\0';
                memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
        ),
 
-       TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
+       TP_printk("%d,%d %s %u (%s) %llu + %u 0x%x [%s]",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
                  __entry->rwbs, __entry->bytes, __get_str(cmd),
                  (unsigned long long)__entry->sector,
-                 __entry->nr_sector, __entry->comm)
+                 __entry->nr_sector, __entry->ioprio,
+                 __entry->comm)
 );
 
 /**
--

1.9.1