Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+34 -4
+34 -4
mm/backing-dev.c
··· 52 52 static int bdi_debug_stats_show(struct seq_file *m, void *v) 53 53 { 54 54 struct backing_dev_info *bdi = m->private; 55 + struct bdi_writeback *wb; 55 56 unsigned long background_thresh; 56 57 unsigned long dirty_thresh; 57 58 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); 58 78 59 79 get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi); 60 80 ··· 84 64 "BdiReclaimable: %8lu kB\n" 85 65 "BdiDirtyThresh: %8lu kB\n" 86 66 "DirtyThresh: %8lu kB\n" 87 - "BackgroundThresh: %8lu kB\n", 67 + "BackgroundThresh: %8lu kB\n" 68 + "WriteBack threads:%8lu\n" 69 + "b_dirty: %8lu\n" 70 + "b_io: %8lu\n" 71 + "b_more_io: %8lu\n" 72 + "bdi_list: %8u\n" 73 + "state: %8lx\n" 74 + "wb_mask: %8lx\n" 75 + "wb_list: %8u\n" 76 + "wb_cnt: %8u\n", 88 77 (unsigned long) K(bdi_stat(bdi, BDI_WRITEBACK)), 89 78 (unsigned long) K(bdi_stat(bdi, BDI_RECLAIMABLE)), 90 - K(bdi_thresh), 91 - K(dirty_thresh), 92 - K(background_thresh)); 79 + K(bdi_thresh), K(dirty_thresh), 80 + K(background_thresh), nr_wb, nr_dirty, nr_io, nr_more_io, 81 + !list_empty(&bdi->bdi_list), bdi->state, bdi->wb_mask, 82 + !list_empty(&bdi->wb_list), bdi->wb_cnt); 93 83 #undef K 94 84 95 85 return 0;