diff options
Diffstat (limited to 'drivers/block/noop-iosched.c')
-rw-r--r-- | drivers/block/noop-iosched.c | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/drivers/block/noop-iosched.c b/drivers/block/noop-iosched.c index b1730b62c37e..f56b8edb06e4 100644 --- a/drivers/block/noop-iosched.c +++ b/drivers/block/noop-iosched.c | |||
@@ -7,57 +7,19 @@ | |||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | 9 | ||
10 | /* | 10 | static void elevator_noop_add_request(request_queue_t *q, struct request *rq) |
11 | * See if we can find a request that this buffer can be coalesced with. | ||
12 | */ | ||
13 | static int elevator_noop_merge(request_queue_t *q, struct request **req, | ||
14 | struct bio *bio) | ||
15 | { | ||
16 | int ret; | ||
17 | |||
18 | ret = elv_try_last_merge(q, bio); | ||
19 | if (ret != ELEVATOR_NO_MERGE) | ||
20 | *req = q->last_merge; | ||
21 | |||
22 | return ret; | ||
23 | } | ||
24 | |||
25 | static void elevator_noop_merge_requests(request_queue_t *q, struct request *req, | ||
26 | struct request *next) | ||
27 | { | ||
28 | list_del_init(&next->queuelist); | ||
29 | } | ||
30 | |||
31 | static void elevator_noop_add_request(request_queue_t *q, struct request *rq, | ||
32 | int where) | ||
33 | { | 11 | { |
34 | if (where == ELEVATOR_INSERT_FRONT) | 12 | elv_dispatch_add_tail(q, rq); |
35 | list_add(&rq->queuelist, &q->queue_head); | ||
36 | else | ||
37 | list_add_tail(&rq->queuelist, &q->queue_head); | ||
38 | |||
39 | /* | ||
40 | * new merges must not precede this barrier | ||
41 | */ | ||
42 | if (rq->flags & REQ_HARDBARRIER) | ||
43 | q->last_merge = NULL; | ||
44 | else if (!q->last_merge) | ||
45 | q->last_merge = rq; | ||
46 | } | 13 | } |
47 | 14 | ||
48 | static struct request *elevator_noop_next_request(request_queue_t *q) | 15 | static int elevator_noop_dispatch(request_queue_t *q, int force) |
49 | { | 16 | { |
50 | if (!list_empty(&q->queue_head)) | 17 | return 0; |
51 | return list_entry_rq(q->queue_head.next); | ||
52 | |||
53 | return NULL; | ||
54 | } | 18 | } |
55 | 19 | ||
56 | static struct elevator_type elevator_noop = { | 20 | static struct elevator_type elevator_noop = { |
57 | .ops = { | 21 | .ops = { |
58 | .elevator_merge_fn = elevator_noop_merge, | 22 | .elevator_dispatch_fn = elevator_noop_dispatch, |
59 | .elevator_merge_req_fn = elevator_noop_merge_requests, | ||
60 | .elevator_next_req_fn = elevator_noop_next_request, | ||
61 | .elevator_add_req_fn = elevator_noop_add_request, | 23 | .elevator_add_req_fn = elevator_noop_add_request, |
62 | }, | 24 | }, |
63 | .elevator_name = "noop", | 25 | .elevator_name = "noop", |