提交 07b0fdec 编写于 作者: T Tejun Heo 提交者: Jens Axboe

blkcg: allow blkcg_policy->pd_stat() to print non-debug info too

Currently, ->pd_stat() is called only when moduleparam
blkcg_debug_stats is set which prevents it from printing non-debug
policy-specific statistics.  Let's move debug testing down so that
->pd_stat() can print non-debug stat too.  This patch doesn't cause
any visible behavior change.
Signed-off-by: NTejun Heo <tj@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 f7b76ac9
...@@ -54,7 +54,7 @@ static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; ...@@ -54,7 +54,7 @@ static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS];
static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */ static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */
static bool blkcg_debug_stats = false; bool blkcg_debug_stats = false;
static struct workqueue_struct *blkcg_punt_bio_wq; static struct workqueue_struct *blkcg_punt_bio_wq;
static bool blkcg_policy_enabled(struct request_queue *q, static bool blkcg_policy_enabled(struct request_queue *q,
...@@ -944,10 +944,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) ...@@ -944,10 +944,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)
dbytes, dios); dbytes, dios);
} }
if (!blkcg_debug_stats) if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
goto next;
if (atomic_read(&blkg->use_delay)) {
has_stats = true; has_stats = true;
off += scnprintf(buf+off, size-off, off += scnprintf(buf+off, size-off,
" use_delay=%d delay_nsec=%llu", " use_delay=%d delay_nsec=%llu",
...@@ -967,7 +964,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) ...@@ -967,7 +964,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)
has_stats = true; has_stats = true;
off += written; off += written;
} }
next:
if (has_stats) { if (has_stats) {
if (off < size - 1) { if (off < size - 1) {
off += scnprintf(buf+off, size-off, "\n"); off += scnprintf(buf+off, size-off, "\n");
......
...@@ -917,6 +917,9 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf, ...@@ -917,6 +917,9 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf,
unsigned long long avg_lat; unsigned long long avg_lat;
unsigned long long cur_win; unsigned long long cur_win;
if (!blkcg_debug_stats)
return 0;
if (iolat->ssd) if (iolat->ssd)
return iolatency_ssd_stat(iolat, buf, size); return iolatency_ssd_stat(iolat, buf, size);
......
...@@ -181,6 +181,7 @@ struct blkcg_policy { ...@@ -181,6 +181,7 @@ struct blkcg_policy {
extern struct blkcg blkcg_root; extern struct blkcg blkcg_root;
extern struct cgroup_subsys_state * const blkcg_root_css; extern struct cgroup_subsys_state * const blkcg_root_css;
extern bool blkcg_debug_stats;
struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,
struct request_queue *q, bool update_hint); struct request_queue *q, bool update_hint);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册