@@ -46,19 +46,12 @@ static inline struct nvmet_ctrl *nvmet_req_to_ctrl(struct nvmet_req *req)
4646 return req -> sq -> ctrl ;
4747}
4848
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 )
5150{
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 );
6255}
6356#endif
6457
@@ -81,7 +74,7 @@ TRACE_EVENT(nvmet_req_init,
8174 TP_fast_assign (
8275 __entry -> cmd = cmd ;
8376 __entry -> ctrl = nvmet_req_to_ctrl (req );
84- __assign_disk_name (__entry -> disk , req , true );
77+ __assign_req_name (__entry -> disk , req );
8578 __entry -> qid = req -> sq -> qid ;
8679 __entry -> cid = cmd -> common .command_id ;
8780 __entry -> opcode = cmd -> common .opcode ;
@@ -121,7 +114,7 @@ TRACE_EVENT(nvmet_req_complete,
121114 __entry -> cid = req -> cqe -> command_id ;
122115 __entry -> result = le64_to_cpu (req -> cqe -> result .u64 );
123116 __entry -> status = le16_to_cpu (req -> cqe -> status ) >> 1 ;
124- __assign_disk_name (__entry -> disk , req , false );
117+ __assign_req_name (__entry -> disk , req );
125118 ),
126119 TP_printk ("nvmet%s: %sqid=%d, cmdid=%u, res=%#llx, status=%#x" ,
127120 __print_ctrl_name (__entry -> ctrl ),
0 commit comments