1 /* SPDX-License-Identifier: GPL-2.0 */
3 * null_blk device driver tracepoints.
5 * Copyright (C) 2020 Western Digital Corporation or its affiliates.
9 #define TRACE_SYSTEM nullb
11 #if !defined(_TRACE_NULLB_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_NULLB_H
14 #include <linux/tracepoint.h>
15 #include <linux/trace_seq.h>
19 const char *nullb_trace_disk_name(struct trace_seq
*p
, char *name
);
21 #define __print_disk_name(name) nullb_trace_disk_name(p, name)
23 #ifndef TRACE_HEADER_MULTI_READ
24 static inline void __assign_disk_name(char *name
, struct gendisk
*disk
)
27 memcpy(name
, disk
->disk_name
, DISK_NAME_LEN
);
29 memset(name
, 0, DISK_NAME_LEN
);
33 TRACE_EVENT(nullb_zone_op
,
34 TP_PROTO(struct nullb_cmd
*cmd
, unsigned int zone_no
,
35 unsigned int zone_cond
),
36 TP_ARGS(cmd
, zone_no
, zone_cond
),
38 __array(char, disk
, DISK_NAME_LEN
)
40 * __field() uses is_signed_type(). is_signed_type() does not
41 * support bitwise types. Use __field_struct() instead because
42 * it does not use is_signed_type().
44 __field_struct(enum req_op
, op
)
45 __field(unsigned int, zone_no
)
46 __field(unsigned int, zone_cond
)
49 __entry
->op
= req_op(blk_mq_rq_from_pdu(cmd
));
50 __entry
->zone_no
= zone_no
;
51 __entry
->zone_cond
= zone_cond
;
52 __assign_disk_name(__entry
->disk
,
53 blk_mq_rq_from_pdu(cmd
)->q
->disk
);
55 TP_printk("%s req=%-15s zone_no=%u zone_cond=%-10s",
56 __print_disk_name(__entry
->disk
),
57 blk_op_str(__entry
->op
),
59 blk_zone_cond_str(__entry
->zone_cond
))
62 TRACE_EVENT(nullb_report_zones
,
63 TP_PROTO(struct nullb
*nullb
, unsigned int nr_zones
),
64 TP_ARGS(nullb
, nr_zones
),
66 __array(char, disk
, DISK_NAME_LEN
)
67 __field(unsigned int, nr_zones
)
70 __entry
->nr_zones
= nr_zones
;
71 __assign_disk_name(__entry
->disk
, nullb
->disk
);
73 TP_printk("%s nr_zones=%u",
74 __print_disk_name(__entry
->disk
), __entry
->nr_zones
)
77 #endif /* _TRACE_NULLB_H */
79 #undef TRACE_INCLUDE_PATH
80 #define TRACE_INCLUDE_PATH .
81 #undef TRACE_INCLUDE_FILE
82 #define TRACE_INCLUDE_FILE trace
84 /* This part must be outside protection */
85 #include <trace/define_trace.h>