Skip to content

Commit f7d2b1e

Browse files
jankaraWu Fengguang
authored andcommitted
writeback: account per-bdi accumulated written pages
Introduce the BDI_WRITTEN counter. It will be used for estimating the bdi's write bandwidth. Peter Zijlstra <a.p.zijlstra@chello.nl>: Move BDI_WRITTEN accounting into __bdi_writeout_inc(). This will cover and fix fuse, which only calls bdi_writeout_inc(). CC: Michael Rubin <mrubin@google.com> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
1 parent d46db3d commit f7d2b1e

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎include/linux/backing-dev.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ typedef int (congested_fn)(void *, int);
4040
enum bdi_stat_item {
4141
BDI_RECLAIMABLE,
4242
BDI_WRITEBACK,
43+
BDI_WRITTEN,
4344
NR_BDI_STAT_ITEMS
4445
};
4546

‎mm/backing-dev.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,21 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
9797
"BdiDirtyThresh: %8lu kB\n"
9898
"DirtyThresh: %8lu kB\n"
9999
"BackgroundThresh: %8lu kB\n"
100+
"BdiWritten: %8lu kB\n"
100101
"b_dirty: %8lu\n"
101102
"b_io: %8lu\n"
102103
"b_more_io: %8lu\n"
103104
"bdi_list: %8u\n"
104105
"state: %8lx\n",
105106
(unsigned long) K(bdi_stat(bdi, BDI_WRITEBACK)),
106107
(unsigned long) K(bdi_stat(bdi, BDI_RECLAIMABLE)),
107-
K(bdi_thresh), K(dirty_thresh),
108-
K(background_thresh), nr_dirty, nr_io, nr_more_io,
108+
K(bdi_thresh),
109+
K(dirty_thresh),
110+
K(background_thresh),
111+
(unsigned long) K(bdi_stat(bdi, BDI_WRITTEN)),
112+
nr_dirty,
113+
nr_io,
114+
nr_more_io,
109115
!list_empty(&bdi->bdi_list), bdi->state);
110116
#undef K
111117

‎mm/page-writeback.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ int dirty_bytes_handler(struct ctl_table *table, int write,
219219
*/
220220
static inline void __bdi_writeout_inc(struct backing_dev_info *bdi)
221221
{
222+
__inc_bdi_stat(bdi, BDI_WRITTEN);
222223
__prop_inc_percpu_max(&vm_completions, &bdi->completions,
223224
bdi->max_prop_frac);
224225
}

0 commit comments

Comments
 (0)