Skip to content

Commit

Permalink
bsg-lib: introduce a timeout field in struct bsg_job
Browse files Browse the repository at this point in the history
The zfcp driver wants to know the timeout for a bsg job, so add a field
to struct bsg_job for it in preparation of not exposing the request
to the bsg-lib users.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and axboe committed Mar 13, 2018
1 parent ce3077e commit 31156ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions block/bsg-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static int bsg_prepare_job(struct device *dev, struct request *req)
struct bsg_job *job = blk_mq_rq_to_pdu(req);
int ret;

job->timeout = req->timeout;
job->request = rq->cmd;
job->request_len = rq->cmd_len;

Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/scsi/zfcp_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ static int zfcp_fc_exec_els_job(struct bsg_job *job,
d_id = ntoh24(bsg_request->rqst_data.h_els.port_id);

els->handler = zfcp_fc_ct_els_job_handler;
return zfcp_fsf_send_els(adapter, d_id, els, job->req->timeout / HZ);
return zfcp_fsf_send_els(adapter, d_id, els, job->timeout / HZ);
}

static int zfcp_fc_exec_ct_job(struct bsg_job *job,
Expand All @@ -980,7 +980,7 @@ static int zfcp_fc_exec_ct_job(struct bsg_job *job,
return ret;

ct->handler = zfcp_fc_ct_job_handler;
ret = zfcp_fsf_send_ct(wka_port, ct, NULL, job->req->timeout / HZ);
ret = zfcp_fsf_send_ct(wka_port, ct, NULL, job->timeout / HZ);
if (ret)
zfcp_fc_wka_port_put(wka_port);

Expand Down
2 changes: 2 additions & 0 deletions include/linux/bsg-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct bsg_job {

struct kref kref;

unsigned int timeout;

/* Transport/driver specific request/reply structs */
void *request;
void *reply;
Expand Down

0 comments on commit 31156ec

Please sign in to comment.