Skip to content

Commit f09b00d

Browse files
author
Jens Axboe
committed
writeback: add some debug inode list counters to bdi stats
Add some debug entries to be able to inspect the internal state of the writeback details. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent d0bceac commit f09b00d

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

‎mm/backing-dev.c‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,29 @@ static void bdi_debug_init(void)
5252
static int bdi_debug_stats_show(struct seq_file *m, void *v)
5353
{
5454
struct backing_dev_info *bdi = m->private;
55+
struct bdi_writeback *wb;
5556
unsigned long background_thresh;
5657
unsigned long dirty_thresh;
5758
unsigned long bdi_thresh;
59+
unsigned long nr_dirty, nr_io, nr_more_io, nr_wb;
60+
struct inode *inode;
61+
62+
/*
63+
* inode lock is enough here, the bdi->wb_list is protected by
64+
* RCU on the reader side
65+
*/
66+
nr_wb = nr_dirty = nr_io = nr_more_io = 0;
67+
spin_lock(&inode_lock);
68+
list_for_each_entry(wb, &bdi->wb_list, list) {
69+
nr_wb++;
70+
list_for_each_entry(inode, &wb->b_dirty, i_list)
71+
nr_dirty++;
72+
list_for_each_entry(inode, &wb->b_io, i_list)
73+
nr_io++;
74+
list_for_each_entry(inode, &wb->b_more_io, i_list)
75+
nr_more_io++;
76+
}
77+
spin_unlock(&inode_lock);
5878

5979
get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi);
6080

@@ -64,12 +84,22 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
6484
"BdiReclaimable: %8lu kB\n"
6585
"BdiDirtyThresh: %8lu kB\n"
6686
"DirtyThresh: %8lu kB\n"
67-
"BackgroundThresh: %8lu kB\n",
87+
"BackgroundThresh: %8lu kB\n"
88+
"WriteBack threads:%8lu\n"
89+
"b_dirty: %8lu\n"
90+
"b_io: %8lu\n"
91+
"b_more_io: %8lu\n"
92+
"bdi_list: %8u\n"
93+
"state: %8lx\n"
94+
"wb_mask: %8lx\n"
95+
"wb_list: %8u\n"
96+
"wb_cnt: %8u\n",
6897
(unsigned long) K(bdi_stat(bdi, BDI_WRITEBACK)),
6998
(unsigned long) K(bdi_stat(bdi, BDI_RECLAIMABLE)),
70-
K(bdi_thresh),
71-
K(dirty_thresh),
72-
K(background_thresh));
99+
K(bdi_thresh), K(dirty_thresh),
100+
K(background_thresh), nr_wb, nr_dirty, nr_io, nr_more_io,
101+
!list_empty(&bdi->bdi_list), bdi->state, bdi->wb_mask,
102+
!list_empty(&bdi->wb_list), bdi->wb_cnt);
73103
#undef K
74104

75105
return 0;

0 commit comments

Comments
 (0)