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/as-iosched.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/as-iosched.c')
-rw-r--r-- | block/as-iosched.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c index 45bd07059c28..7a12cf6ee1d3 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c | |||
@@ -306,8 +306,8 @@ as_choose_req(struct as_data *ad, struct request *rq1, struct request *rq2) | |||
306 | data_dir = rq_is_sync(rq1); | 306 | data_dir = rq_is_sync(rq1); |
307 | 307 | ||
308 | last = ad->last_sector[data_dir]; | 308 | last = ad->last_sector[data_dir]; |
309 | s1 = rq1->sector; | 309 | s1 = blk_rq_pos(rq1); |
310 | s2 = rq2->sector; | 310 | s2 = blk_rq_pos(rq2); |
311 | 311 | ||
312 | BUG_ON(data_dir != rq_is_sync(rq2)); | 312 | BUG_ON(data_dir != rq_is_sync(rq2)); |
313 | 313 | ||
@@ -566,13 +566,15 @@ static void as_update_iohist(struct as_data *ad, struct as_io_context *aic, | |||
566 | as_update_thinktime(ad, aic, thinktime); | 566 | as_update_thinktime(ad, aic, thinktime); |
567 | 567 | ||
568 | /* Calculate read -> read seek distance */ | 568 | /* Calculate read -> read seek distance */ |
569 | if (aic->last_request_pos < rq->sector) | 569 | if (aic->last_request_pos < blk_rq_pos(rq)) |
570 | seek_dist = rq->sector - aic->last_request_pos; | 570 | seek_dist = blk_rq_pos(rq) - |
571 | aic->last_request_pos; | ||
571 | else | 572 | else |
572 | seek_dist = aic->last_request_pos - rq->sector; | 573 | seek_dist = aic->last_request_pos - |
574 | blk_rq_pos(rq); | ||
573 | as_update_seekdist(ad, aic, seek_dist); | 575 | as_update_seekdist(ad, aic, seek_dist); |
574 | } | 576 | } |
575 | aic->last_request_pos = rq->sector + rq->nr_sectors; | 577 | aic->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq); |
576 | set_bit(AS_TASK_IOSTARTED, &aic->state); | 578 | set_bit(AS_TASK_IOSTARTED, &aic->state); |
577 | spin_unlock(&aic->lock); | 579 | spin_unlock(&aic->lock); |
578 | } | 580 | } |
@@ -587,7 +589,7 @@ static int as_close_req(struct as_data *ad, struct as_io_context *aic, | |||
587 | { | 589 | { |
588 | unsigned long delay; /* jiffies */ | 590 | unsigned long delay; /* jiffies */ |
589 | sector_t last = ad->last_sector[ad->batch_data_dir]; | 591 | sector_t last = ad->last_sector[ad->batch_data_dir]; |
590 | sector_t next = rq->sector; | 592 | sector_t next = blk_rq_pos(rq); |
591 | sector_t delta; /* acceptable close offset (in sectors) */ | 593 | sector_t delta; /* acceptable close offset (in sectors) */ |
592 | sector_t s; | 594 | sector_t s; |
593 | 595 | ||
@@ -981,7 +983,7 @@ static void as_move_to_dispatch(struct as_data *ad, struct request *rq) | |||
981 | * This has to be set in order to be correctly updated by | 983 | * This has to be set in order to be correctly updated by |
982 | * as_find_next_rq | 984 | * as_find_next_rq |
983 | */ | 985 | */ |
984 | ad->last_sector[data_dir] = rq->sector + rq->nr_sectors; | 986 | ad->last_sector[data_dir] = blk_rq_pos(rq) + blk_rq_sectors(rq); |
985 | 987 | ||
986 | if (data_dir == BLK_RW_SYNC) { | 988 | if (data_dir == BLK_RW_SYNC) { |
987 | struct io_context *ioc = RQ_IOC(rq); | 989 | struct io_context *ioc = RQ_IOC(rq); |