diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2010-12-01 18:33:37 -0500 |
---|---|---|
committer | Wu Fengguang <fengguang.wu@intel.com> | 2011-06-07 20:25:23 -0400 |
commit | 251d6a471c831e22880b3c146bb4556ddfb1dc82 (patch) | |
tree | 5ea61b9153866eda9f4164bf316c03786e1a7840 /include/trace | |
parent | 846d5a091b0506b75489577cde27f39b37a192a4 (diff) |
writeback: trace event writeback_single_inode
It is valuable to know how the dirty inodes are iterated and their IO size.
"writeback_single_inode: bdi 8:0: ino=134246746 state=I_DIRTY_SYNC|I_SYNC age=414 index=0 to_write=1024 wrote=0"
- "state" reflects inode->i_state at the end of writeback_single_inode()
- "index" reflects mapping->writeback_index after the ->writepages() call
- "to_write" is the wbc->nr_to_write at entrance of writeback_single_inode()
- "wrote" is the number of pages actually written
v2: add trace event writeback_single_inode_requeue as proposed by Dave.
CC: Dave Chinner <david@fromorbit.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/events/writeback.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index b2cfac5f3313..898277bc89b4 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -8,6 +8,19 @@ | |||
8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
9 | #include <linux/writeback.h> | 9 | #include <linux/writeback.h> |
10 | 10 | ||
11 | #define show_inode_state(state) \ | ||
12 | __print_flags(state, "|", \ | ||
13 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ | ||
14 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ | ||
15 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ | ||
16 | {I_NEW, "I_NEW"}, \ | ||
17 | {I_WILL_FREE, "I_WILL_FREE"}, \ | ||
18 | {I_FREEING, "I_FREEING"}, \ | ||
19 | {I_CLEAR, "I_CLEAR"}, \ | ||
20 | {I_SYNC, "I_SYNC"}, \ | ||
21 | {I_REFERENCED, "I_REFERENCED"} \ | ||
22 | ) | ||
23 | |||
11 | struct wb_writeback_work; | 24 | struct wb_writeback_work; |
12 | 25 | ||
13 | DECLARE_EVENT_CLASS(writeback_work_class, | 26 | DECLARE_EVENT_CLASS(writeback_work_class, |
@@ -184,6 +197,63 @@ DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, | |||
184 | TP_ARGS(usec_timeout, usec_delayed) | 197 | TP_ARGS(usec_timeout, usec_delayed) |
185 | ); | 198 | ); |
186 | 199 | ||
200 | DECLARE_EVENT_CLASS(writeback_single_inode_template, | ||
201 | |||
202 | TP_PROTO(struct inode *inode, | ||
203 | struct writeback_control *wbc, | ||
204 | unsigned long nr_to_write | ||
205 | ), | ||
206 | |||
207 | TP_ARGS(inode, wbc, nr_to_write), | ||
208 | |||
209 | TP_STRUCT__entry( | ||
210 | __array(char, name, 32) | ||
211 | __field(unsigned long, ino) | ||
212 | __field(unsigned long, state) | ||
213 | __field(unsigned long, age) | ||
214 | __field(unsigned long, writeback_index) | ||
215 | __field(long, nr_to_write) | ||
216 | __field(unsigned long, wrote) | ||
217 | ), | ||
218 | |||
219 | TP_fast_assign( | ||
220 | strncpy(__entry->name, | ||
221 | dev_name(inode->i_mapping->backing_dev_info->dev), 32); | ||
222 | __entry->ino = inode->i_ino; | ||
223 | __entry->state = inode->i_state; | ||
224 | __entry->age = (jiffies - inode->dirtied_when) * | ||
225 | 1000 / HZ; | ||
226 | __entry->writeback_index = inode->i_mapping->writeback_index; | ||
227 | __entry->nr_to_write = nr_to_write; | ||
228 | __entry->wrote = nr_to_write - wbc->nr_to_write; | ||
229 | ), | ||
230 | |||
231 | TP_printk("bdi %s: ino=%lu state=%s age=%lu " | ||
232 | "index=%lu to_write=%ld wrote=%lu", | ||
233 | __entry->name, | ||
234 | __entry->ino, | ||
235 | show_inode_state(__entry->state), | ||
236 | __entry->age, | ||
237 | __entry->writeback_index, | ||
238 | __entry->nr_to_write, | ||
239 | __entry->wrote | ||
240 | ) | ||
241 | ); | ||
242 | |||
243 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue, | ||
244 | TP_PROTO(struct inode *inode, | ||
245 | struct writeback_control *wbc, | ||
246 | unsigned long nr_to_write), | ||
247 | TP_ARGS(inode, wbc, nr_to_write) | ||
248 | ); | ||
249 | |||
250 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, | ||
251 | TP_PROTO(struct inode *inode, | ||
252 | struct writeback_control *wbc, | ||
253 | unsigned long nr_to_write), | ||
254 | TP_ARGS(inode, wbc, nr_to_write) | ||
255 | ); | ||
256 | |||
187 | #endif /* _TRACE_WRITEBACK_H */ | 257 | #endif /* _TRACE_WRITEBACK_H */ |
188 | 258 | ||
189 | /* This part must be outside protection */ | 259 | /* This part must be outside protection */ |