aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-01 17:38:44 -0400
committerTejun Heo <tj@kernel.org>2012-04-01 17:38:44 -0400
commit629ed0b10209ffc4e1d439e5508d52d5e3a090b8 (patch)
tree69caa493e4ea0714aff247c8415c4fef7ebfe996 /block/blk-cgroup.h
parent2ce4d50f9cfab40831eee5e51e950d5c4724994b (diff)
blkcg: move statistics update code to policies
As with conf/stats file handling code, there's no reason for stat update code to live in blkcg core with policies calling into update them. The current organization is both inflexible and complex. This patch moves stat update code to specific policies. All blkiocg_update_*_stats() functions which deal with BLKIO_POLICY_PROP stats are collapsed into their cfq_blkiocg_update_*_stats() counterparts. blkiocg_update_dispatch_stats() is used by both policies and duplicated as throtl_update_dispatch_stats() and cfq_blkiocg_update_dispatch_stats(). This will be cleaned up later. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h94
1 files changed, 0 insertions, 94 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index ba64b2857571..0b0a176ee007 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -44,13 +44,6 @@ enum blkg_rwstat_type {
44 BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, 44 BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR,
45}; 45};
46 46
47/* blkg state flags */
48enum blkg_state_flags {
49 BLKG_waiting = 0,
50 BLKG_idling,
51 BLKG_empty,
52};
53
54struct blkio_cgroup { 47struct blkio_cgroup {
55 struct cgroup_subsys_state css; 48 struct cgroup_subsys_state css;
56 unsigned int weight; 49 unsigned int weight;
@@ -416,52 +409,6 @@ static inline void blkg_put(struct blkio_group *blkg) { }
416#define BLKIO_WEIGHT_MAX 1000 409#define BLKIO_WEIGHT_MAX 1000
417#define BLKIO_WEIGHT_DEFAULT 500 410#define BLKIO_WEIGHT_DEFAULT 500
418 411
419#ifdef CONFIG_DEBUG_BLK_CGROUP
420void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg,
421 struct blkio_policy_type *pol);
422void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
423 struct blkio_policy_type *pol,
424 unsigned long dequeue);
425void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg,
426 struct blkio_policy_type *pol);
427void blkiocg_update_idle_time_stats(struct blkio_group *blkg,
428 struct blkio_policy_type *pol);
429void blkiocg_set_start_empty_time(struct blkio_group *blkg,
430 struct blkio_policy_type *pol);
431
432#define BLKG_FLAG_FNS(name) \
433static inline void blkio_mark_blkg_##name( \
434 struct blkio_group_stats *stats) \
435{ \
436 stats->flags |= (1 << BLKG_##name); \
437} \
438static inline void blkio_clear_blkg_##name( \
439 struct blkio_group_stats *stats) \
440{ \
441 stats->flags &= ~(1 << BLKG_##name); \
442} \
443static inline int blkio_blkg_##name(struct blkio_group_stats *stats) \
444{ \
445 return (stats->flags & (1 << BLKG_##name)) != 0; \
446} \
447
448BLKG_FLAG_FNS(waiting)
449BLKG_FLAG_FNS(idling)
450BLKG_FLAG_FNS(empty)
451#undef BLKG_FLAG_FNS
452#else
453static inline void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg,
454 struct blkio_policy_type *pol) { }
455static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
456 struct blkio_policy_type *pol, unsigned long dequeue) { }
457static inline void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg,
458 struct blkio_policy_type *pol) { }
459static inline void blkiocg_update_idle_time_stats(struct blkio_group *blkg,
460 struct blkio_policy_type *pol) { }
461static inline void blkiocg_set_start_empty_time(struct blkio_group *blkg,
462 struct blkio_policy_type *pol) { }
463#endif
464
465#ifdef CONFIG_BLK_CGROUP 412#ifdef CONFIG_BLK_CGROUP
466extern struct blkio_cgroup blkio_root_cgroup; 413extern struct blkio_cgroup blkio_root_cgroup;
467extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); 414extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
@@ -471,28 +418,6 @@ extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
471struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg, 418struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
472 struct request_queue *q, 419 struct request_queue *q,
473 bool for_root); 420 bool for_root);
474void blkiocg_update_timeslice_used(struct blkio_group *blkg,
475 struct blkio_policy_type *pol,
476 unsigned long time,
477 unsigned long unaccounted_time);
478void blkiocg_update_dispatch_stats(struct blkio_group *blkg,
479 struct blkio_policy_type *pol,
480 uint64_t bytes, bool direction, bool sync);
481void blkiocg_update_completion_stats(struct blkio_group *blkg,
482 struct blkio_policy_type *pol,
483 uint64_t start_time,
484 uint64_t io_start_time, bool direction,
485 bool sync);
486void blkiocg_update_io_merged_stats(struct blkio_group *blkg,
487 struct blkio_policy_type *pol,
488 bool direction, bool sync);
489void blkiocg_update_io_add_stats(struct blkio_group *blkg,
490 struct blkio_policy_type *pol,
491 struct blkio_group *curr_blkg, bool direction,
492 bool sync);
493void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
494 struct blkio_policy_type *pol,
495 bool direction, bool sync);
496#else 421#else
497struct cgroup; 422struct cgroup;
498static inline struct blkio_cgroup * 423static inline struct blkio_cgroup *
@@ -502,24 +427,5 @@ bio_blkio_cgroup(struct bio *bio) { return NULL; }
502 427
503static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, 428static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
504 void *key) { return NULL; } 429 void *key) { return NULL; }
505static inline void blkiocg_update_timeslice_used(struct blkio_group *blkg,
506 struct blkio_policy_type *pol, unsigned long time,
507 unsigned long unaccounted_time) { }
508static inline void blkiocg_update_dispatch_stats(struct blkio_group *blkg,
509 struct blkio_policy_type *pol, uint64_t bytes,
510 bool direction, bool sync) { }
511static inline void blkiocg_update_completion_stats(struct blkio_group *blkg,
512 struct blkio_policy_type *pol, uint64_t start_time,
513 uint64_t io_start_time, bool direction, bool sync) { }
514static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg,
515 struct blkio_policy_type *pol, bool direction,
516 bool sync) { }
517static inline void blkiocg_update_io_add_stats(struct blkio_group *blkg,
518 struct blkio_policy_type *pol,
519 struct blkio_group *curr_blkg, bool direction,
520 bool sync) { }
521static inline void blkiocg_update_io_remove_stats(struct blkio_group *blkg,
522 struct blkio_policy_type *pol, bool direction,
523 bool sync) { }
524#endif 430#endif
525#endif /* _BLK_CGROUP_H */ 431#endif /* _BLK_CGROUP_H */