diff options
author | Jens Axboe <axboe@fb.com> | 2014-05-09 15:48:23 -0600 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-05-09 15:48:23 -0600 |
commit | 7276d02e241dc3595d4a18ac2456fa449e448de7 (patch) | |
tree | 3fb2f7571884b9585783085e53578f973cf32c12 | |
parent | cf4b50afc28cc4629f82f5591bef1db2ce129fdc (diff) | |
download | linux-stable-7276d02e241dc3595d4a18ac2456fa449e448de7.tar.gz linux-stable-7276d02e241dc3595d4a18ac2456fa449e448de7.tar.bz2 linux-stable-7276d02e241dc3595d4a18ac2456fa449e448de7.zip |
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>
-rw-r--r-- | block/blk-core.c | 7 |
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, static void part_round_stats_single(int cpu, struct hd_struct *part, unsigned long now) { + int inflight; + if (now == part->stamp) return; - if (part_in_flight(part)) { + inflight = part_in_flight(part); + if (inflight) { __part_stat_add(cpu, part, time_in_queue, - part_in_flight(part) * (now - part->stamp)); + inflight * (now - part->stamp)); __part_stat_add(cpu, part, io_ticks, (now - part->stamp)); } part->stamp = now; |