Re: disk statistics issue in 2.6.27

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jens Axboe
Date: Friday, October 31, 2008 - 5:47 am

On Thu, Oct 23 2008, Miquel van Smoorenburg wrote:

You didn't happen to log a backtrace from that, did you? That's a weird
nr_bytes, it's 0xff0000.

I'm assuming this then fixes it, just wondering what the heck is going
on here.

diff --git a/block/blk-core.c b/block/blk-core.c
index 33c8d4b..a372618 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1712,11 +1710,12 @@ 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);
 		struct hd_struct *part;
-		int cpu;
+		int cpu, sectors;
 
+		sectors = min_t(int, nr_bytes >> 9, req->hard_nr_sectors);
 		cpu = part_stat_lock();
 		part = disk_map_sector_rcu(req->rq_disk, req->sector);
-		part_stat_add(cpu, part, sectors[rw], nr_bytes >> 9);
+		part_stat_add(cpu, part, sectors[rw], sectors);
 		part_stat_unlock();
 	}
 

-- 
Jens Axboe

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
disk statistics issue in 2.6.27, Miquel van Smoorenburg, (Sun Oct 19, 4:31 am)
Re: disk statistics issue in 2.6.27, Jens Axboe, (Mon Oct 20, 10:12 am)
Re: disk statistics issue in 2.6.27, Miquel van Smoorenburg, (Wed Oct 22, 7:37 am)
Re: disk statistics issue in 2.6.27, Jens Axboe, (Wed Oct 22, 10:17 am)
Re: disk statistics issue in 2.6.27, Miquel van Smoorenburg, (Thu Oct 23, 9:05 am)
Re: disk statistics issue in 2.6.27, Jens Axboe, (Fri Oct 31, 5:47 am)
Re: disk statistics issue in 2.6.27, Miquel van Smoorenburg, (Mon Nov 3, 2:39 pm)