提交 7276d02e 编写于 作者: J Jens Axboe

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: NJens Axboe <axboe@fb.com>
上级 cf4b50af
...@@ -1233,12 +1233,15 @@ static void add_acct_request(struct request_queue *q, struct request *rq, ...@@ -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, static void part_round_stats_single(int cpu, struct hd_struct *part,
unsigned long now) unsigned long now)
{ {
int inflight;
if (now == part->stamp) if (now == part->stamp)
return; return;
if (part_in_flight(part)) { inflight = part_in_flight(part);
if (inflight) {
__part_stat_add(cpu, part, time_in_queue, __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_stat_add(cpu, part, io_ticks, (now - part->stamp));
} }
part->stamp = now; part->stamp = now;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册