diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-02 11:06:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-02 11:06:02 -0500 |
commit | ec1890c5df451799dec969a3581ff72e1934b5ee (patch) | |
tree | 38e84a95297dc9c6b727b73925d5c273d110fdbe /drivers/block/ll_rw_blk.c | |
parent | ca23509fbaac0ea662ab0e287bebb72f743f9e1f (diff) | |
parent | 496456c24f1f4280d50b81aa5bf439ab440b3d7e (diff) |
Merge git://brick.kernel.dk/data/git/linux-2.6-block
Diffstat (limited to 'drivers/block/ll_rw_blk.c')
-rw-r--r-- | drivers/block/ll_rw_blk.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 0af73512b9a8..2747741677fb 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
@@ -2387,16 +2387,9 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) | |||
2387 | if (!blk_fs_request(rq) || !rq->rq_disk) | 2387 | if (!blk_fs_request(rq) || !rq->rq_disk) |
2388 | return; | 2388 | return; |
2389 | 2389 | ||
2390 | if (rw == READ) { | 2390 | if (!new_io) { |
2391 | __disk_stat_add(rq->rq_disk, read_sectors, nr_sectors); | 2391 | __disk_stat_inc(rq->rq_disk, merges[rw]); |
2392 | if (!new_io) | 2392 | } else { |
2393 | __disk_stat_inc(rq->rq_disk, read_merges); | ||
2394 | } else if (rw == WRITE) { | ||
2395 | __disk_stat_add(rq->rq_disk, write_sectors, nr_sectors); | ||
2396 | if (!new_io) | ||
2397 | __disk_stat_inc(rq->rq_disk, write_merges); | ||
2398 | } | ||
2399 | if (new_io) { | ||
2400 | disk_round_stats(rq->rq_disk); | 2393 | disk_round_stats(rq->rq_disk); |
2401 | rq->rq_disk->in_flight++; | 2394 | rq->rq_disk->in_flight++; |
2402 | } | 2395 | } |
@@ -2791,17 +2784,11 @@ static inline void blk_partition_remap(struct bio *bio) | |||
2791 | 2784 | ||
2792 | if (bdev != bdev->bd_contains) { | 2785 | if (bdev != bdev->bd_contains) { |
2793 | struct hd_struct *p = bdev->bd_part; | 2786 | struct hd_struct *p = bdev->bd_part; |
2787 | const int rw = bio_data_dir(bio); | ||
2788 | |||
2789 | p->sectors[rw] += bio_sectors(bio); | ||
2790 | p->ios[rw]++; | ||
2794 | 2791 | ||
2795 | switch (bio_data_dir(bio)) { | ||
2796 | case READ: | ||
2797 | p->read_sectors += bio_sectors(bio); | ||
2798 | p->reads++; | ||
2799 | break; | ||
2800 | case WRITE: | ||
2801 | p->write_sectors += bio_sectors(bio); | ||
2802 | p->writes++; | ||
2803 | break; | ||
2804 | } | ||
2805 | bio->bi_sector += p->start_sect; | 2792 | bio->bi_sector += p->start_sect; |
2806 | bio->bi_bdev = bdev->bd_contains; | 2793 | bio->bi_bdev = bdev->bd_contains; |
2807 | } | 2794 | } |
@@ -3048,6 +3035,12 @@ static int __end_that_request_first(struct request *req, int uptodate, | |||
3048 | (unsigned long long)req->sector); | 3035 | (unsigned long long)req->sector); |
3049 | } | 3036 | } |
3050 | 3037 | ||
3038 | if (blk_fs_request(req) && req->rq_disk) { | ||
3039 | const int rw = rq_data_dir(req); | ||
3040 | |||
3041 | __disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9); | ||
3042 | } | ||
3043 | |||
3051 | total_bytes = bio_nbytes = 0; | 3044 | total_bytes = bio_nbytes = 0; |
3052 | while ((bio = req->bio) != NULL) { | 3045 | while ((bio = req->bio) != NULL) { |
3053 | int nbytes; | 3046 | int nbytes; |
@@ -3176,16 +3169,10 @@ void end_that_request_last(struct request *req) | |||
3176 | 3169 | ||
3177 | if (disk && blk_fs_request(req)) { | 3170 | if (disk && blk_fs_request(req)) { |
3178 | unsigned long duration = jiffies - req->start_time; | 3171 | unsigned long duration = jiffies - req->start_time; |
3179 | switch (rq_data_dir(req)) { | 3172 | const int rw = rq_data_dir(req); |
3180 | case WRITE: | 3173 | |
3181 | __disk_stat_inc(disk, writes); | 3174 | __disk_stat_inc(disk, ios[rw]); |
3182 | __disk_stat_add(disk, write_ticks, duration); | 3175 | __disk_stat_add(disk, ticks[rw], duration); |
3183 | break; | ||
3184 | case READ: | ||
3185 | __disk_stat_inc(disk, reads); | ||
3186 | __disk_stat_add(disk, read_ticks, duration); | ||
3187 | break; | ||
3188 | } | ||
3189 | disk_round_stats(disk); | 3176 | disk_round_stats(disk); |
3190 | disk->in_flight--; | 3177 | disk->in_flight--; |
3191 | } | 3178 | } |