diff options
Diffstat (limited to 'drivers/block/elevator.c')
-rw-r--r-- | drivers/block/elevator.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 6b79b4314622..f831f08f839c 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c | |||
@@ -220,11 +220,6 @@ void elevator_exit(elevator_t *e) | |||
220 | kfree(e); | 220 | kfree(e); |
221 | } | 221 | } |
222 | 222 | ||
223 | static int elevator_global_init(void) | ||
224 | { | ||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | int elv_merge(request_queue_t *q, struct request **req, struct bio *bio) | 223 | int elv_merge(request_queue_t *q, struct request **req, struct bio *bio) |
229 | { | 224 | { |
230 | elevator_t *e = q->elevator; | 225 | elevator_t *e = q->elevator; |
@@ -291,6 +286,13 @@ void elv_requeue_request(request_queue_t *q, struct request *rq) | |||
291 | } | 286 | } |
292 | 287 | ||
293 | /* | 288 | /* |
289 | * the request is prepped and may have some resources allocated. | ||
290 | * allowing unprepped requests to pass this one may cause resource | ||
291 | * deadlock. turn on softbarrier. | ||
292 | */ | ||
293 | rq->flags |= REQ_SOFTBARRIER; | ||
294 | |||
295 | /* | ||
294 | * if iosched has an explicit requeue hook, then use that. otherwise | 296 | * if iosched has an explicit requeue hook, then use that. otherwise |
295 | * just put the request at the front of the queue | 297 | * just put the request at the front of the queue |
296 | */ | 298 | */ |
@@ -322,7 +324,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where, | |||
322 | int nrq = q->rq.count[READ] + q->rq.count[WRITE] | 324 | int nrq = q->rq.count[READ] + q->rq.count[WRITE] |
323 | - q->in_flight; | 325 | - q->in_flight; |
324 | 326 | ||
325 | if (nrq == q->unplug_thresh) | 327 | if (nrq >= q->unplug_thresh) |
326 | __generic_unplug_device(q); | 328 | __generic_unplug_device(q); |
327 | } | 329 | } |
328 | } else | 330 | } else |
@@ -386,6 +388,12 @@ struct request *elv_next_request(request_queue_t *q) | |||
386 | if (ret == BLKPREP_OK) { | 388 | if (ret == BLKPREP_OK) { |
387 | break; | 389 | break; |
388 | } else if (ret == BLKPREP_DEFER) { | 390 | } else if (ret == BLKPREP_DEFER) { |
391 | /* | ||
392 | * the request may have been (partially) prepped. | ||
393 | * we need to keep this request in the front to | ||
394 | * avoid resource deadlock. turn on softbarrier. | ||
395 | */ | ||
396 | rq->flags |= REQ_SOFTBARRIER; | ||
389 | rq = NULL; | 397 | rq = NULL; |
390 | break; | 398 | break; |
391 | } else if (ret == BLKPREP_KILL) { | 399 | } else if (ret == BLKPREP_KILL) { |
@@ -692,8 +700,6 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name) | |||
692 | return len; | 700 | return len; |
693 | } | 701 | } |
694 | 702 | ||
695 | module_init(elevator_global_init); | ||
696 | |||
697 | EXPORT_SYMBOL(elv_add_request); | 703 | EXPORT_SYMBOL(elv_add_request); |
698 | EXPORT_SYMBOL(__elv_add_request); | 704 | EXPORT_SYMBOL(__elv_add_request); |
699 | EXPORT_SYMBOL(elv_requeue_request); | 705 | EXPORT_SYMBOL(elv_requeue_request); |