Skip to content

Commit

Permalink
bsg-lib: remove bsg_job.req
Browse files Browse the repository at this point in the history
Users of the bsg-lib interface should only use the bsg_job data structure
and not know about implementation details of it.

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 Jens Axboe committed Mar 13, 2018
1 parent 31156ec commit ef6fa64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 6 additions & 8 deletions block/bsg-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static void bsg_teardown_job(struct kref *kref)
{
struct bsg_job *job = container_of(kref, struct bsg_job, kref);
struct request *rq = job->req;
struct request *rq = blk_mq_rq_from_pdu(job);

put_device(job->dev); /* release reference for the request */

Expand Down Expand Up @@ -68,19 +68,18 @@ EXPORT_SYMBOL_GPL(bsg_job_get);
void bsg_job_done(struct bsg_job *job, int result,
unsigned int reply_payload_rcv_len)
{
struct request *req = job->req;
struct request *req = blk_mq_rq_from_pdu(job);
struct request *rsp = req->next_rq;
struct scsi_request *rq = scsi_req(req);
int err;

err = scsi_req(job->req)->result = result;
err = job->sreq.result = result;
if (err < 0)
/* we're only returning the result field in the reply */
rq->sense_len = sizeof(u32);
job->sreq.sense_len = sizeof(u32);
else
rq->sense_len = job->reply_len;
job->sreq.sense_len = job->reply_len;
/* we assume all request payload was transferred, residual == 0 */
rq->resid_len = 0;
job->sreq.resid_len = 0;

if (rsp) {
WARN_ON(reply_payload_rcv_len > scsi_req(rsp)->resid_len);
Expand Down Expand Up @@ -232,7 +231,6 @@ static void bsg_initialize_rq(struct request *req)
sreq->sense = sense;
sreq->sense_len = SCSI_SENSE_BUFFERSIZE;

job->req = req;
job->reply = sense;
job->reply_len = sreq->sense_len;
job->dd_data = job + 1;
Expand Down
1 change: 0 additions & 1 deletion include/linux/bsg-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ struct bsg_buffer {
struct bsg_job {
struct scsi_request sreq;
struct device *dev;
struct request *req;

struct kref kref;

Expand Down

0 comments on commit ef6fa64

Please sign in to comment.