@@ -46,19 +46,12 @@ static inline struct nvmet_ctrl *nvmet_req_to_ctrl(struct nvmet_req *req)
46
46
return req -> sq -> ctrl ;
47
47
}
48
48
49
- static inline void __assign_disk_name (char * name , struct nvmet_req * req ,
50
- bool init )
49
+ static inline void __assign_req_name (char * name , struct nvmet_req * req )
51
50
{
52
- struct nvmet_ctrl * ctrl = nvmet_req_to_ctrl (req );
53
- struct nvmet_ns * ns ;
54
-
55
- if ((init && req -> sq -> qid ) || (!init && req -> cq -> qid )) {
56
- ns = nvmet_find_namespace (ctrl , req -> cmd -> rw .nsid );
57
- strncpy (name , ns -> device_path , DISK_NAME_LEN );
58
- return ;
59
- }
60
-
61
- memset (name , 0 , DISK_NAME_LEN );
51
+ if (req -> ns )
52
+ strncpy (name , req -> ns -> device_path , DISK_NAME_LEN );
53
+ else
54
+ memset (name , 0 , DISK_NAME_LEN );
62
55
}
63
56
#endif
64
57
@@ -81,7 +74,7 @@ TRACE_EVENT(nvmet_req_init,
81
74
TP_fast_assign (
82
75
__entry -> cmd = cmd ;
83
76
__entry -> ctrl = nvmet_req_to_ctrl (req );
84
- __assign_disk_name (__entry -> disk , req , true );
77
+ __assign_req_name (__entry -> disk , req );
85
78
__entry -> qid = req -> sq -> qid ;
86
79
__entry -> cid = cmd -> common .command_id ;
87
80
__entry -> opcode = cmd -> common .opcode ;
@@ -121,7 +114,7 @@ TRACE_EVENT(nvmet_req_complete,
121
114
__entry -> cid = req -> cqe -> command_id ;
122
115
__entry -> result = le64_to_cpu (req -> cqe -> result .u64 );
123
116
__entry -> status = le16_to_cpu (req -> cqe -> status ) >> 1 ;
124
- __assign_disk_name (__entry -> disk , req , false );
117
+ __assign_req_name (__entry -> disk , req );
125
118
),
126
119
TP_printk ("nvmet%s: %sqid=%d, cmdid=%u, res=%#llx, status=%#x" ,
127
120
__print_ctrl_name (__entry -> ctrl ),
0 commit comments