[PATCH 30/42] blkg_rwstat: separate op from flags

2016-04-15 Thread mchristi
From: Mike Christie 

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 
Reviewed-by: Christoph Hellwig 
Reviewed-by: Hannes Reinecke 
---
 block/cfq-iosched.c| 49 +++---
 include/linux/blk-cgroup.h | 13 ++--
 2 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 3fcc598..0dfa2dd 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -667,9 +667,10 @@ static inline void cfqg_put(struct cfq_group *cfqg)
 } while (0)
 
 static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg,
-   struct cfq_group *curr_cfqg, int rw)
+   struct cfq_group *curr_cfqg, int op,
+   int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.queued, rw, 1);
+   blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, 1);
cfqg_stats_end_empty_time(&cfqg->stats);
cfqg_stats_set_start_group_wait_time(cfqg, curr_cfqg);
 }
@@ -683,26 +684,30 @@ static inline void 
cfqg_stats_update_timeslice_used(struct cfq_group *cfqg,
 #endif
 }
 
-static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw)
+static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op,
+  int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.queued, rw, -1);
+   blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, -1);
 }
 
-static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw)
+static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op,
+  int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.merged, rw, 1);
+   blkg_rwstat_add(&cfqg->stats.merged, op, op_flags, 1);
 }
 
 static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
-   uint64_t start_time, uint64_t io_start_time, int rw)
+   uint64_t start_time, uint64_t io_start_time, int op,
+   int op_flags)
 {
struct cfqg_stats *stats = &cfqg->stats;
unsigned long long now = sched_clock();
 
if (time_after64(now, io_start_time))
-   blkg_rwstat_add(&stats->service_time, rw, now - io_start_time);
+   blkg_rwstat_add(&stats->service_time, op, op_flags,
+   now - io_start_time);
if (time_after64(io_start_time, start_time))
-   blkg_rwstat_add(&stats->wait_time, rw,
+   blkg_rwstat_add(&stats->wait_time, op, op_flags,
io_start_time - start_time);
 }
 
@@ -781,13 +786,16 @@ static inline void cfqg_put(struct cfq_group *cfqg) { }
 #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0)
 
 static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg,
-   struct cfq_group *curr_cfqg, int rw) { }
+   struct cfq_group *curr_cfqg, int op, int op_flags) { }
 static inline void cfqg_stats_update_timeslice_used(struct cfq_group *cfqg,
unsigned long time, unsigned long unaccounted_time) { }
-static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw) 
{ }
-static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw) 
{ }
+static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op,
+   int op_flags) { }
+static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op,
+   int op_flags) { }
 static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
-   uint64_t start_time, uint64_t io_start_time, int rw) { }
+   uint64_t start_time, uint64_t io_start_time, int op,
+   int op_flags) { }
 
 #endif /* CONFIG_CFQ_GROUP_IOSCHED */
 
@@ -2461,10 +2469,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue 
*cfqq, struct request *rq)
 {
elv_rb_del(&cfqq->sort_list, rq);
cfqq->queued[rq_is_sync(rq)]--;
-   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags);
+   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->op, rq->cmd_flags);
cfq_add_rq_rb(rq);
cfqg_stats_update_io_add(RQ_CFQG(rq), cfqq->cfqd->serving_group,
-rq->cmd_flags);
+rq->op, rq->cmd_flags);
 }
 
 static struct request *
@@ -2517,7 +2525,7 @@ static void cfq_remove_request(struct request *rq)
cfq_del_rq_rb(rq);
 
cfqq->cfqd->rq_queued--;
-   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags);
+   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->op, rq->cmd_flag

[PATCH 30/42] blkg_rwstat: separate op from flags

2016-04-15 Thread mchristi
From: Mike Christie 

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 
Reviewed-by: Christoph Hellwig 
Reviewed-by: Hannes Reinecke 
---
 block/cfq-iosched.c| 49 +++---
 include/linux/blk-cgroup.h | 13 ++--
 2 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 3fcc598..0dfa2dd 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -667,9 +667,10 @@ static inline void cfqg_put(struct cfq_group *cfqg)
 } while (0)
 
 static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg,
-   struct cfq_group *curr_cfqg, int rw)
+   struct cfq_group *curr_cfqg, int op,
+   int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.queued, rw, 1);
+   blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, 1);
cfqg_stats_end_empty_time(&cfqg->stats);
cfqg_stats_set_start_group_wait_time(cfqg, curr_cfqg);
 }
@@ -683,26 +684,30 @@ static inline void 
cfqg_stats_update_timeslice_used(struct cfq_group *cfqg,
 #endif
 }
 
-static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw)
+static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op,
+  int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.queued, rw, -1);
+   blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, -1);
 }
 
-static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw)
+static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op,
+  int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.merged, rw, 1);
+   blkg_rwstat_add(&cfqg->stats.merged, op, op_flags, 1);
 }
 
 static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
-   uint64_t start_time, uint64_t io_start_time, int rw)
+   uint64_t start_time, uint64_t io_start_time, int op,
+   int op_flags)
 {
struct cfqg_stats *stats = &cfqg->stats;
unsigned long long now = sched_clock();
 
if (time_after64(now, io_start_time))
-   blkg_rwstat_add(&stats->service_time, rw, now - io_start_time);
+   blkg_rwstat_add(&stats->service_time, op, op_flags,
+   now - io_start_time);
if (time_after64(io_start_time, start_time))
-   blkg_rwstat_add(&stats->wait_time, rw,
+   blkg_rwstat_add(&stats->wait_time, op, op_flags,
io_start_time - start_time);
 }
 
@@ -781,13 +786,16 @@ static inline void cfqg_put(struct cfq_group *cfqg) { }
 #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0)
 
 static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg,
-   struct cfq_group *curr_cfqg, int rw) { }
+   struct cfq_group *curr_cfqg, int op, int op_flags) { }
 static inline void cfqg_stats_update_timeslice_used(struct cfq_group *cfqg,
unsigned long time, unsigned long unaccounted_time) { }
-static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw) 
{ }
-static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw) 
{ }
+static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op,
+   int op_flags) { }
+static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op,
+   int op_flags) { }
 static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
-   uint64_t start_time, uint64_t io_start_time, int rw) { }
+   uint64_t start_time, uint64_t io_start_time, int op,
+   int op_flags) { }
 
 #endif /* CONFIG_CFQ_GROUP_IOSCHED */
 
@@ -2461,10 +2469,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue 
*cfqq, struct request *rq)
 {
elv_rb_del(&cfqq->sort_list, rq);
cfqq->queued[rq_is_sync(rq)]--;
-   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags);
+   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->op, rq->cmd_flags);
cfq_add_rq_rb(rq);
cfqg_stats_update_io_add(RQ_CFQG(rq), cfqq->cfqd->serving_group,
-rq->cmd_flags);
+rq->op, rq->cmd_flags);
 }
 
 static struct request *
@@ -2517,7 +2525,7 @@ static void cfq_remove_request(struct request *rq)
cfq_del_rq_rb(rq);
 
cfqq->cfqd->rq_queued--;
-   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags);
+   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->op, rq->cmd_flag

[PATCH 30/42] blkg_rwstat: separate op from flags

2016-04-13 Thread mchristi
From: Mike Christie 

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 
Reviewed-by: Christoph Hellwig 
---
 block/cfq-iosched.c| 49 +++---
 include/linux/blk-cgroup.h | 13 ++--
 2 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 3fcc598..0dfa2dd 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -667,9 +667,10 @@ static inline void cfqg_put(struct cfq_group *cfqg)
 } while (0)
 
 static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg,
-   struct cfq_group *curr_cfqg, int rw)
+   struct cfq_group *curr_cfqg, int op,
+   int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.queued, rw, 1);
+   blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, 1);
cfqg_stats_end_empty_time(&cfqg->stats);
cfqg_stats_set_start_group_wait_time(cfqg, curr_cfqg);
 }
@@ -683,26 +684,30 @@ static inline void 
cfqg_stats_update_timeslice_used(struct cfq_group *cfqg,
 #endif
 }
 
-static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw)
+static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op,
+  int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.queued, rw, -1);
+   blkg_rwstat_add(&cfqg->stats.queued, op, op_flags, -1);
 }
 
-static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw)
+static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op,
+  int op_flags)
 {
-   blkg_rwstat_add(&cfqg->stats.merged, rw, 1);
+   blkg_rwstat_add(&cfqg->stats.merged, op, op_flags, 1);
 }
 
 static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
-   uint64_t start_time, uint64_t io_start_time, int rw)
+   uint64_t start_time, uint64_t io_start_time, int op,
+   int op_flags)
 {
struct cfqg_stats *stats = &cfqg->stats;
unsigned long long now = sched_clock();
 
if (time_after64(now, io_start_time))
-   blkg_rwstat_add(&stats->service_time, rw, now - io_start_time);
+   blkg_rwstat_add(&stats->service_time, op, op_flags,
+   now - io_start_time);
if (time_after64(io_start_time, start_time))
-   blkg_rwstat_add(&stats->wait_time, rw,
+   blkg_rwstat_add(&stats->wait_time, op, op_flags,
io_start_time - start_time);
 }
 
@@ -781,13 +786,16 @@ static inline void cfqg_put(struct cfq_group *cfqg) { }
 #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0)
 
 static inline void cfqg_stats_update_io_add(struct cfq_group *cfqg,
-   struct cfq_group *curr_cfqg, int rw) { }
+   struct cfq_group *curr_cfqg, int op, int op_flags) { }
 static inline void cfqg_stats_update_timeslice_used(struct cfq_group *cfqg,
unsigned long time, unsigned long unaccounted_time) { }
-static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int rw) 
{ }
-static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int rw) 
{ }
+static inline void cfqg_stats_update_io_remove(struct cfq_group *cfqg, int op,
+   int op_flags) { }
+static inline void cfqg_stats_update_io_merged(struct cfq_group *cfqg, int op,
+   int op_flags) { }
 static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
-   uint64_t start_time, uint64_t io_start_time, int rw) { }
+   uint64_t start_time, uint64_t io_start_time, int op,
+   int op_flags) { }
 
 #endif /* CONFIG_CFQ_GROUP_IOSCHED */
 
@@ -2461,10 +2469,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue 
*cfqq, struct request *rq)
 {
elv_rb_del(&cfqq->sort_list, rq);
cfqq->queued[rq_is_sync(rq)]--;
-   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags);
+   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->op, rq->cmd_flags);
cfq_add_rq_rb(rq);
cfqg_stats_update_io_add(RQ_CFQG(rq), cfqq->cfqd->serving_group,
-rq->cmd_flags);
+rq->op, rq->cmd_flags);
 }
 
 static struct request *
@@ -2517,7 +2525,7 @@ static void cfq_remove_request(struct request *rq)
cfq_del_rq_rb(rq);
 
cfqq->cfqd->rq_queued--;
-   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->cmd_flags);
+   cfqg_stats_update_io_remove(RQ_CFQG(rq), rq->op, rq->cmd_flags);
if (rq->cmd_flags