#ifndef _TRACE_WRITEBACK_DEF_
#define _TRACE_WRITEBACK_DEF_
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0) || \
+ LTTNG_KERNEL_RANGE(5,5,3, 5,6,0) || \
+ LTTNG_KERNEL_RANGE(5,4,19, 5,5,0))
+static inline const char *lttng_bdi_dev_name(struct backing_dev_info *bdi)
+{
+ return bdi_dev_name(bdi);
+}
+#else
+static inline const char *lttng_bdi_dev_name(struct backing_dev_info *bdi)
+{
+ if (!bdi || !bdi->dev)
+ return "(unknown)";
+ return dev_name(bdi->dev);
+}
+#endif
+
/*
* Vanilla kernels before 4.0 do not implement inode_to_bdi
* RHEL kernels before 3.10.0-327.10.1 do not implement inode_to_bdi
TP_PROTO(struct page *page, struct address_space *mapping),
TP_ARGS(page, mapping),
TP_FIELDS(
- ctf_string(name,
- mapping ? dev_name(lttng_inode_to_bdi(mapping->host)->dev) : "(unknown)")
+ ctf_string(name, lttng_bdi_dev_name(mapping ? lttng_inode_to_bdi(mapping->host) : NULL))
ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
ctf_integer(pgoff_t, index, page->index)
)
TP_ARGS(inode, flags),
TP_FIELDS(
/* may be called for files on pseudo FSes w/ unregistered bdi */
- ctf_string(name,
- lttng_inode_to_bdi(inode)->dev ?
- dev_name(lttng_inode_to_bdi(inode)->dev) : "(unknown)")
+ ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
ctf_integer(unsigned long, ino, inode->i_ino)
ctf_integer(unsigned long, state, inode->i_state)
ctf_integer(unsigned long, flags, flags)
TP_PROTO(struct inode *inode, struct writeback_control *wbc),
TP_ARGS(inode, wbc),
TP_FIELDS(
- ctf_string(name,
- dev_name(lttng_inode_to_bdi(inode)->dev))
+ ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
ctf_integer(unsigned long, ino, inode->i_ino)
ctf_integer(int, sync_mode, wbc->sync_mode)
)
TP_PROTO(struct page *page, struct address_space *mapping),
TP_ARGS(page, mapping),
TP_FIELDS(
- ctf_string(name,
- mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)")
+ ctf_string(name, lttng_bdi_dev_name(mapping ? mapping->backing_dev_info : NULL))
ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
ctf_integer(pgoff_t, index, page->index)
)
TP_ARGS(inode, flags),
TP_FIELDS(
/* may be called for files on pseudo FSes w/ unregistered bdi */
- ctf_string(name,
- inode->i_mapping->backing_dev_info->dev ?
- dev_name(inode->i_mapping->backing_dev_info->dev)
- : "(unknown)")
+ ctf_string(name, lttng_bdi_dev_name(inode->i_mapping->backing_dev_info))
ctf_integer(unsigned long, ino, inode->i_ino)
ctf_integer(unsigned long, flags, flags)
)
TP_PROTO(struct inode *inode, struct writeback_control *wbc),
TP_ARGS(inode, wbc),
TP_FIELDS(
- ctf_string(name,
- dev_name(inode->i_mapping->backing_dev_info->dev))
+ ctf_string(name, lttng_bdi_dev_name(inode->i_mapping->backing_dev_info))
ctf_integer(unsigned long, ino, inode->i_ino)
ctf_integer(int, sync_mode, wbc->sync_mode)
)
TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work),
TP_ARGS(wb, work),
TP_FIELDS(
- ctf_string(name, wb->bdi->dev ? dev_name(wb->bdi->dev) :
- "(unknown)")
+ ctf_string(name, lttng_bdi_dev_name(wb->bdi))
)
)
-#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0))
-
-LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
- TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
- TP_ARGS(bdi, work),
- TP_FIELDS(
- ctf_string(name, bdi->dev ? dev_name(bdi->dev) :
- "(unknown)")
- )
-)
-
-#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)) */
+#else
LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
TP_ARGS(bdi, work),
TP_FIELDS(
- ctf_string(name,
- dev_name(bdi->dev ? bdi->dev :
- default_backing_dev_info.dev))
+ ctf_string(name, lttng_bdi_dev_name(bdi))
)
)
-#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)) */
+#endif /* #else if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0)) */
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,3,0))
TP_PROTO(struct bdi_writeback *wb),
TP_ARGS(wb),
TP_FIELDS(
- ctf_string(name,
- dev_name(wb->bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(wb->bdi))
)
)
TP_PROTO(struct backing_dev_info *bdi),
TP_ARGS(bdi),
TP_FIELDS(
- ctf_string(name,
- dev_name(bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(bdi))
)
)
TP_PROTO(struct backing_dev_info *bdi),
TP_ARGS(bdi),
TP_FIELDS(
- ctf_string(name,
- dev_name(bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(bdi))
)
)
TP_ARGS(bdi, written),
TP_FIELDS(
- ctf_string(name, dev_name(bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(bdi))
ctf_integer(int, written, written)
)
)
TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
TP_ARGS(wbc, bdi),
TP_FIELDS(
- ctf_string(name, dev_name(bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(bdi))
ctf_integer(long, nr_to_write, wbc->nr_to_write)
ctf_integer(long, pages_skipped, wbc->pages_skipped)
ctf_integer(int, sync_mode, wbc->sync_mode)
int moved),
TP_ARGS(wb, work, dirtied_before, moved),
TP_FIELDS(
- ctf_string(name, dev_name(wb->bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(wb->bdi))
ctf_integer(unsigned long, older, dirtied_before)
ctf_integer(int, moved, moved)
)
int moved),
TP_ARGS(wb, work, moved),
TP_FIELDS(
- ctf_string(name, dev_name(wb->bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(wb->bdi))
ctf_integer(int, moved, moved)
)
)
int moved),
TP_ARGS(wb, older_than_this, moved),
TP_FIELDS(
- ctf_string(name, dev_name(wb->bdi->dev))
+ ctf_string(name, lttng_bdi_dev_name(wb->bdi))
ctf_integer(unsigned long, older,
older_than_this ? *older_than_this : 0)
ctf_integer(long, age,
TP_ARGS(wb, dirty_rate, task_ratelimit),
TP_FIELDS(
- ctf_string(bdi, dev_name(wb->bdi->dev))
+ ctf_string(bdi, lttng_bdi_dev_name(wb->bdi))
ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth))
ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth))
ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
TP_ARGS(bdi, dirty_rate, task_ratelimit),
TP_FIELDS(
- ctf_string(bdi, dev_name(bdi->dev))
+ ctf_string(bdi, lttng_bdi_dev_name(bdi))
ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
TP_ARGS(bdi, dirty_rate, task_ratelimit),
TP_FIELDS(
- ctf_string(bdi, dev_name(bdi->dev))
+ ctf_string(bdi, lttng_bdi_dev_name(bdi))
ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth))
ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth))
ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
),
TP_FIELDS(
- ctf_string(bdi, dev_name(wb->bdi->dev))
+ ctf_string(bdi, lttng_bdi_dev_name(wb->bdi))
ctf_integer(unsigned long, limit, global_dirty_limit)
ctf_integer(unsigned long, setpoint,
(global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
),
TP_FIELDS(
- ctf_string(bdi, dev_name(bdi->dev))
+ ctf_string(bdi, lttng_bdi_dev_name(bdi))
ctf_integer(unsigned long, limit, global_dirty_limit)
ctf_integer(unsigned long, setpoint,
(global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
TP_ARGS(inode),
TP_FIELDS(
- ctf_string(name,
- dev_name(lttng_inode_to_bdi(inode)->dev))
+ ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
ctf_integer(unsigned long, ino, inode->i_ino)
ctf_integer(unsigned long, state, inode->i_state)
ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
TP_ARGS(inode, wbc, nr_to_write),
TP_FIELDS(
- ctf_string(name,
- dev_name(lttng_inode_to_bdi(inode)->dev))
+ ctf_string(name, lttng_bdi_dev_name(lttng_inode_to_bdi(inode)))
ctf_integer(unsigned long, ino, inode->i_ino)
ctf_integer(unsigned long, state, inode->i_state)
ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)