diff options
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r-- | block/blk-merge.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index e39cb24b7679..63760ca3da0f 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -338,6 +338,22 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, | |||
338 | return 1; | 338 | return 1; |
339 | } | 339 | } |
340 | 340 | ||
341 | static void blk_account_io_merge(struct request *req) | ||
342 | { | ||
343 | if (blk_do_io_stat(req)) { | ||
344 | struct hd_struct *part; | ||
345 | int cpu; | ||
346 | |||
347 | cpu = part_stat_lock(); | ||
348 | part = disk_map_sector_rcu(req->rq_disk, req->sector); | ||
349 | |||
350 | part_round_stats(cpu, part); | ||
351 | part_dec_in_flight(part); | ||
352 | |||
353 | part_stat_unlock(); | ||
354 | } | ||
355 | } | ||
356 | |||
341 | /* | 357 | /* |
342 | * Has to be called with the request spinlock acquired | 358 | * Has to be called with the request spinlock acquired |
343 | */ | 359 | */ |
@@ -386,18 +402,7 @@ static int attempt_merge(struct request_queue *q, struct request *req, | |||
386 | 402 | ||
387 | elv_merge_requests(q, req, next); | 403 | elv_merge_requests(q, req, next); |
388 | 404 | ||
389 | if (req->rq_disk) { | 405 | blk_account_io_merge(req); |
390 | struct hd_struct *part; | ||
391 | int cpu; | ||
392 | |||
393 | cpu = part_stat_lock(); | ||
394 | part = disk_map_sector_rcu(req->rq_disk, req->sector); | ||
395 | |||
396 | part_round_stats(cpu, part); | ||
397 | part_dec_in_flight(part); | ||
398 | |||
399 | part_stat_unlock(); | ||
400 | } | ||
401 | 406 | ||
402 | req->ioprio = ioprio_best(req->ioprio, next->ioprio); | 407 | req->ioprio = ioprio_best(req->ioprio, next->ioprio); |
403 | if (blk_rq_cpu_valid(next)) | 408 | if (blk_rq_cpu_valid(next)) |