Commit 41bb852b authored by James Bottomley's avatar James Bottomley Committed by Linus Torvalds

[PATCH] make AS work nicely with SCSI

This allows SCSI to survive the I/O queueing stress harness with AS.

Jens has signed off on it, and Mark Havercamp confirms it also
eliminates the test induced hangs for him too.
parent c6923992
...@@ -1522,6 +1522,7 @@ void blk_requeue_request(request_queue_t *q, struct request *rq) ...@@ -1522,6 +1522,7 @@ void blk_requeue_request(request_queue_t *q, struct request *rq)
* @rq: request to be inserted * @rq: request to be inserted
* @at_head: insert request at head or tail of queue * @at_head: insert request at head or tail of queue
* @data: private data * @data: private data
* @reinsert: true if request it a reinsertion of previously processed one
* *
* Description: * Description:
* Many block devices need to execute commands asynchronously, so they don't * Many block devices need to execute commands asynchronously, so they don't
...@@ -1536,7 +1537,7 @@ void blk_requeue_request(request_queue_t *q, struct request *rq) ...@@ -1536,7 +1537,7 @@ void blk_requeue_request(request_queue_t *q, struct request *rq)
* host that is unable to accept a particular command. * host that is unable to accept a particular command.
*/ */
void blk_insert_request(request_queue_t *q, struct request *rq, void blk_insert_request(request_queue_t *q, struct request *rq,
int at_head, void *data) int at_head, void *data, int reinsert)
{ {
unsigned long flags; unsigned long flags;
...@@ -1554,11 +1555,15 @@ void blk_insert_request(request_queue_t *q, struct request *rq, ...@@ -1554,11 +1555,15 @@ void blk_insert_request(request_queue_t *q, struct request *rq,
/* /*
* If command is tagged, release the tag * If command is tagged, release the tag
*/ */
if (blk_rq_tagged(rq)) if(reinsert) {
blk_queue_end_tag(q, rq); blk_requeue_request(q, rq);
} else {
if (blk_rq_tagged(rq))
blk_queue_end_tag(q, rq);
drive_stat_acct(rq, rq->nr_sectors, 1); drive_stat_acct(rq, rq->nr_sectors, 1);
__elv_add_request(q, rq, !at_head, 0); __elv_add_request(q, rq, !at_head, 0);
}
q->request_fn(q); q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
} }
......
...@@ -69,7 +69,7 @@ int scsi_insert_special_req(struct scsi_request *sreq, int at_head) ...@@ -69,7 +69,7 @@ int scsi_insert_special_req(struct scsi_request *sreq, int at_head)
*/ */
sreq->sr_request->flags &= ~REQ_DONTPREP; sreq->sr_request->flags &= ~REQ_DONTPREP;
blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request, blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request,
at_head, sreq); at_head, sreq, 0);
return 0; return 0;
} }
...@@ -147,7 +147,7 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) ...@@ -147,7 +147,7 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
* function. The SCSI request function detects the blocked condition * function. The SCSI request function detects the blocked condition
* and plugs the queue appropriately. * and plugs the queue appropriately.
*/ */
blk_insert_request(device->request_queue, cmd->request, 1, cmd); blk_insert_request(device->request_queue, cmd->request, 1, cmd, 1);
return 0; return 0;
} }
...@@ -445,7 +445,7 @@ static void scsi_run_queue(struct request_queue *q) ...@@ -445,7 +445,7 @@ static void scsi_run_queue(struct request_queue *q)
static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd) static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
{ {
cmd->request->flags &= ~REQ_DONTPREP; cmd->request->flags &= ~REQ_DONTPREP;
blk_insert_request(q, cmd->request, 1, cmd); blk_insert_request(q, cmd->request, 1, cmd, 1);
scsi_run_queue(q); scsi_run_queue(q);
} }
......
...@@ -491,7 +491,7 @@ extern void blk_attempt_remerge(request_queue_t *, struct request *); ...@@ -491,7 +491,7 @@ extern void blk_attempt_remerge(request_queue_t *, struct request *);
extern void __blk_attempt_remerge(request_queue_t *, struct request *); extern void __blk_attempt_remerge(request_queue_t *, struct request *);
extern struct request *blk_get_request(request_queue_t *, int, int); extern struct request *blk_get_request(request_queue_t *, int, int);
extern void blk_put_request(struct request *); extern void blk_put_request(struct request *);
extern void blk_insert_request(request_queue_t *, struct request *, int, void *); extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int);
extern void blk_requeue_request(request_queue_t *, struct request *); extern void blk_requeue_request(request_queue_t *, struct request *);
extern void blk_plug_device(request_queue_t *); extern void blk_plug_device(request_queue_t *);
extern int blk_remove_plug(request_queue_t *); extern int blk_remove_plug(request_queue_t *);
......
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