History

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.

Tejun Heo committed 7 years ago

Commit 07b0fde1 parent f7b76ac3 files · +7 −6Browse files

Unified · Split

3 files
  1. block/blk-cgroup.c +3 −6
  2. block/blk-iolatency.c +3 −0
  3. include/linux/blk-cgroup.h +1 −0
block/blk-cgroup.c+3−6
@@ -54,7 +54,7 @@ static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; · 53 unmodified lines
54 54
55static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */55static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */
56 56
57static bool blkcg_debug_stats = false;57bool blkcg_debug_stats = false;
58static struct workqueue_struct *blkcg_punt_bio_wq;58static struct workqueue_struct *blkcg_punt_bio_wq;
59 59
60static bool blkcg_policy_enabled(struct request_queue *q,60static bool blkcg_policy_enabled(struct request_queue *q,
@@ -944,10 +944,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 883 unmodified lines
944 dbytes, dios);944 dbytes, dios);
945 }945 }
946 946
947 if (!blkcg_debug_stats)947 if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
948 goto next;
949
950 if (atomic_read(&blkg->use_delay)) {
951 has_stats = true;948 has_stats = true;
952 off += scnprintf(buf+off, size-off,949 off += scnprintf(buf+off, size-off,
953 " use_delay=%d delay_nsec=%llu",950 " use_delay=%d delay_nsec=%llu",
@@ -967,7 +964,7 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 13 unmodified lines
967 has_stats = true;964 has_stats = true;
968 off += written;965 off += written;
969 }966 }
970next:967
971 if (has_stats) {968 if (has_stats) {
972 if (off < size - 1) {969 if (off < size - 1) {
973 off += scnprintf(buf+off, size-off, "\n");970 off += scnprintf(buf+off, size-off, "\n");
block/blk-iolatency.c+3−0
@@ -917,6 +917,9 @@ static size_t iolatency_pd_stat(struct blkg_policy_data *pd, char *buf, · 916 unmodified lines
917 unsigned long long avg_lat;917 unsigned long long avg_lat;
918 unsigned long long cur_win;918 unsigned long long cur_win;
919 919
920 if (!blkcg_debug_stats)
921 return 0;
922
920 if (iolat->ssd)923 if (iolat->ssd)
921 return iolatency_ssd_stat(iolat, buf, size);924 return iolatency_ssd_stat(iolat, buf, size);
922 925
include/linux/blk-cgroup.h+1−0
@@ -181,6 +181,7 @@ struct blkcg_policy { · 180 unmodified lines
181 181
182extern struct blkcg blkcg_root;182extern struct blkcg blkcg_root;
183extern struct cgroup_subsys_state * const blkcg_root_css;183extern struct cgroup_subsys_state * const blkcg_root_css;
184extern bool blkcg_debug_stats;
184 185
185struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,186struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,
186 struct request_queue *q, bool update_hint);187 struct request_queue *q, bool update_hint);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t