Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1379716
| From | mchristi@redhat.com |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 30/42] blkg_rwstat: separate op from flags |
| Date | 2016-04-15 13:00 +0200 |
| Message-ID | <ro9DI-1Ev-13@gated-at.bofh.it> (permalink) |
| References | <ro9u1-1AH-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Mike Christie <mchristi@redhat.com>
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>
---
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 & REQ_PRIO) {
WARN_ON(!cfqq->prio_pending);
cfqq->prio_pending--;
@@ -2552,7 +2560,7 @@ static void cfq_merged_request(struct request_queue *q, struct request *req,
static void cfq_bio_merged(struct request_queue *q, struct request *req,
struct bio *bio)
{
- cfqg_stats_update_io_merged(RQ_CFQG(req), bio->bi_rw);
+ cfqg_stats_update_io_merged(RQ_CFQG(req), bio->bi_op, bio->bi_rw);
}
static void
@@ -2575,7 +2583,7 @@ cfq_merged_requests(struct request_queue *q, struct request *rq,
if (cfqq->next_rq == next)
cfqq->next_rq = rq;
cfq_remove_request(next);
- cfqg_stats_update_io_merged(RQ_CFQG(rq), next->cmd_flags);
+ cfqg_stats_update_io_merged(RQ_CFQG(rq), next->op, next->cmd_flags);
cfqq = RQ_CFQQ(next);
/*
@@ -4108,7 +4116,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
rq->fifo_time = jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)];
list_add_tail(&rq->queuelist, &cfqq->fifo);
cfq_add_rq_rb(rq);
- cfqg_stats_update_io_add(RQ_CFQG(rq), cfqd->serving_group,
+ cfqg_stats_update_io_add(RQ_CFQG(rq), cfqd->serving_group, rq->op,
rq->cmd_flags);
cfq_rq_enqueued(cfqd, cfqq, rq);
}
@@ -4206,7 +4214,8 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
cfqq->dispatched--;
(RQ_CFQG(rq))->dispatched--;
cfqg_stats_update_completion(cfqq->cfqg, rq_start_time_ns(rq),
- rq_io_start_time_ns(rq), rq->cmd_flags);
+ rq_io_start_time_ns(rq), rq->op,
+ rq->cmd_flags);
cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--;
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index c02e669..9071feb 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -590,25 +590,26 @@ static inline void blkg_rwstat_exit(struct blkg_rwstat *rwstat)
/**
* blkg_rwstat_add - add a value to a blkg_rwstat
* @rwstat: target blkg_rwstat
- * @rw: mask of REQ_{WRITE|SYNC}
+ * @op: REQ_OP
+ * @op_flags: rq_flag_bits
* @val: value to add
*
* Add @val to @rwstat. The counters are chosen according to @rw. The
* caller is responsible for synchronizing calls to this function.
*/
static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat,
- int rw, uint64_t val)
+ int op, int op_flags, uint64_t val)
{
struct percpu_counter *cnt;
- if (rw & REQ_WRITE)
+ if (op_is_write(op))
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_WRITE];
else
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_READ];
__percpu_counter_add(cnt, val, BLKG_STAT_CPU_BATCH);
- if (rw & REQ_SYNC)
+ if (op_flags & REQ_SYNC)
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_SYNC];
else
cnt = &rwstat->cpu_cnt[BLKG_RWSTAT_ASYNC];
@@ -713,9 +714,9 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
if (!throtl) {
blkg = blkg ?: q->root_blkg;
- blkg_rwstat_add(&blkg->stat_bytes, bio->bi_rw,
+ blkg_rwstat_add(&blkg->stat_bytes, bio->bi_op, bio->bi_rw,
bio->bi_iter.bi_size);
- blkg_rwstat_add(&blkg->stat_ios, bio->bi_rw, 1);
+ blkg_rwstat_add(&blkg->stat_ios, bio->bi_op, bio->bi_rw, 1);
}
rcu_read_unlock();
--
2.7.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/42] v6: separate operations from flags in the bio/request structs mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 16/42] nilfs: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 10/42] btrfs: use bio fields for op and flags mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 35/42] blktrace: get op from req->op/bio->bi_op mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 05/42] fs: have ll_rw_block users pass in op and flags separately mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 29/42] block: prepare elevator to use REQ_OPs. mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 23/42] md/raid: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 38/42] block, fs: remove old REQ definitions. mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 41/42] block: do not use REQ_FLUSH for tracking flush support mchristi@redhat.com - 2016-04-15 12:50 +0200
Re: [PATCH 41/42] block: do not use REQ_FLUSH for tracking flush support Juergen Gross <kernel@pfupf.net> - 2016-04-15 13:00 +0200
Re: [PATCH 41/42] block: do not use REQ_FLUSH for tracking flush support Mike Christie <mchristi@redhat.com> - 2016-04-15 21:00 +0200
[PATCH 42/42] block, drivers, fs: rename REQ_FLUSH to REQ_PREFLUSH mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 36/42] ide cd: do not set REQ_WRITE on requests. mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 40/42] block, drivers: add REQ_OP_FLUSH operation mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 19/42] dm: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 12:50 +0200
[PATCH 34/42] drivers: set request op to REQ_OP mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 33/42] block: convert rq_data_dir helper to use REQ_OPs mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 26/42] block: copy bio op to request op mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 30/42] blkg_rwstat: separate op from flags mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 37/42] block, fs, drivers: do use bi_rw/cmd_flags for REQ_OPs. mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 32/42] block: convert is_sync helpers to use REQ_OPs. mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 31/42] block: convert merge/insert code to check for REQ_OPs. mchristi@redhat.com - 2016-04-15 13:00 +0200
[PATCH 22/42] drbd: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
[PATCH 27/42] block: prepare request creation/destruction code to use REQ_OPs mchristi@redhat.com - 2016-04-15 13:10 +0200
[PATCH 28/42] block: prepare mq request creation to use REQ_OPs mchristi@redhat.com - 2016-04-15 13:10 +0200
[PATCH 25/42] target: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
[PATCH 24/42] xen: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
[PATCH 21/42] bcache: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
[PATCH 08/42] btrfs: set bi_op tp REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 20/42] dm: pass dm stats data dir instead of bi_rw mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 12/42] gfs2: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 17/42] ocfs2: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 13/42] xfs: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 06/42] direct-io: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 07/42] btrfs: have submit_one_bio users setup bio bi_op mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 11/42] f2fs: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 18/42] pm: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 09/42] btrfs: update __btrfs_map_block for bi_op transition mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 15/42] mpage: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 03/42] block, fs, mm, drivers: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 14/42] hfsplus: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
[PATCH 04/42] fs: have submit_bh users pass in op and flags separately mchristi@redhat.com - 2016-04-15 13:20 +0200
Re: [dm-devel] [PATCH 04/42] fs: have submit_bh users pass in op and flags separately Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> - 2016-04-18 18:40 +0200
[PATCH 02/42] block: add REQ_OP definitions and bi_op/op fields mchristi@redhat.com - 2016-04-15 13:30 +0200
csiph-web