diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-07 09:24:39 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 03:50:54 -0400 |
commit | 83096ebf1263b2c1ee5e653ba37d993d02e3eb7b (patch) | |
tree | 2226b71a616ec1cb2d37511c6a09ba9507a1cd69 /block/elevator.c | |
parent | 5b93629b4509c03ffa87a9316412fedf6f58cb37 (diff) |
block: convert to pos and nr_sectors accessors
With recent cleanups, there is no place where low level driver
directly manipulates request fields. This means that the 'hard'
request fields always equal the !hard fields. Convert all
rq->sectors, nr_sectors and current_nr_sectors references to
accessors.
While at it, drop superflous blk_rq_pos() < 0 test in swim.c.
[ Impact: use pos and nr_sectors accessors ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Tested-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Acked-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Acked-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Dario Ballabio <ballabio_dario@emc.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: unsik Kim <donari75@gmail.com>
Cc: Laurent Vivier <Laurent@lvivier.info>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 22 |
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 | ||
57 | DEFINE_TRACE(block_rq_insert); | 57 | DEFINE_TRACE(block_rq_insert); |
58 | DEFINE_TRACE(block_rq_issue); | 58 | DEFINE_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 | ||