writeback instrumentation: remove duplicated structures
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Mar 2013 01:45:17 +0000 (21:45 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Mar 2013 01:56:43 +0000 (21:56 -0400)
Don't replicate internal structures from the kernel: this is asking for
serious trouble, and could lead to breakage if building on newer kernels
that have modified structures.

The proper approach, if we really need to extract this information,
would be to add APIs to the Linux kernel workqueue that allow getting
this information.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/writeback.h

index b0c81d2872cc2221adbfffcb785b731c32ff36c1..fd9c5206f6a5c6947fc4be94797088147cec3568 100644 (file)
 
 #ifndef _TRACE_WRITEBACK_DEF_
 #define _TRACE_WRITEBACK_DEF_
-/* Have to duplicate it here from fs/fs-writeback.c */
-struct wb_writeback_work {
-       long nr_pages;
-       struct super_block *sb;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
-       unsigned long *older_than_this;
-#endif
-       enum writeback_sync_modes sync_mode;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
-       unsigned int tagged_writepages:1;
-#endif
-       unsigned int for_kupdate:1;
-       unsigned int range_cyclic:1;
-       unsigned int for_background:1;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       enum wb_reason reason;          /* why was writeback initiated? */
-#endif
-
-       struct list_head list;          /* pending work list */
-       struct completion *done;        /* set if the caller waits */
-};
 static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
 {
        struct super_block *sb = inode->i_sb;
@@ -72,53 +51,14 @@ DECLARE_EVENT_CLASS(writeback_work_class,
        TP_ARGS(bdi, work),
        TP_STRUCT__entry(
                __array(char, name, 32)
-               __field(long, nr_pages)
-               __field(dev_t, sb_dev)
-               __field(int, sync_mode)
-               __field(int, for_kupdate)
-               __field(int, range_cyclic)
-               __field(int, for_background)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               __field(int, reason)
-#endif
        ),
        TP_fast_assign(
                tp_memcpy(name, dev_name(bdi->dev ? bdi->dev :
                                default_backing_dev_info.dev), 32)
-               tp_assign(nr_pages, work->nr_pages)
-               tp_assign(sb_dev, work->sb ? work->sb->s_dev : 0)
-               tp_assign(sync_mode, work->sync_mode)
-               tp_assign(for_kupdate, work->for_kupdate)
-               tp_assign(range_cyclic, work->range_cyclic)
-               tp_assign(for_background, work->for_background)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               tp_assign(reason, work->reason)
-#endif
        ),
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
-                 "kupdate=%d range_cyclic=%d background=%d reason=%s",
-                 __entry->name,
-                 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
-                 __entry->nr_pages,
-                 __entry->sync_mode,
-                 __entry->for_kupdate,
-                 __entry->range_cyclic,
-                 __entry->for_background,
-                 __print_symbolic(__entry->reason, WB_WORK_REASON)
-       )
-#else
-       TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
-                 "kupdate=%d range_cyclic=%d background=%d",
-                 __entry->name,
-                 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
-                 __entry->nr_pages,
-                 __entry->sync_mode,
-                 __entry->for_kupdate,
-                 __entry->range_cyclic,
-                 __entry->for_background
+       TP_printk("bdi %s",
+                 __entry->name
        )
-#endif
 )
 #define DEFINE_WRITEBACK_WORK_EVENT(name) \
 DEFINE_EVENT(writeback_work_class, name, \
@@ -299,37 +239,27 @@ TRACE_EVENT(writeback_queue_io,
 #endif
        TP_STRUCT__entry(
                __array(char,           name, 32)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#else
                __field(unsigned long,  older)
                __field(long,           age)
-               __field(int,            moved)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               __field(int,            reason)
 #endif
+               __field(int,            moved)
        ),
        TP_fast_assign(
                tp_memcpy(name, dev_name(wb->bdi->dev), 32)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               tp_assign(older,
-                       work->older_than_this ? *(work->older_than_this) : 0)
-               tp_assign(age, work->older_than_this ?
-                       (jiffies - *(work->older_than_this)) * 1000 / HZ : -1)
 #else
                tp_assign(older, older_than_this ?  *older_than_this : 0)
                tp_assign(age, older_than_this ?
                        (jiffies - *older_than_this) * 1000 / HZ : -1)
 #endif
                tp_assign(moved, moved)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-               tp_assign(reason, work->reason)
-#endif
        ),
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-       TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s",
+       TP_printk("bdi %s: enqueue=%d",
                __entry->name,
-               __entry->older, /* older_than_this in jiffies */
-               __entry->age,   /* older_than_this in relative milliseconds */
                __entry->moved,
-               __print_symbolic(__entry->reason, WB_WORK_REASON)
        )
 #else
        TP_printk("bdi %s: older=%lu age=%ld enqueue=%d",
This page took 0.027721 seconds and 4 git commands to generate.