Commit fb6f7c8d authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Martin K. Petersen

block: add bsg_job_put() and bsg_job_get()

Add bsg_job_put() and bsg_job_get() so don't need to export
bsg_destroy_job() any more.
Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 06548160
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* bsg_destroy_job - routine to teardown/delete a bsg job * bsg_destroy_job - routine to teardown/delete a bsg job
* @job: bsg_job that is to be torn down * @job: bsg_job that is to be torn down
*/ */
void bsg_destroy_job(struct kref *kref) static void bsg_destroy_job(struct kref *kref)
{ {
struct bsg_job *job = container_of(kref, struct bsg_job, kref); struct bsg_job *job = container_of(kref, struct bsg_job, kref);
struct request *rq = job->req; struct request *rq = job->req;
...@@ -45,7 +45,18 @@ void bsg_destroy_job(struct kref *kref) ...@@ -45,7 +45,18 @@ void bsg_destroy_job(struct kref *kref)
kfree(job->reply_payload.sg_list); kfree(job->reply_payload.sg_list);
kfree(job); kfree(job);
} }
EXPORT_SYMBOL_GPL(bsg_destroy_job);
void bsg_job_put(struct bsg_job *job)
{
kref_put(&job->kref, bsg_destroy_job);
}
EXPORT_SYMBOL_GPL(bsg_job_put);
int bsg_job_get(struct bsg_job *job)
{
return kref_get_unless_zero(&job->kref);
}
EXPORT_SYMBOL_GPL(bsg_job_get);
/** /**
* bsg_job_done - completion routine for bsg requests * bsg_job_done - completion routine for bsg requests
...@@ -89,7 +100,7 @@ void bsg_softirq_done(struct request *rq) ...@@ -89,7 +100,7 @@ void bsg_softirq_done(struct request *rq)
{ {
struct bsg_job *job = rq->special; struct bsg_job *job = rq->special;
kref_put(&job->kref, bsg_destroy_job); bsg_job_put(job);
} }
EXPORT_SYMBOL_GPL(bsg_softirq_done); EXPORT_SYMBOL_GPL(bsg_softirq_done);
......
...@@ -3571,13 +3571,13 @@ fc_bsg_job_timeout(struct request *req) ...@@ -3571,13 +3571,13 @@ fc_bsg_job_timeout(struct request *req)
if (rport && rport->port_state == FC_PORTSTATE_BLOCKED) if (rport && rport->port_state == FC_PORTSTATE_BLOCKED)
return BLK_EH_RESET_TIMER; return BLK_EH_RESET_TIMER;
inflight = kref_get_unless_zero(&job->kref); inflight = bsg_job_get(job);
if (inflight && i->f->bsg_timeout) { if (inflight && i->f->bsg_timeout) {
/* call LLDD to abort the i/o as it has timed out */ /* call LLDD to abort the i/o as it has timed out */
err = i->f->bsg_timeout(job); err = i->f->bsg_timeout(job);
if (err == -EAGAIN) { if (err == -EAGAIN) {
kref_put(&job->kref, bsg_destroy_job); bsg_job_put(job);
return BLK_EH_RESET_TIMER; return BLK_EH_RESET_TIMER;
} else if (err) } else if (err)
printk(KERN_ERR "ERROR: FC BSG request timeout - LLD " printk(KERN_ERR "ERROR: FC BSG request timeout - LLD "
......
...@@ -69,7 +69,8 @@ void bsg_job_done(struct bsg_job *job, int result, ...@@ -69,7 +69,8 @@ void bsg_job_done(struct bsg_job *job, int result,
int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name, int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name,
bsg_job_fn *job_fn, int dd_job_size); bsg_job_fn *job_fn, int dd_job_size);
void bsg_request_fn(struct request_queue *q); void bsg_request_fn(struct request_queue *q);
void bsg_destroy_job(struct kref *kref);
void bsg_softirq_done(struct request *rq); void bsg_softirq_done(struct request *rq);
void bsg_job_put(struct bsg_job *job);
int __must_check bsg_job_get(struct bsg_job *job);
#endif #endif
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