IOSCHED: prevent aliased requests from starving other I/O

file:2951e0d5fd2983eb292fb8eab10176b9f4c9dd59 -> file:e9989d31cbe39dfcd5378d51662aa4b1ab1d0171
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1502,16 +1502,11 @@ static void cfq_add_rq_rb(struct request
{
struct cfq_queue *cfqq = RQ_CFQQ(rq);
struct cfq_data *cfqd = cfqq->cfqd;
- struct request *__alias, *prev;
+ struct request *prev;
cfqq->queued[rq_is_sync(rq)]++;
- /*
- * looks a little odd, but the first insert might return an alias.
- * if that happens, put the alias on the dispatch list
- */
- while ((__alias = elv_rb_add(&cfqq->sort_list, rq)) != NULL)
- cfq_dispatch_insert(cfqd->queue, __alias);
+ elv_rb_add(&cfqq->sort_list, rq);
if (!cfq_cfqq_on_rr(cfqq))
cfq_add_cfqq_rr(cfqd, cfqq);
file:5139c0ea1864a858b6072febcf636a71e9bc6f13 -> file:c644137d9cd643b0e3b80750333dc42e92d1e964
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -77,10 +77,8 @@ static void
deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
{
struct rb_root *root = deadline_rb_root(dd, rq);
- struct request *__alias;
- while (unlikely(__alias = elv_rb_add(root, rq)))
- deadline_move_request(dd, __alias);
+ elv_rb_add(root, rq);
}
static inline void
file:b0b38ce0dcb6ec4cca1cbf28454e834cf3f1073e -> file:a3b64bc71d8821fcdf4fa15dbbd0704ac34b843a
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -353,7 +353,7 @@ static struct request *elv_rqhash_find(s
* RB-tree support functions for inserting/lookup/removal of requests
* in a sorted RB tree.
*/
-struct request *elv_rb_add(struct rb_root *root, struct request *rq)
+void elv_rb_add(struct rb_root *root, struct request *rq)
{
struct rb_node **p = &root->rb_node;
struct rb_node *parent = NULL;
@@ -365,15 +365,12 @@ struct request *elv_rb_add(struct rb_roo
if (blk_rq_pos(rq) < blk_rq_pos(__rq))
p = &(*p)->rb_left;
- else if (blk_rq_pos(rq) > blk_rq_pos(__rq))
+ else if (blk_rq_pos(rq) >= blk_rq_pos(__rq))
p = &(*p)->rb_right;
- else
- return __rq;
}
rb_link_node(&rq->rb_node, parent, p);
rb_insert_color(&rq->rb_node, root);
- return NULL;
}
EXPORT_SYMBOL(elv_rb_add);
file:d228907f8821789a9fdd9baf54365feb9b8ecada -> file:b63a03f619b04d6f0802cbdfab98e1f660fa1ccd
--- a/block/vr-iosched.c
+++ b/block/vr-iosched.c
@@ -73,14 +73,7 @@ return q->elevator->elevator_data;
static void
vr_add_rq_rb(struct vr_data *vd, struct request *rq)
{
-struct request *alias = elv_rb_add(&vd->sort_list, rq);
-
-if (unlikely(alias)) {
-vr_move_request(vd, alias);
-alias = elv_rb_add(&vd->sort_list, rq);
-BUG_ON(alias);
-}
-
+elv_rb_add(&vd->sort_list, rq);
if (blk_rq_pos(rq) >= vd->last_sector) {
if (!vd->next_rq || blk_rq_pos(vd->next_rq) > blk_rq_pos(rq))
vd->next_rq = rq;
file:21a8ebf2dc3a2ab5a899077beaad61aa3e6e4f80 -> file:d800d5142184216bab18fb1858452fd896e85612
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -146,7 +146,7 @@ extern struct request *elv_rb_latter_req
/*
* rb support functions.
*/
-extern struct request *elv_rb_add(struct rb_root *, struct request *);
+extern void elv_rb_add(struct rb_root *, struct request *);
extern void elv_rb_del(struct rb_root *, struct request *);
extern struct request *elv_rb_find(struct rb_root *, sector_t);