aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fs-writeback.c4
-rw-r--r--include/trace/events/writeback.h70
2 files changed, 74 insertions, 0 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index f43c479feee9..5185fad48b62 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -346,6 +346,7 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
346 struct writeback_control *wbc) 346 struct writeback_control *wbc)
347{ 347{
348 struct address_space *mapping = inode->i_mapping; 348 struct address_space *mapping = inode->i_mapping;
349 long nr_to_write = wbc->nr_to_write;
349 unsigned dirty; 350 unsigned dirty;
350 int ret; 351 int ret;
351 352
@@ -368,6 +369,8 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
368 */ 369 */
369 if (wbc->sync_mode != WB_SYNC_ALL) { 370 if (wbc->sync_mode != WB_SYNC_ALL) {
370 requeue_io(inode, wb); 371 requeue_io(inode, wb);
372 trace_writeback_single_inode_requeue(inode, wbc,
373 nr_to_write);
371 return 0; 374 return 0;
372 } 375 }
373 376
@@ -467,6 +470,7 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
467 } 470 }
468 } 471 }
469 inode_sync_complete(inode); 472 inode_sync_complete(inode);
473 trace_writeback_single_inode(inode, wbc, nr_to_write);
470 return ret; 474 return ret;
471} 475}
472 476
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
11struct wb_writeback_work; 24struct wb_writeback_work;
12 25
13DECLARE_EVENT_CLASS(writeback_work_class, 26DECLARE_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
200DECLARE_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
243DEFINE_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
250DEFINE_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 */