diff options
author | Mike Christie <mchristi@redhat.com> | 2016-06-05 15:32:14 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-06-07 15:41:38 -0400 |
commit | 63a4cc24867de73626e16767ce616c50dc5438d3 (patch) | |
tree | 26fc7bbcac88da1364f08b55760a82f0337328b0 /block | |
parent | ba568ea0a2ef9a193ca24874228474ec7ae2ff98 (diff) |
blkg_rwstat: separate op from flags
The bio and request operation and flags are going to be separate
definitions, so we cannot pass them in as a bitmap. This patch
converts the blkg_rwstat code and its caller, cfq, to pass in the
values separately.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 3fcc5986c01d..3dafdbad8f9c 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -667,9 +667,10 @@ static inline void cfqg_put(struct cfq_group *cfqg) | |||
667 | } while (0) | 667 | } while (0) |
668 | 668 | ||
669 | static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg, | 669 | static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg, |
670 | struct cfq_group *curr_cfqg, int rw) | 670 | struct cfq_group *curr_cfqg, int op, |
671 | int op_flags) | ||
671 | { | 672 | { |
672 | blkg_rwstat_add(&cfqg->stats.queued, rw, 1); | 673 | blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, 1); |
673 | cfqg_stats_end_empty_time(&cfqg->stats); | 674 | cfqg_stats_end_empty_time(&cfqg->stats); |
674 | cfqg_stats_set_start_group_wait_time(cfqg, curr_cfqg); | 675 | cfqg_stats_set_start_group_wait_time(cfqg, curr_cfqg); |
675 | } | 676 | } |
@@ -683,26 +684,30 @@ static inline void cfqg_stats_update_timeslice_used(struct cfq_group *cfqg, | |||
683 | #endif | 684 | #endif |
684 | } | 685 | } |
685 | 686 | ||
686 | static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw) | 687 | static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op, |
688 | int op_flags) | ||
687 | { | 689 | { |
688 | blkg_rwstat_add(&cfqg->stats.queued, rw, -1); | 690 | blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, -1); |
689 | } | 691 | } |
690 | 692 | ||
691 | static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw) | 693 | static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op, |
694 | int op_flags) | ||
692 | { | 695 | { |
693 | blkg_rwstat_add(&cfqg->stats.merged, rw, 1); | 696 | blkg_rwstat_add(&cfqg->stats.merged, op, op_flags, 1); |
694 | } | 697 | } |
695 | 698 | ||
696 | static inline void cfqg_stats_update_completion(struct cfq_group *cfqg, | 699 | static inline void cfqg_stats_update_completion(struct cfq_group *cfqg, |
697 | uint64_t start_time, uint64_t io_start_time, int rw) | 700 | uint64_t start_time, uint64_t io_start_time, int op, |
701 | int op_flags) | ||
698 | { | 702 | { |
699 | struct cfqg_stats *stats = &cfqg->stats; | 703 | struct cfqg_stats *stats = &cfqg->stats; |
700 | unsigned long long now = sched_clock(); | 704 | unsigned long long now = sched_clock(); |
701 | 705 | ||
702 | if (time_after64(now, io_start_time)) | 706 | if (time_after64(now, io_start_time)) |
703 | blkg_rwstat_add(&stats->service_time, rw, now - io_start_time); | 707 | blkg_rwstat_add(&stats->service_time, op, op_flags, |
708 | now - io_start_time); | ||
704 | if (time_after64(io_start_time, start_time)) | 709 | if (time_after64(io_start_time, start_time)) |
705 | blkg_rwstat_add(&stats->wait_time, rw, | 710 | blkg_rwstat_add(&stats->wait_time, op, op_flags, |
706 | io_start_time - start_time); | 711 | io_start_time - start_time); |
707 | } | 712 | } |
708 | 713 | ||
@@ -781,13 +786,16 @@ static inline void cfqg_put(struct cfq_group *cfqg) { } | |||
781 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0) | 786 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0) |
782 | 787 | ||
783 | static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg, | 788 | static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg, |
784 | struct cfq_group *curr_cfqg, int rw) { } | 789 | struct cfq_group *curr_cfqg, int op, int op_flags) { } |
785 | static inline void cfqg_stats_update_timeslice_used(struct cfq_group *cfqg, | 790 | static inline void cfqg_stats_update_timeslice_used(struct cfq_group *cfqg, |
786 | unsigned long time, unsigned long unaccounted_time) { } | 791 | unsigned long time, unsigned long unaccounted_time) { } |
787 | static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw) { } | 792 | static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op, |
788 | static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw) { } | 793 | int op_flags) { } |
794 | static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op, | ||
795 | int op_flags) { } | ||
789 | static inline void cfqg_stats_update_completion(struct cfq_group *cfqg, | 796 | static inline void cfqg_stats_update_completion(struct cfq_group *cfqg, |
790 | uint64_t start_time, uint64_t io_start_time, int rw) { } | 797 | uint64_t start_time, uint64_t io_start_time, int op, |
798 | int op_flags) { } | ||
791 | 799 | ||
792 | #endif /* CONFIG_CFQ_GROUP_IOSCHED */ | 800 | #endif /* CONFIG_CFQ_GROUP_IOSCHED */ |
793 | 801 | ||
@@ -2461,10 +2469,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue *cfqq, struct request *rq) | |||
2461 | { | 2469 | { |
2462 | elv_rb_del(&cfqq->sort_list, rq); | 2470 | elv_rb_del(&cfqq->sort_list, rq); |
2463 | cfqq->queued[rq_is_sync(rq)]--; | 2471 | cfqq->queued[rq_is_sync(rq)]--; |
2464 | cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags); | 2472 | cfqg_stats_update_io_remove(RQ_CFQG(rq), req_op(rq), rq->cmd_flags); |
2465 | cfq_add_rq_rb(rq); | 2473 | cfq_add_rq_rb(rq); |
2466 | cfqg_stats_update_io_add(RQ_CFQG(rq), cfqq->cfqd->serving_group, | 2474 | cfqg_stats_update_io_add(RQ_CFQG(rq), cfqq->cfqd->serving_group, |
2467 | rq->cmd_flags); | 2475 | req_op(rq), rq->cmd_flags); |
2468 | } | 2476 | } |
2469 | 2477 | ||
2470 | static struct request * | 2478 | static struct request * |
@@ -2517,7 +2525,7 @@ static void cfq_remove_request(struct request *rq) | |||
2517 | cfq_del_rq_rb(rq); | 2525 | cfq_del_rq_rb(rq); |
2518 | 2526 | ||
2519 | cfqq->cfqd->rq_queued--; | 2527 | cfqq->cfqd->rq_queued--; |
2520 | cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags); | 2528 | cfqg_stats_update_io_remove(RQ_CFQG(rq), req_op(rq), rq->cmd_flags); |
2521 | if (rq->cmd_flags & REQ_PRIO) { | 2529 | if (rq->cmd_flags & REQ_PRIO) { |
2522 | WARN_ON(!cfqq->prio_pending); | 2530 | WARN_ON(!cfqq->prio_pending); |
2523 | cfqq->prio_pending--; | 2531 | cfqq->prio_pending--; |
@@ -2552,7 +2560,7 @@ static void cfq_merged_request(struct request_queue *q, struct request *req, | |||
2552 | static void cfq_bio_merged(struct request_queue *q, struct request *req, | 2560 | static void cfq_bio_merged(struct request_queue *q, struct request *req, |
2553 | struct bio *bio) | 2561 | struct bio *bio) |
2554 | { | 2562 | { |
2555 | cfqg_stats_update_io_merged(RQ_CFQG(req), bio->bi_rw); | 2563 | cfqg_stats_update_io_merged(RQ_CFQG(req), bio_op(bio), bio->bi_rw); |
2556 | } | 2564 | } |
2557 | 2565 | ||
2558 | static void | 2566 | static void |
@@ -2575,7 +2583,7 @@ cfq_merged_requests(struct request_queue *q, struct request *rq, | |||
2575 | if (cfqq->next_rq == next) | 2583 | if (cfqq->next_rq == next) |
2576 | cfqq->next_rq = rq; | 2584 | cfqq->next_rq = rq; |
2577 | cfq_remove_request(next); | 2585 | cfq_remove_request(next); |
2578 | cfqg_stats_update_io_merged(RQ_CFQG(rq), next->cmd_flags); | 2586 | cfqg_stats_update_io_merged(RQ_CFQG(rq), req_op(next), next->cmd_flags); |
2579 | 2587 | ||
2580 | cfqq = RQ_CFQQ(next); | 2588 | cfqq = RQ_CFQQ(next); |
2581 | /* | 2589 | /* |
@@ -4108,7 +4116,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq) | |||
4108 | rq->fifo_time = jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]; | 4116 | rq->fifo_time = jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]; |
4109 | list_add_tail(&rq->queuelist, &cfqq->fifo); | 4117 | list_add_tail(&rq->queuelist, &cfqq->fifo); |
4110 | cfq_add_rq_rb(rq); | 4118 | cfq_add_rq_rb(rq); |
4111 | cfqg_stats_update_io_add(RQ_CFQG(rq), cfqd->serving_group, | 4119 | cfqg_stats_update_io_add(RQ_CFQG(rq), cfqd->serving_group, req_op(rq), |
4112 | rq->cmd_flags); | 4120 | rq->cmd_flags); |
4113 | cfq_rq_enqueued(cfqd, cfqq, rq); | 4121 | cfq_rq_enqueued(cfqd, cfqq, rq); |
4114 | } | 4122 | } |
@@ -4206,7 +4214,8 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq) | |||
4206 | cfqq->dispatched--; | 4214 | cfqq->dispatched--; |
4207 | (RQ_CFQG(rq))->dispatched--; | 4215 | (RQ_CFQG(rq))->dispatched--; |
4208 | cfqg_stats_update_completion(cfqq->cfqg, rq_start_time_ns(rq), | 4216 | cfqg_stats_update_completion(cfqq->cfqg, rq_start_time_ns(rq), |
4209 | rq_io_start_time_ns(rq), rq->cmd_flags); | 4217 | rq_io_start_time_ns(rq), req_op(rq), |
4218 | rq->cmd_flags); | ||
4210 | 4219 | ||
4211 | cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--; | 4220 | cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--; |
4212 | 4221 | ||