Skip to content

Commit a694b08

Browse files
committed
Merge branch 'for-6.11/block' into for-next
* for-6.11/block: block: Add ioprio to block_rq tracepoint
2 parents a37b8c0 + aa6ff4e commit a694b08

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

include/trace/events/block.h

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@
99
#include <linux/blkdev.h>
1010
#include <linux/buffer_head.h>
1111
#include <linux/tracepoint.h>
12+
#include <uapi/linux/ioprio.h>
1213

1314
#define RWBS_LEN 8
1415

16+
#define IOPRIO_CLASS_STRINGS \
17+
{ IOPRIO_CLASS_NONE, "none" }, \
18+
{ IOPRIO_CLASS_RT, "rt" }, \
19+
{ IOPRIO_CLASS_BE, "be" }, \
20+
{ IOPRIO_CLASS_IDLE, "idle" }, \
21+
{ IOPRIO_CLASS_INVALID, "invalid"}
22+
1523
#ifdef CONFIG_BUFFER_HEAD
1624
DECLARE_EVENT_CLASS(block_buffer,
1725

@@ -82,6 +90,7 @@ TRACE_EVENT(block_rq_requeue,
8290
__field( dev_t, dev )
8391
__field( sector_t, sector )
8492
__field( unsigned int, nr_sector )
93+
__field( unsigned short, ioprio )
8594
__array( char, rwbs, RWBS_LEN )
8695
__dynamic_array( char, cmd, 1 )
8796
),
@@ -90,16 +99,20 @@ TRACE_EVENT(block_rq_requeue,
9099
__entry->dev = rq->q->disk ? disk_devt(rq->q->disk) : 0;
91100
__entry->sector = blk_rq_trace_sector(rq);
92101
__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
102+
__entry->ioprio = rq->ioprio;
93103

94104
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
95105
__get_str(cmd)[0] = '\0';
96106
),
97107

98-
TP_printk("%d,%d %s (%s) %llu + %u [%d]",
108+
TP_printk("%d,%d %s (%s) %llu + %u %s,%u,%u [%d]",
99109
MAJOR(__entry->dev), MINOR(__entry->dev),
100110
__entry->rwbs, __get_str(cmd),
101-
(unsigned long long)__entry->sector,
102-
__entry->nr_sector, 0)
111+
(unsigned long long)__entry->sector, __entry->nr_sector,
112+
__print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio),
113+
IOPRIO_CLASS_STRINGS),
114+
IOPRIO_PRIO_HINT(__entry->ioprio),
115+
IOPRIO_PRIO_LEVEL(__entry->ioprio), 0)
103116
);
104117

105118
DECLARE_EVENT_CLASS(block_rq_completion,
@@ -113,6 +126,7 @@ DECLARE_EVENT_CLASS(block_rq_completion,
113126
__field( sector_t, sector )
114127
__field( unsigned int, nr_sector )
115128
__field( int , error )
129+
__field( unsigned short, ioprio )
116130
__array( char, rwbs, RWBS_LEN )
117131
__dynamic_array( char, cmd, 1 )
118132
),
@@ -122,16 +136,20 @@ DECLARE_EVENT_CLASS(block_rq_completion,
122136
__entry->sector = blk_rq_pos(rq);
123137
__entry->nr_sector = nr_bytes >> 9;
124138
__entry->error = blk_status_to_errno(error);
139+
__entry->ioprio = rq->ioprio;
125140

126141
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
127142
__get_str(cmd)[0] = '\0';
128143
),
129144

130-
TP_printk("%d,%d %s (%s) %llu + %u [%d]",
145+
TP_printk("%d,%d %s (%s) %llu + %u %s,%u,%u [%d]",
131146
MAJOR(__entry->dev), MINOR(__entry->dev),
132147
__entry->rwbs, __get_str(cmd),
133-
(unsigned long long)__entry->sector,
134-
__entry->nr_sector, __entry->error)
148+
(unsigned long long)__entry->sector, __entry->nr_sector,
149+
__print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio),
150+
IOPRIO_CLASS_STRINGS),
151+
IOPRIO_PRIO_HINT(__entry->ioprio),
152+
IOPRIO_PRIO_LEVEL(__entry->ioprio), __entry->error)
135153
);
136154

137155
/**
@@ -180,6 +198,7 @@ DECLARE_EVENT_CLASS(block_rq,
180198
__field( sector_t, sector )
181199
__field( unsigned int, nr_sector )
182200
__field( unsigned int, bytes )
201+
__field( unsigned short, ioprio )
183202
__array( char, rwbs, RWBS_LEN )
184203
__array( char, comm, TASK_COMM_LEN )
185204
__dynamic_array( char, cmd, 1 )
@@ -190,17 +209,21 @@ DECLARE_EVENT_CLASS(block_rq,
190209
__entry->sector = blk_rq_trace_sector(rq);
191210
__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
192211
__entry->bytes = blk_rq_bytes(rq);
212+
__entry->ioprio = rq->ioprio;
193213

194214
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
195215
__get_str(cmd)[0] = '\0';
196216
memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
197217
),
198218

199-
TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
219+
TP_printk("%d,%d %s %u (%s) %llu + %u %s,%u,%u [%s]",
200220
MAJOR(__entry->dev), MINOR(__entry->dev),
201221
__entry->rwbs, __entry->bytes, __get_str(cmd),
202-
(unsigned long long)__entry->sector,
203-
__entry->nr_sector, __entry->comm)
222+
(unsigned long long)__entry->sector, __entry->nr_sector,
223+
__print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio),
224+
IOPRIO_CLASS_STRINGS),
225+
IOPRIO_PRIO_HINT(__entry->ioprio),
226+
IOPRIO_PRIO_LEVEL(__entry->ioprio), __entry->comm)
204227
);
205228

206229
/**

0 commit comments

Comments
 (0)