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/blk-core.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/blk-core.c')
-rw-r--r-- | block/blk-core.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 895e55b74a40..82dc20621c06 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -72,7 +72,7 @@ static void drive_stat_acct(struct request *rq, int new_io) | |||
72 | return; | 72 | return; |
73 | 73 | ||
74 | cpu = part_stat_lock(); | 74 | cpu = part_stat_lock(); |
75 | part = disk_map_sector_rcu(rq->rq_disk, rq->sector); | 75 | part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq)); |
76 | 76 | ||
77 | if (!new_io) | 77 | if (!new_io) |
78 | part_stat_inc(cpu, part, merges[rw]); | 78 | part_stat_inc(cpu, part, merges[rw]); |
@@ -185,10 +185,9 @@ void blk_dump_rq_flags(struct request *rq, char *msg) | |||
185 | rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->cmd_type, | 185 | rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->cmd_type, |
186 | rq->cmd_flags); | 186 | rq->cmd_flags); |
187 | 187 | ||
188 | printk(KERN_INFO " sector %llu, nr/cnr %lu/%u\n", | 188 | printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n", |
189 | (unsigned long long)rq->sector, | 189 | (unsigned long long)blk_rq_pos(rq), |
190 | rq->nr_sectors, | 190 | blk_rq_sectors(rq), blk_rq_cur_sectors(rq)); |
191 | rq->current_nr_sectors); | ||
192 | printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n", | 191 | printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n", |
193 | rq->bio, rq->biotail, | 192 | rq->bio, rq->biotail, |
194 | rq->buffer, rq->data_len); | 193 | rq->buffer, rq->data_len); |
@@ -1557,7 +1556,7 @@ EXPORT_SYMBOL(submit_bio); | |||
1557 | */ | 1556 | */ |
1558 | int blk_rq_check_limits(struct request_queue *q, struct request *rq) | 1557 | int blk_rq_check_limits(struct request_queue *q, struct request *rq) |
1559 | { | 1558 | { |
1560 | if (rq->nr_sectors > q->max_sectors || | 1559 | if (blk_rq_sectors(rq) > q->max_sectors || |
1561 | rq->data_len > q->max_hw_sectors << 9) { | 1560 | rq->data_len > q->max_hw_sectors << 9) { |
1562 | printk(KERN_ERR "%s: over max size limit.\n", __func__); | 1561 | printk(KERN_ERR "%s: over max size limit.\n", __func__); |
1563 | return -EIO; | 1562 | return -EIO; |
@@ -1645,7 +1644,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes) | |||
1645 | int cpu; | 1644 | int cpu; |
1646 | 1645 | ||
1647 | cpu = part_stat_lock(); | 1646 | cpu = part_stat_lock(); |
1648 | part = disk_map_sector_rcu(req->rq_disk, req->sector); | 1647 | part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); |
1649 | part_stat_add(cpu, part, sectors[rw], bytes >> 9); | 1648 | part_stat_add(cpu, part, sectors[rw], bytes >> 9); |
1650 | part_stat_unlock(); | 1649 | part_stat_unlock(); |
1651 | } | 1650 | } |
@@ -1665,7 +1664,7 @@ static void blk_account_io_done(struct request *req) | |||
1665 | int cpu; | 1664 | int cpu; |
1666 | 1665 | ||
1667 | cpu = part_stat_lock(); | 1666 | cpu = part_stat_lock(); |
1668 | part = disk_map_sector_rcu(req->rq_disk, req->sector); | 1667 | part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); |
1669 | 1668 | ||
1670 | part_stat_inc(cpu, part, ios[rw]); | 1669 | part_stat_inc(cpu, part, ios[rw]); |
1671 | part_stat_add(cpu, part, ticks[rw], duration); | 1670 | part_stat_add(cpu, part, ticks[rw], duration); |
@@ -1846,7 +1845,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
1846 | if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) { | 1845 | if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) { |
1847 | printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n", | 1846 | printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n", |
1848 | req->rq_disk ? req->rq_disk->disk_name : "?", | 1847 | req->rq_disk ? req->rq_disk->disk_name : "?", |
1849 | (unsigned long long)req->sector); | 1848 | (unsigned long long)blk_rq_pos(req)); |
1850 | } | 1849 | } |
1851 | 1850 | ||
1852 | blk_account_io_completion(req, nr_bytes); | 1851 | blk_account_io_completion(req, nr_bytes); |