mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
Enhanced partition statistics: update partition statitics
Updates the enhanced partition statistics in generic block layer besides the disk statistics. Signed-off-by: Jerome Marchand <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
ea5c48ab2a
commit
6f2576af5b
4 changed files with 44 additions and 4 deletions
|
|
@ -60,10 +60,15 @@ static void drive_stat_acct(struct request *rq, int new_io)
|
|||
return;
|
||||
|
||||
if (!new_io) {
|
||||
__disk_stat_inc(rq->rq_disk, merges[rw]);
|
||||
__all_stat_inc(rq->rq_disk, merges[rw], rq->sector);
|
||||
} else {
|
||||
struct hd_struct *part = get_part(rq->rq_disk, rq->sector);
|
||||
disk_round_stats(rq->rq_disk);
|
||||
rq->rq_disk->in_flight++;
|
||||
if (part) {
|
||||
part_round_stats(part);
|
||||
part->in_flight++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -997,6 +1002,21 @@ void disk_round_stats(struct gendisk *disk)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(disk_round_stats);
|
||||
|
||||
void part_round_stats(struct hd_struct *part)
|
||||
{
|
||||
unsigned long now = jiffies;
|
||||
|
||||
if (now == part->stamp)
|
||||
return;
|
||||
|
||||
if (part->in_flight) {
|
||||
__part_stat_add(part, time_in_queue,
|
||||
part->in_flight * (now - part->stamp));
|
||||
__part_stat_add(part, io_ticks, (now - part->stamp));
|
||||
}
|
||||
part->stamp = now;
|
||||
}
|
||||
|
||||
/*
|
||||
* queue lock must be held
|
||||
*/
|
||||
|
|
@ -1530,7 +1550,8 @@ static int __end_that_request_first(struct request *req, int error,
|
|||
if (blk_fs_request(req) && req->rq_disk) {
|
||||
const int rw = rq_data_dir(req);
|
||||
|
||||
disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9);
|
||||
all_stat_add(req->rq_disk, sectors[rw],
|
||||
nr_bytes >> 9, req->sector);
|
||||
}
|
||||
|
||||
total_bytes = bio_nbytes = 0;
|
||||
|
|
@ -1715,11 +1736,16 @@ 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);
|
||||
|
||||
__disk_stat_inc(disk, ios[rw]);
|
||||
__disk_stat_add(disk, ticks[rw], duration);
|
||||
__all_stat_inc(disk, ios[rw], req->sector);
|
||||
__all_stat_add(disk, ticks[rw], duration, req->sector);
|
||||
disk_round_stats(disk);
|
||||
disk->in_flight--;
|
||||
if (part) {
|
||||
part_round_stats(part);
|
||||
part->in_flight--;
|
||||
}
|
||||
}
|
||||
|
||||
if (req->end_io)
|
||||
|
|
|
|||
|
|
@ -454,8 +454,14 @@ 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);
|
||||
disk_round_stats(req->rq_disk);
|
||||
req->rq_disk->in_flight--;
|
||||
if (part) {
|
||||
part_round_stats(part);
|
||||
part->in_flight--;
|
||||
}
|
||||
}
|
||||
|
||||
req->ioprio = ioprio_best(req->ioprio, next->ioprio);
|
||||
|
|
|
|||
Loading…
Reference in a new issue