Skip to content

Commit

Permalink
scsi: fc: Use bsg_destroy_job
Browse files Browse the repository at this point in the history
fc_destroy_bsgjob() and bsg_destroy_job() are now 1:1 copies, so use the
latter. As bsg_destroy_job() comes from bsg-lib we need to select it in
Kconfig once CONFOG_SCSI_FC_ATTRS is active.

Signed-off-by: Johannes Thumshirn <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
Johannes Thumshirn authored and martinkpetersen committed Nov 18, 2016
1 parent 75cc8cf commit c00da4c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 24 deletions.
7 changes: 5 additions & 2 deletions block/bsg-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@
* bsg_destroy_job - routine to teardown/delete a bsg job
* @job: bsg_job that is to be torn down
*/
static void bsg_destroy_job(struct kref *kref)
void bsg_destroy_job(struct kref *kref)
{
struct bsg_job *job = container_of(kref, struct bsg_job, kref);
struct request *rq = job->req;

blk_end_request_all(rq, rq->errors);

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

kfree(job->request_payload.sg_list);
kfree(job->reply_payload.sg_list);
kfree(job);
}
EXPORT_SYMBOL_GPL(bsg_destroy_job);

/**
* bsg_job_done - completion routine for bsg requests
Expand Down Expand Up @@ -85,7 +89,6 @@ static void bsg_softirq_done(struct request *rq)
{
struct bsg_job *job = rq->special;

blk_end_request_all(rq, rq->errors);
kref_put(&job->kref, bsg_destroy_job);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ config SCSI_SPI_ATTRS
config SCSI_FC_ATTRS
tristate "FiberChannel Transport Attributes"
depends on SCSI && NET
select BLK_DEV_BSGLIB
select SCSI_NETLINK
help
If you wish to export transport-specific information about
Expand Down
25 changes: 3 additions & 22 deletions drivers/scsi/scsi_transport_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/bsg-lib.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
Expand Down Expand Up @@ -3554,26 +3555,6 @@ fc_vport_sched_delete(struct work_struct *work)
* BSG support
*/


/**
* fc_destroy_bsgjob - routine to teardown/delete a fc bsg job
* @job: fc_bsg_job that is to be torn down
*/
static void
fc_destroy_bsgjob(struct kref *kref)
{
struct bsg_job *job = container_of(kref, struct bsg_job, kref);
struct request *rq = job->req;

blk_end_request_all(rq, rq->errors);

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

kfree(job->request_payload.sg_list);
kfree(job->reply_payload.sg_list);
kfree(job);
}

/**
* fc_bsg_jobdone - completion routine for bsg requests that the LLD has
* completed
Expand Down Expand Up @@ -3617,7 +3598,7 @@ static void fc_bsg_softirq_done(struct request *rq)
{
struct bsg_job *job = rq->special;

kref_put(&job->kref, fc_destroy_bsgjob);
kref_put(&job->kref, bsg_destroy_job);
}

/**
Expand All @@ -3642,7 +3623,7 @@ fc_bsg_job_timeout(struct request *req)
/* call LLDD to abort the i/o as it has timed out */
err = i->f->bsg_timeout(job);
if (err == -EAGAIN) {
kref_put(&job->kref, fc_destroy_bsgjob);
kref_put(&job->kref, bsg_destroy_job);
return BLK_EH_RESET_TIMER;
} else if (err)
printk(KERN_ERR "ERROR: FC BSG request timeout - LLD "
Expand Down
1 change: 1 addition & 0 deletions include/linux/bsg-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ void bsg_job_done(struct bsg_job *job, int result,
int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name,
bsg_job_fn *job_fn, int dd_job_size);
void bsg_request_fn(struct request_queue *q);
void bsg_destroy_job(struct kref *kref);

#endif

0 comments on commit c00da4c

Please sign in to comment.