Commit d9742b42 authored by Christof Schmitt's avatar Christof Schmitt Committed by James Bottomley

[SCSI] zfcp: Merge trace code for fsf requests in one function

The latencies traced per fsf request are traced for sysfs output and
for blktrace, each in one function. Simplify the tracing code by
merging both tracing functions into one.
Reviewed-by: default avatarSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 25458eb7
...@@ -2109,64 +2109,52 @@ static void zfcp_fsf_update_lat(struct fsf_latency_record *lat_rec, u32 lat) ...@@ -2109,64 +2109,52 @@ static void zfcp_fsf_update_lat(struct fsf_latency_record *lat_rec, u32 lat)
lat_rec->max = max(lat_rec->max, lat); lat_rec->max = max(lat_rec->max, lat);
} }
static void zfcp_fsf_req_latency(struct zfcp_fsf_req *req) static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
{ {
struct fsf_qual_latency_info *lat_inf; struct fsf_qual_latency_info *lat_in;
struct latency_cont *lat; struct latency_cont *lat = NULL;
struct zfcp_unit *unit = req->unit; struct zfcp_unit *unit = req->unit;
struct zfcp_blk_drv_data blktrc;
int ticks = req->adapter->timer_ticks;
lat_inf = &req->qtcb->prefix.prot_status_qual.latency_info; lat_in = &req->qtcb->prefix.prot_status_qual.latency_info;
switch (req->qtcb->bottom.io.data_direction) { blktrc.flags = 0;
case FSF_DATADIR_READ: blktrc.magic = ZFCP_BLK_DRV_DATA_MAGIC;
lat = &unit->latencies.read; if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
break; blktrc.flags |= ZFCP_BLK_REQ_ERROR;
case FSF_DATADIR_WRITE: blktrc.inb_usage = req->queue_req.qdio_inb_usage;
lat = &unit->latencies.write; blktrc.outb_usage = req->queue_req.qdio_outb_usage;
break;
case FSF_DATADIR_CMND: if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) {
lat = &unit->latencies.cmd; blktrc.flags |= ZFCP_BLK_LAT_VALID;
break; blktrc.channel_lat = lat_in->channel_lat * ticks;
default: blktrc.fabric_lat = lat_in->fabric_lat * ticks;
return;
} switch (req->qtcb->bottom.io.data_direction) {
case FSF_DATADIR_READ:
spin_lock(&unit->latencies.lock); lat = &unit->latencies.read;
zfcp_fsf_update_lat(&lat->channel, lat_inf->channel_lat); break;
zfcp_fsf_update_lat(&lat->fabric, lat_inf->fabric_lat); case FSF_DATADIR_WRITE:
lat->counter++; lat = &unit->latencies.write;
spin_unlock(&unit->latencies.lock); break;
} case FSF_DATADIR_CMND:
lat = &unit->latencies.cmd;
#ifdef CONFIG_BLK_DEV_IO_TRACE break;
static void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req) }
{
struct fsf_qual_latency_info *lat_inf;
struct scsi_cmnd *scsi_cmnd = (struct scsi_cmnd *)fsf_req->data;
struct request *req = scsi_cmnd->request;
struct zfcp_blk_drv_data trace;
int ticks = fsf_req->adapter->timer_ticks;
trace.flags = 0; if (lat) {
trace.magic = ZFCP_BLK_DRV_DATA_MAGIC; spin_lock(&unit->latencies.lock);
if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) { zfcp_fsf_update_lat(&lat->channel, lat_in->channel_lat);
trace.flags |= ZFCP_BLK_LAT_VALID; zfcp_fsf_update_lat(&lat->fabric, lat_in->fabric_lat);
lat_inf = &fsf_req->qtcb->prefix.prot_status_qual.latency_info; lat->counter++;
trace.channel_lat = lat_inf->channel_lat * ticks; spin_unlock(&unit->latencies.lock);
trace.fabric_lat = lat_inf->fabric_lat * ticks; }
} }
if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)
trace.flags |= ZFCP_BLK_REQ_ERROR;
trace.inb_usage = fsf_req->queue_req.qdio_inb_usage;
trace.outb_usage = fsf_req->queue_req.qdio_outb_usage;
blk_add_driver_data(req->q, req, &trace, sizeof(trace)); blk_add_driver_data(scsi->request->q, scsi->request, &blktrc,
} sizeof(blktrc));
#else
static inline void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req)
{
} }
#endif
static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
{ {
...@@ -2199,10 +2187,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) ...@@ -2199,10 +2187,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
scpnt->result |= fcp_rsp_iu->scsi_status; scpnt->result |= fcp_rsp_iu->scsi_status;
if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) zfcp_fsf_req_trace(req, scpnt);
zfcp_fsf_req_latency(req);
zfcp_fsf_trace_latency(req);
if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) { if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) {
if (fcp_rsp_info[3] == RSP_CODE_GOOD) if (fcp_rsp_info[3] == RSP_CODE_GOOD)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment