diff options
-rw-r--r-- | block/deadline-iosched.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c index 1a511ffaf8a4..a44437e5a94b 100644 --- a/block/deadline-iosched.c +++ b/block/deadline-iosched.c | |||
@@ -55,6 +55,20 @@ static void deadline_move_request(struct deadline_data *, struct request *); | |||
55 | 55 | ||
56 | #define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_data_dir((rq))]) | 56 | #define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_data_dir((rq))]) |
57 | 57 | ||
58 | /* | ||
59 | * get the request after `rq' in sector-sorted order | ||
60 | */ | ||
61 | static inline struct request * | ||
62 | deadline_latter_request(struct request *rq) | ||
63 | { | ||
64 | struct rb_node *node = rb_next(&rq->rb_node); | ||
65 | |||
66 | if (node) | ||
67 | return rb_entry_rq(node); | ||
68 | |||
69 | return NULL; | ||
70 | } | ||
71 | |||
58 | static void | 72 | static void |
59 | deadline_add_rq_rb(struct deadline_data *dd, struct request *rq) | 73 | deadline_add_rq_rb(struct deadline_data *dd, struct request *rq) |
60 | { | 74 | { |
@@ -74,13 +88,8 @@ deadline_del_rq_rb(struct deadline_data *dd, struct request *rq) | |||
74 | { | 88 | { |
75 | const int data_dir = rq_data_dir(rq); | 89 | const int data_dir = rq_data_dir(rq); |
76 | 90 | ||
77 | if (dd->next_rq[data_dir] == rq) { | 91 | if (dd->next_rq[data_dir] == rq) |
78 | struct rb_node *rbnext = rb_next(&rq->rb_node); | 92 | dd->next_rq[data_dir] = deadline_latter_request(rq); |
79 | |||
80 | dd->next_rq[data_dir] = NULL; | ||
81 | if (rbnext) | ||
82 | dd->next_rq[data_dir] = rb_entry_rq(rbnext); | ||
83 | } | ||
84 | 93 | ||
85 | elv_rb_del(RQ_RB_ROOT(dd, rq), rq); | 94 | elv_rb_del(RQ_RB_ROOT(dd, rq), rq); |
86 | } | 95 | } |
@@ -198,14 +207,11 @@ static void | |||
198 | deadline_move_request(struct deadline_data *dd, struct request *rq) | 207 | deadline_move_request(struct deadline_data *dd, struct request *rq) |
199 | { | 208 | { |
200 | const int data_dir = rq_data_dir(rq); | 209 | const int data_dir = rq_data_dir(rq); |
201 | struct rb_node *rbnext = rb_next(&rq->rb_node); | ||
202 | 210 | ||
203 | dd->next_rq[READ] = NULL; | 211 | dd->next_rq[READ] = NULL; |
204 | dd->next_rq[WRITE] = NULL; | 212 | dd->next_rq[WRITE] = NULL; |
213 | dd->next_rq[data_dir] = deadline_latter_request(rq); | ||
205 | 214 | ||
206 | if (rbnext) | ||
207 | dd->next_rq[data_dir] = rb_entry_rq(rbnext); | ||
208 | |||
209 | dd->last_sector = rq->sector + rq->nr_sectors; | 215 | dd->last_sector = rq->sector + rq->nr_sectors; |
210 | 216 | ||
211 | /* | 217 | /* |