aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/writeback.h
diff options
context:
space:
mode:
authorCurt Wohlgemuth <curtw@google.com>2011-10-07 23:54:10 -0400
committerWu Fengguang <fengguang.wu@intel.com>2011-10-30 12:33:36 -0400
commit0e175a1835ffc979e55787774e58ec79e41957d7 (patch)
tree6ec4b65a8de4e9d1c12d26a1079079ed81d79450 /include/linux/writeback.h
parentad4e38dd6a33bb3a4882c487d7abe621e583b982 (diff)
writeback: Add a 'reason' to wb_writeback_work
This creates a new 'reason' field in a wb_writeback_work structure, which unambiguously identifies who initiates writeback activity. A 'wb_reason' enumeration has been added to writeback.h, to enumerate the possible reasons. The 'writeback_work_class' and tracepoint event class and 'writeback_queue_io' tracepoints are updated to include the symbolic 'reason' in all trace events. And the 'writeback_inodes_sbXXX' family of routines has had a wb_stats parameter added to them, so callers can specify why writeback is being started. Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Curt Wohlgemuth <curtw@google.com> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Diffstat (limited to 'include/linux/writeback.h')
-rw-r--r--include/linux/writeback.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index ddb4652cb337..a378c295851f 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -39,6 +39,23 @@ enum writeback_sync_modes {
39}; 39};
40 40
41/* 41/*
42 * why some writeback work was initiated
43 */
44enum wb_reason {
45 WB_REASON_BACKGROUND,
46 WB_REASON_TRY_TO_FREE_PAGES,
47 WB_REASON_SYNC,
48 WB_REASON_PERIODIC,
49 WB_REASON_LAPTOP_TIMER,
50 WB_REASON_FREE_MORE_MEM,
51 WB_REASON_FS_FREE_SPACE,
52 WB_REASON_FORKER_THREAD,
53
54 WB_REASON_MAX,
55};
56extern const char *wb_reason_name[];
57
58/*
42 * A control structure which tells the writeback code what to do. These are 59 * A control structure which tells the writeback code what to do. These are
43 * always on the stack, and hence need no locking. They are always initialised 60 * always on the stack, and hence need no locking. They are always initialised
44 * in a manner such that unspecified fields are set to zero. 61 * in a manner such that unspecified fields are set to zero.
@@ -69,14 +86,17 @@ struct writeback_control {
69 */ 86 */
70struct bdi_writeback; 87struct bdi_writeback;
71int inode_wait(void *); 88int inode_wait(void *);
72void writeback_inodes_sb(struct super_block *); 89void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
73void writeback_inodes_sb_nr(struct super_block *, unsigned long nr); 90void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
74int writeback_inodes_sb_if_idle(struct super_block *); 91 enum wb_reason reason);
75int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr); 92int writeback_inodes_sb_if_idle(struct super_block *, enum wb_reason reason);
93int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr,
94 enum wb_reason reason);
76void sync_inodes_sb(struct super_block *); 95void sync_inodes_sb(struct super_block *);
77long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages); 96long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
97 enum wb_reason reason);
78long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 98long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
79void wakeup_flusher_threads(long nr_pages); 99void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
80 100
81/* writeback.h requires fs.h; it, too, is not included from here. */ 101/* writeback.h requires fs.h; it, too, is not included from here. */
82static inline void wait_on_inode(struct inode *inode) 102static inline void wait_on_inode(struct inode *inode)