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 <h...@lst.de>
Reviewed-by: Benjamin Block <bbl...@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <h...@suse.com>
Reviewed-by: Johannes Thumshirn <jthumsh...@suse.de>
---
 block/bsg-lib.c             | 1 +
 drivers/s390/scsi/zfcp_fc.c | 4 ++--
 include/linux/bsg-lib.h     | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index b4fe1a48f111..fb509779a090 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -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;
 
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index ca218c82321f..6162cf57a20a 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -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,
@@ -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);
 
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index b1be0233ce35..402223c95ce1 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -44,6 +44,8 @@ struct bsg_job {
 
        struct kref kref;
 
+       unsigned int timeout;
+
        /* Transport/driver specific request/reply structs */
        void *request;
        void *reply;
-- 
2.14.2

Reply via email to