summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 19:47:17 +0900
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 08:56:04 +0200
commit310a2c1012934f590192377f65940cad4aa72b15 (patch)
treeed30346abf07c5a7e94719f567368d5642af1f95 /block
parent88e341261ca4d39eec21b212961c77eff51105f7 (diff)
downloadlinux-stable-310a2c1012934f590192377f65940cad4aa72b15.tar.gz
linux-stable-310a2c1012934f590192377f65940cad4aa72b15.tar.bz2
linux-stable-310a2c1012934f590192377f65940cad4aa72b15.zip
block: misc updates
This patch makes the following misc updates in preparation for disk->part dereference fix and extended block devt support. * implment part_to_disk() * fix comment about gendisk->part indexing * rename get_part() to disk_map_sector() * don't use n which is always zero while printing disk information in diskstats_show() Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c7
-rw-r--r--block/blk-merge.c4
-rw-r--r--block/genhd.c4
3 files changed, 8 insertions, 7 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 86d22e7d65c5..a0dc2e72fcbb 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -60,7 +60,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
if (!blk_fs_request(rq) || !rq->rq_disk)
return;
- part = get_part(rq->rq_disk, rq->sector);
+ part = disk_map_sector(rq->rq_disk, rq->sector);
if (!new_io)
__all_stat_inc(rq->rq_disk, part, merges[rw], rq->sector);
else {
@@ -1557,7 +1557,8 @@ static int __end_that_request_first(struct request *req, int error,
}
if (blk_fs_request(req) && req->rq_disk) {
- struct hd_struct *part = get_part(req->rq_disk, req->sector);
+ struct hd_struct *part =
+ disk_map_sector(req->rq_disk, req->sector);
const int rw = rq_data_dir(req);
all_stat_add(req->rq_disk, part, sectors[rw],
@@ -1745,7 +1746,7 @@ static void end_that_request_last(struct request *req, int error)
if (disk && blk_fs_request(req) && req != &req->q->bar_rq) {
unsigned long duration = jiffies - req->start_time;
const int rw = rq_data_dir(req);
- struct hd_struct *part = get_part(disk, req->sector);
+ struct hd_struct *part = disk_map_sector(disk, req->sector);
__all_stat_inc(disk, part, ios[rw], req->sector);
__all_stat_add(disk, part, ticks[rw], duration, req->sector);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index d81d91419ff5..9b17da698d7c 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -387,8 +387,8 @@ static int attempt_merge(struct request_queue *q, struct request *req,
elv_merge_requests(q, req, next);
if (req->rq_disk) {
- struct hd_struct *part
- = get_part(req->rq_disk, req->sector);
+ struct hd_struct *part =
+ disk_map_sector(req->rq_disk, req->sector);
disk_round_stats(req->rq_disk);
req->rq_disk->in_flight--;
if (part) {
diff --git a/block/genhd.c b/block/genhd.c
index 8b9a9ff1a842..11038fbc75ed 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -568,7 +568,7 @@ static int diskstats_show(struct seq_file *s, void *v)
{
struct gendisk *gp = v;
char buf[BDEVNAME_SIZE];
- int n = 0;
+ int n;
/*
if (&gp->dev.kobj.entry == block_class.devices.next)
@@ -582,7 +582,7 @@ static int diskstats_show(struct seq_file *s, void *v)
disk_round_stats(gp);
preempt_enable();
seq_printf(s, "%4d %4d %s %lu %lu %llu %u %lu %lu %llu %u %u %u %u\n",
- gp->major, n + gp->first_minor, disk_name(gp, n, buf),
+ gp->major, gp->first_minor, disk_name(gp, 0, buf),
disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]),
(unsigned long long)disk_stat_read(gp, sectors[0]),
jiffies_to_msecs(disk_stat_read(gp, ticks[0])),