Skip to content

Commit f83e826

Browse files
koct9iJens Axboe
authored andcommitted
block: fix request sorting at unplug
Comparison function for list_sort() must be anticommutative, otherwise it is not sorting in ordinary meaning. But fortunately list_sort() always check ((*cmp)(priv, a, b) <= 0) it not distinguish negative and zero, so comparison function can implement only less-or-equal instead of full three-way comparison. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent a63a5cf commit f83e826

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/blk-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2665,7 +2665,7 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
26652665
struct request *rqa = container_of(a, struct request, queuelist);
26662666
struct request *rqb = container_of(b, struct request, queuelist);
26672667

2668-
return !(rqa->q == rqb->q);
2668+
return !(rqa->q <= rqb->q);
26692669
}
26702670

26712671
static void flush_plug_list(struct blk_plug *plug)

0 commit comments

Comments
 (0)