Skip to content

Commit 07b0fde

Browse files
htejunaxboe
authored andcommitted
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: Tejun Heo <tj@kernel.org> Cc: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f7b76ac commit 07b0fde

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS];
5454

5555
static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */
5656

57-
static bool blkcg_debug_stats = false;
57+
bool blkcg_debug_stats = false;
5858
static struct workqueue_struct *blkcg_punt_bio_wq;
5959

6060
static bool blkcg_policy_enabled(struct request_queue *q,
@@ -944,10 +944,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)
944944
dbytes, dios);
945945
}
946946

947-
if (!blkcg_debug_stats)
948-
goto next;
949-
950-
if (atomic_read(&blkg->use_delay)) {
947+
if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
951948
has_stats = true;
952949
off += scnprintf(buf+off, size-off,
953950
" use_delay=%d delay_nsec=%llu",
@@ -967,7 +964,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)
967964
has_stats = true;
968965
off += written;
969966
}
970-
next:
967+
971968
if (has_stats) {
972969
if (off < size - 1) {
973970
off += scnprintf(buf+off, size-off, "\n");

‎block/blk-iolatency.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,9 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf,
917917
unsigned long long avg_lat;
918918
unsigned long long cur_win;
919919

920+
if (!blkcg_debug_stats)
921+
return 0;
922+
920923
if (iolat->ssd)
921924
return iolatency_ssd_stat(iolat, buf, size);
922925

‎include/linux/blk-cgroup.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ struct blkcg_policy {
181181

182182
extern struct blkcg blkcg_root;
183183
extern struct cgroup_subsys_state * const blkcg_root_css;
184+
extern bool blkcg_debug_stats;
184185

185186
struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,
186187
struct request_queue *q, bool update_hint);

0 commit comments

Comments
 (0)