fs: new infrastructure for writeback error handling and reporting
[linux-block.git] / include / trace / events / filemap.h
index 42febb6bc1d56a00256a62cbb9149c3b5e3c92a7..ff91325b81239b6e786215fa3a1feb7f78528566 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/memcontrol.h>
 #include <linux/device.h>
 #include <linux/kdev_t.h>
+#include <linux/errseq.h>
 
 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
 
@@ -52,6 +53,62 @@ DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache,
        TP_ARGS(page)
        );
 
+TRACE_EVENT(filemap_set_wb_err,
+               TP_PROTO(struct address_space *mapping, errseq_t eseq),
+
+               TP_ARGS(mapping, eseq),
+
+               TP_STRUCT__entry(
+                       __field(unsigned long, i_ino)
+                       __field(dev_t, s_dev)
+                       __field(errseq_t, errseq)
+               ),
+
+               TP_fast_assign(
+                       __entry->i_ino = mapping->host->i_ino;
+                       __entry->errseq = eseq;
+                       if (mapping->host->i_sb)
+                               __entry->s_dev = mapping->host->i_sb->s_dev;
+                       else
+                               __entry->s_dev = mapping->host->i_rdev;
+               ),
+
+               TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x",
+                       MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
+                       __entry->i_ino, __entry->errseq)
+);
+
+TRACE_EVENT(file_check_and_advance_wb_err,
+               TP_PROTO(struct file *file, errseq_t old),
+
+               TP_ARGS(file, old),
+
+               TP_STRUCT__entry(
+                       __field(struct file *, file);
+                       __field(unsigned long, i_ino)
+                       __field(dev_t, s_dev)
+                       __field(errseq_t, old)
+                       __field(errseq_t, new)
+               ),
+
+               TP_fast_assign(
+                       __entry->file = file;
+                       __entry->i_ino = file->f_mapping->host->i_ino;
+                       if (file->f_mapping->host->i_sb)
+                               __entry->s_dev =
+                                       file->f_mapping->host->i_sb->s_dev;
+                       else
+                               __entry->s_dev =
+                                       file->f_mapping->host->i_rdev;
+                       __entry->old = old;
+                       __entry->new = file->f_wb_err;
+               ),
+
+               TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x",
+                       __entry->file, MAJOR(__entry->s_dev),
+                       MINOR(__entry->s_dev), __entry->i_ino, __entry->old,
+                       __entry->new)
+);
 #endif /* _TRACE_FILEMAP_H */
 
 /* This part must be outside protection */