aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-05-09 17:48:23 -0400
committerJens Axboe <axboe@fb.com>2014-05-09 17:48:23 -0400
commit7276d02e241dc3595d4a18ac2456fa449e448de7 (patch)
tree3fb2f7571884b9585783085e53578f973cf32c12 /block
parentcf4b50afc28cc4629f82f5591bef1db2ce129fdc (diff)
block: only calculate part_in_flight() once
We first check if we have inflight IO, then retrieve that same number again. Usually this isn't that costly since the chance of having the data dirtied in between is small, but there's no reason for calling part_in_flight() twice. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index c4269701cb4f..a6bd3e702201 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1233,12 +1233,15 @@ static void add_acct_request(struct request_queue *q, struct request *rq,
1233static void part_round_stats_single(int cpu, struct hd_struct *part, 1233static void part_round_stats_single(int cpu, struct hd_struct *part,
1234 unsigned long now) 1234 unsigned long now)
1235{ 1235{
1236 int inflight;
1237
1236 if (now == part->stamp) 1238 if (now == part->stamp)
1237 return; 1239 return;
1238 1240
1239 if (part_in_flight(part)) { 1241 inflight = part_in_flight(part);
1242 if (inflight) {
1240 __part_stat_add(cpu, part, time_in_queue, 1243 __part_stat_add(cpu, part, time_in_queue,
1241 part_in_flight(part) * (now - part->stamp)); 1244 inflight * (now - part->stamp));
1242 __part_stat_add(cpu, part, io_ticks, (now - part->stamp)); 1245 __part_stat_add(cpu, part, io_ticks, (now - part->stamp));
1243 } 1246 }
1244 part->stamp = now; 1247 part->stamp = now;