Thread (2 messages) 2 messages, 2 authors, 2024-01-22

Re: [PATCH] block: Add ioprio to block_rq tracepoint

flat view

From: dongliang cui <hidden>
Date: 2024-01-22 07:16:36
Also in: lkml

Hi,

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

On Tue, Dec 26, 2023 at 10:10 AM Dongliang Cui [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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.

Signed-off-by: Dongliang Cui <redacted>
---
 include/trace/events/block.h | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 0e128ad..e84ff93 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help