Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213338
b: refs/heads/master
c: 78d1634
h: refs/heads/master
v: v3
  • Loading branch information
James Smart authored and James Bottomley committed Sep 9, 2010
1 parent 8434371 commit c80bcae
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 91978465b1e5f89025cd43cd2102943160ec6dee
refs/heads/master: 78d16341facf829a71b6f7c68ec5511b9c168060
43 changes: 43 additions & 0 deletions trunk/drivers/scsi/scsi_transport_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4048,11 +4048,54 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)
/**
* fc_bsg_remove - Deletes the bsg hooks on fchosts/rports
* @q: the request_queue that is to be torn down.
*
* Notes:
* Before unregistering the queue empty any requests that are blocked
*
*
*/
static void
fc_bsg_remove(struct request_queue *q)
{
struct request *req; /* block request */
int counts; /* totals for request_list count and starved */

if (q) {
/* Stop taking in new requests */
spin_lock_irq(q->queue_lock);
blk_stop_queue(q);

/* drain all requests in the queue */
while (1) {
/* need the lock to fetch a request
* this may fetch the same reqeust as the previous pass
*/
req = blk_fetch_request(q);
/* save requests in use and starved */
counts = q->rq.count[0] + q->rq.count[1] +
q->rq.starved[0] + q->rq.starved[1];
spin_unlock_irq(q->queue_lock);
/* any requests still outstanding? */
if (counts == 0)
break;

/* This may be the same req as the previous iteration,
* always send the blk_end_request_all after a prefetch.
* It is not okay to not end the request because the
* prefetch started the request.
*/
if (req) {
/* return -ENXIO to indicate that this queue is
* going away
*/
req->errors = -ENXIO;
blk_end_request_all(req, -ENXIO);
}

msleep(200); /* allow bsg to possibly finish */
spin_lock_irq(q->queue_lock);
}

bsg_unregister_queue(q);
blk_cleanup_queue(q);
}
Expand Down

0 comments on commit c80bcae

Please sign in to comment.