@@ -2109,64 +2109,52 @@ static void zfcp_fsf_update_lat(struct fsf_latency_record *lat_rec, u32 lat)
21092109 lat_rec -> max = max (lat_rec -> max , lat );
21102110}
21112111
2112- static void zfcp_fsf_req_latency (struct zfcp_fsf_req * req )
2112+ static void zfcp_fsf_req_trace (struct zfcp_fsf_req * req , struct scsi_cmnd * scsi )
21132113{
2114- struct fsf_qual_latency_info * lat_inf ;
2115- struct latency_cont * lat ;
2114+ struct fsf_qual_latency_info * lat_in ;
2115+ struct latency_cont * lat = NULL ;
21162116 struct zfcp_unit * unit = req -> unit ;
2117+ struct zfcp_blk_drv_data blktrc ;
2118+ int ticks = req -> adapter -> timer_ticks ;
21172119
2118- lat_inf = & req -> qtcb -> prefix .prot_status_qual .latency_info ;
2120+ lat_in = & req -> qtcb -> prefix .prot_status_qual .latency_info ;
21192121
2120- switch (req -> qtcb -> bottom .io .data_direction ) {
2121- case FSF_DATADIR_READ :
2122- lat = & unit -> latencies .read ;
2123- break ;
2124- case FSF_DATADIR_WRITE :
2125- lat = & unit -> latencies .write ;
2126- break ;
2127- case FSF_DATADIR_CMND :
2128- lat = & unit -> latencies .cmd ;
2129- break ;
2130- default :
2131- return ;
2132- }
2133-
2134- spin_lock (& unit -> latencies .lock );
2135- zfcp_fsf_update_lat (& lat -> channel , lat_inf -> channel_lat );
2136- zfcp_fsf_update_lat (& lat -> fabric , lat_inf -> fabric_lat );
2137- lat -> counter ++ ;
2138- spin_unlock (& unit -> latencies .lock );
2139- }
2140-
2141- #ifdef CONFIG_BLK_DEV_IO_TRACE
2142- static void zfcp_fsf_trace_latency (struct zfcp_fsf_req * fsf_req )
2143- {
2144- struct fsf_qual_latency_info * lat_inf ;
2145- struct scsi_cmnd * scsi_cmnd = (struct scsi_cmnd * )fsf_req -> data ;
2146- struct request * req = scsi_cmnd -> request ;
2147- struct zfcp_blk_drv_data trace ;
2148- int ticks = fsf_req -> adapter -> timer_ticks ;
2122+ blktrc .flags = 0 ;
2123+ blktrc .magic = ZFCP_BLK_DRV_DATA_MAGIC ;
2124+ if (req -> status & ZFCP_STATUS_FSFREQ_ERROR )
2125+ blktrc .flags |= ZFCP_BLK_REQ_ERROR ;
2126+ blktrc .inb_usage = req -> queue_req .qdio_inb_usage ;
2127+ blktrc .outb_usage = req -> queue_req .qdio_outb_usage ;
2128+
2129+ if (req -> adapter -> adapter_features & FSF_FEATURE_MEASUREMENT_DATA ) {
2130+ blktrc .flags |= ZFCP_BLK_LAT_VALID ;
2131+ blktrc .channel_lat = lat_in -> channel_lat * ticks ;
2132+ blktrc .fabric_lat = lat_in -> fabric_lat * ticks ;
2133+
2134+ switch (req -> qtcb -> bottom .io .data_direction ) {
2135+ case FSF_DATADIR_READ :
2136+ lat = & unit -> latencies .read ;
2137+ break ;
2138+ case FSF_DATADIR_WRITE :
2139+ lat = & unit -> latencies .write ;
2140+ break ;
2141+ case FSF_DATADIR_CMND :
2142+ lat = & unit -> latencies .cmd ;
2143+ break ;
2144+ }
21492145
2150- trace . flags = 0 ;
2151- trace . magic = ZFCP_BLK_DRV_DATA_MAGIC ;
2152- if ( fsf_req -> adapter -> adapter_features & FSF_FEATURE_MEASUREMENT_DATA ) {
2153- trace . flags |= ZFCP_BLK_LAT_VALID ;
2154- lat_inf = & fsf_req -> qtcb -> prefix . prot_status_qual . latency_info ;
2155- trace . channel_lat = lat_inf -> channel_lat * ticks ;
2156- trace . fabric_lat = lat_inf -> fabric_lat * ticks ;
2146+ if ( lat ) {
2147+ spin_lock ( & unit -> latencies . lock ) ;
2148+ zfcp_fsf_update_lat ( & lat -> channel , lat_in -> channel_lat );
2149+ zfcp_fsf_update_lat ( & lat -> fabric , lat_in -> fabric_lat ) ;
2150+ lat -> counter ++ ;
2151+ spin_unlock ( & unit -> latencies . lock ) ;
2152+ }
21572153 }
2158- if (fsf_req -> status & ZFCP_STATUS_FSFREQ_ERROR )
2159- trace .flags |= ZFCP_BLK_REQ_ERROR ;
2160- trace .inb_usage = fsf_req -> queue_req .qdio_inb_usage ;
2161- trace .outb_usage = fsf_req -> queue_req .qdio_outb_usage ;
21622154
2163- blk_add_driver_data (req -> q , req , & trace , sizeof (trace ));
2164- }
2165- #else
2166- static inline void zfcp_fsf_trace_latency (struct zfcp_fsf_req * fsf_req )
2167- {
2155+ blk_add_driver_data (scsi -> request -> q , scsi -> request , & blktrc ,
2156+ sizeof (blktrc ));
21682157}
2169- #endif
21702158
21712159static void zfcp_fsf_send_fcp_command_task_handler (struct zfcp_fsf_req * req )
21722160{
@@ -2199,10 +2187,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
21992187
22002188 scpnt -> result |= fcp_rsp_iu -> scsi_status ;
22012189
2202- if (req -> adapter -> adapter_features & FSF_FEATURE_MEASUREMENT_DATA )
2203- zfcp_fsf_req_latency (req );
2204-
2205- zfcp_fsf_trace_latency (req );
2190+ zfcp_fsf_req_trace (req , scpnt );
22062191
22072192 if (unlikely (fcp_rsp_iu -> validity .bits .fcp_rsp_len_valid )) {
22082193 if (fcp_rsp_info [3 ] == RSP_CODE_GOOD )
0 commit comments