aboutsummaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 1af5d9f04aff..918920056e42 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -52,7 +52,7 @@ static const int elv_hash_shift = 6;
52#define ELV_HASH_FN(sec) \ 52#define ELV_HASH_FN(sec) \
53 (hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift)) 53 (hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift))
54#define ELV_HASH_ENTRIES (1 << elv_hash_shift) 54#define ELV_HASH_ENTRIES (1 << elv_hash_shift)
55#define rq_hash_key(rq) ((rq)->sector + (rq)->nr_sectors) 55#define rq_hash_key(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))
56 56
57DEFINE_TRACE(block_rq_insert); 57DEFINE_TRACE(block_rq_insert);
58DEFINE_TRACE(block_rq_issue); 58DEFINE_TRACE(block_rq_issue);
@@ -119,9 +119,9 @@ static inline int elv_try_merge(struct request *__rq, struct bio *bio)
119 * we can merge and sequence is ok, check if it's possible 119 * we can merge and sequence is ok, check if it's possible
120 */ 120 */
121 if (elv_rq_merge_ok(__rq, bio)) { 121 if (elv_rq_merge_ok(__rq, bio)) {
122 if (__rq->sector + __rq->nr_sectors == bio->bi_sector) 122 if (blk_rq_pos(__rq) + blk_rq_sectors(__rq) == bio->bi_sector)
123 ret = ELEVATOR_BACK_MERGE; 123 ret = ELEVATOR_BACK_MERGE;
124 else if (__rq->sector - bio_sectors(bio) == bio->bi_sector) 124 else if (blk_rq_pos(__rq) - bio_sectors(bio) == bio->bi_sector)
125 ret = ELEVATOR_FRONT_MERGE; 125 ret = ELEVATOR_FRONT_MERGE;
126 } 126 }
127 127
@@ -370,9 +370,9 @@ struct request *elv_rb_add(struct rb_root *root, struct request *rq)
370 parent = *p; 370 parent = *p;
371 __rq = rb_entry(parent, struct request, rb_node); 371 __rq = rb_entry(parent, struct request, rb_node);
372 372
373 if (rq->sector < __rq->sector) 373 if (blk_rq_pos(rq) < blk_rq_pos(__rq))
374 p = &(*p)->rb_left; 374 p = &(*p)->rb_left;
375 else if (rq->sector > __rq->sector) 375 else if (blk_rq_pos(rq) > blk_rq_pos(__rq))
376 p = &(*p)->rb_right; 376 p = &(*p)->rb_right;
377 else 377 else
378 return __rq; 378 return __rq;
@@ -400,9 +400,9 @@ struct request *elv_rb_find(struct rb_root *root, sector_t sector)
400 while (n) { 400 while (n) {
401 rq = rb_entry(n, struct request, rb_node); 401 rq = rb_entry(n, struct request, rb_node);
402 402
403 if (sector < rq->sector) 403 if (sector < blk_rq_pos(rq))
404 n = n->rb_left; 404 n = n->rb_left;
405 else if (sector > rq->sector) 405 else if (sector > blk_rq_pos(rq))
406 n = n->rb_right; 406 n = n->rb_right;
407 else 407 else
408 return rq; 408 return rq;
@@ -441,14 +441,14 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
441 break; 441 break;
442 if (pos->cmd_flags & stop_flags) 442 if (pos->cmd_flags & stop_flags)
443 break; 443 break;
444 if (rq->sector >= boundary) { 444 if (blk_rq_pos(rq) >= boundary) {
445 if (pos->sector < boundary) 445 if (blk_rq_pos(pos) < boundary)
446 continue; 446 continue;
447 } else { 447 } else {
448 if (pos->sector >= boundary) 448 if (blk_rq_pos(pos) >= boundary)
449 break; 449 break;
450 } 450 }
451 if (rq->sector >= pos->sector) 451 if (blk_rq_pos(rq) >= blk_rq_pos(pos))
452 break; 452 break;
453 } 453 }
454 454