fix: btrfs: make btrfs_ordered_extent naming consistent (v5.6)
[lttng-modules.git] / instrumentation / events / lttng-module / btrfs.h
index 24be361918285438bf3a8d3d5c91b1f45fa083f8..7b2900856d4d18a0d5376abbd63be99063cf43fd 100644 (file)
@@ -1,12 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM btrfs
 
 #if !defined(LTTNG_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
 #define LTTNG_TRACE_BTRFS_H
 
-#include "../../../probes/lttng-tracepoint-event.h"
+#include <probes/lttng-tracepoint-event.h>
 #include <linux/writeback.h>
-#include <trace/events/gfpflags.h>
 #include <linux/version.h>
 
 #ifndef _TRACE_BTRFS_DEF_
@@ -20,8 +20,12 @@ struct btrfs_delayed_ref_node;
 struct btrfs_delayed_tree_ref;
 struct btrfs_delayed_data_ref;
 struct btrfs_delayed_ref_head;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+struct btrfs_block_group;
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 struct btrfs_block_group_cache;
+#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 struct btrfs_free_cluster;
 #endif
 struct map_lookup;
@@ -31,135 +35,80 @@ struct extent_state;
 #endif
 #endif
 
-#define show_ref_type(type)                                            \
-       __print_symbolic(type,                                          \
-               { BTRFS_TREE_BLOCK_REF_KEY,     "TREE_BLOCK_REF" },     \
-               { BTRFS_EXTENT_DATA_REF_KEY,    "EXTENT_DATA_REF" },    \
-               { BTRFS_EXTENT_REF_V0_KEY,      "EXTENT_REF_V0" },      \
-               { BTRFS_SHARED_BLOCK_REF_KEY,   "SHARED_BLOCK_REF" },   \
-               { BTRFS_SHARED_DATA_REF_KEY,    "SHARED_DATA_REF" })
-
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
-#define __show_root_type(obj)                                          \
-       __print_symbolic_u64(obj,                                       \
-               { BTRFS_ROOT_TREE_OBJECTID,     "ROOT_TREE"     },      \
-               { BTRFS_EXTENT_TREE_OBJECTID,   "EXTENT_TREE"   },      \
-               { BTRFS_CHUNK_TREE_OBJECTID,    "CHUNK_TREE"    },      \
-               { BTRFS_DEV_TREE_OBJECTID,      "DEV_TREE"      },      \
-               { BTRFS_FS_TREE_OBJECTID,       "FS_TREE"       },      \
-               { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" },      \
-               { BTRFS_CSUM_TREE_OBJECTID,     "CSUM_TREE"     },      \
-               { BTRFS_TREE_LOG_OBJECTID,      "TREE_LOG"      },      \
-               { BTRFS_QUOTA_TREE_OBJECTID,    "QUOTA_TREE"    },      \
-               { BTRFS_TREE_RELOC_OBJECTID,    "TREE_RELOC"    },      \
-               { BTRFS_UUID_TREE_OBJECTID,     "UUID_RELOC"    },      \
-               { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
-#define __show_root_type(obj)                                          \
-       __print_symbolic_u64(obj,                                       \
-               { BTRFS_ROOT_TREE_OBJECTID,     "ROOT_TREE"     },      \
-               { BTRFS_EXTENT_TREE_OBJECTID,   "EXTENT_TREE"   },      \
-               { BTRFS_CHUNK_TREE_OBJECTID,    "CHUNK_TREE"    },      \
-               { BTRFS_DEV_TREE_OBJECTID,      "DEV_TREE"      },      \
-               { BTRFS_FS_TREE_OBJECTID,       "FS_TREE"       },      \
-               { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" },      \
-               { BTRFS_CSUM_TREE_OBJECTID,     "CSUM_TREE"     },      \
-               { BTRFS_TREE_LOG_OBJECTID,      "TREE_LOG"      },      \
-               { BTRFS_QUOTA_TREE_OBJECTID,    "QUOTA_TREE"    },      \
-               { BTRFS_TREE_RELOC_OBJECTID,    "TREE_RELOC"    },      \
-               { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
-#define __show_root_type(obj)                                          \
-       __print_symbolic_u64(obj,                                       \
-               { BTRFS_ROOT_TREE_OBJECTID,     "ROOT_TREE"     },      \
-               { BTRFS_EXTENT_TREE_OBJECTID,   "EXTENT_TREE"   },      \
-               { BTRFS_CHUNK_TREE_OBJECTID,    "CHUNK_TREE"    },      \
-               { BTRFS_DEV_TREE_OBJECTID,      "DEV_TREE"      },      \
-               { BTRFS_FS_TREE_OBJECTID,       "FS_TREE"       },      \
-               { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" },      \
-               { BTRFS_CSUM_TREE_OBJECTID,     "CSUM_TREE"     },      \
-               { BTRFS_TREE_LOG_OBJECTID,      "TREE_LOG"      },      \
-               { BTRFS_TREE_RELOC_OBJECTID,    "TREE_RELOC"    },      \
-               { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
+#define BTRFS_UUID_SIZE 16
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
+#define lttng_fs_info_fsid fs_info->fs_devices->fsid
 #else
-#define __show_root_type(obj)                                          \
-       __print_symbolic(obj,                                   \
-               { BTRFS_ROOT_TREE_OBJECTID,     "ROOT_TREE"     },      \
-               { BTRFS_EXTENT_TREE_OBJECTID,   "EXTENT_TREE"   },      \
-               { BTRFS_CHUNK_TREE_OBJECTID,    "CHUNK_TREE"    },      \
-               { BTRFS_DEV_TREE_OBJECTID,      "DEV_TREE"      },      \
-               { BTRFS_FS_TREE_OBJECTID,       "FS_TREE"       },      \
-               { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" },      \
-               { BTRFS_CSUM_TREE_OBJECTID,     "CSUM_TREE"     },      \
-               { BTRFS_TREE_LOG_OBJECTID,      "TREE_LOG"      },      \
-               { BTRFS_TREE_RELOC_OBJECTID,    "TREE_RELOC"    },      \
-               { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
+#define lttng_fs_info_fsid fs_info->fsid
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
-#define show_root_type(obj)                                            \
-       obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) ||                \
-             (obj >= BTRFS_ROOT_TREE_OBJECTID &&                       \
-              obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
-#define show_root_type(obj)                                            \
-       obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) ||                \
-             (obj >= BTRFS_ROOT_TREE_OBJECTID &&                       \
-              obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
-#define show_root_type(obj)                                            \
-       obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) ||                \
-             (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) */
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
-
-#define BTRFS_GROUP_FLAGS      \
-       { BTRFS_BLOCK_GROUP_DATA,       "DATA"},        \
-       { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"},      \
-       { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"},    \
-       { BTRFS_BLOCK_GROUP_RAID0,      "RAID0"},       \
-       { BTRFS_BLOCK_GROUP_RAID1,      "RAID1"},       \
-       { BTRFS_BLOCK_GROUP_DUP,        "DUP"},         \
-       { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"},      \
-       { BTRFS_BLOCK_GROUP_RAID5,      "RAID5"},       \
-       { BTRFS_BLOCK_GROUP_RAID6,      "RAID6"}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
 
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+       TP_PROTO(const struct btrfs_root *root),
 
-#define BTRFS_GROUP_FLAGS      \
-       { BTRFS_BLOCK_GROUP_DATA,       "DATA"}, \
-       { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"}, \
-       { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"}, \
-       { BTRFS_BLOCK_GROUP_RAID0,      "RAID0"}, \
-       { BTRFS_BLOCK_GROUP_RAID1,      "RAID1"}, \
-       { BTRFS_BLOCK_GROUP_DUP,        "DUP"}, \
-       { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"}
+       TP_ARGS(root),
 
-#define BTRFS_UUID_SIZE 16
+       TP_FIELDS(
+               ctf_integer(u64, generation, root->fs_info->generation)
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+       )
+)
 
-#endif
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode,
+
+       TP_PROTO(const struct inode *inode),
+
+       TP_ARGS(inode),
+
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(blkcnt_t, blocks, inode->i_blocks)
+               ctf_integer(u64, disk_i_size, BTRFS_I(inode)->disk_i_size)
+               ctf_integer(u64, generation, BTRFS_I(inode)->generation)
+               ctf_integer(u64, last_trans, BTRFS_I(inode)->last_trans)
+               ctf_integer(u64, logged_trans, BTRFS_I(inode)->logged_trans)
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_new,
+
+       TP_PROTO(const struct inode *inode),
+
+       TP_ARGS(inode)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_request,
+
+       TP_PROTO(const struct inode *inode),
+
+       TP_ARGS(inode)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict,
+
+       TP_PROTO(const struct inode *inode),
 
+       TP_ARGS(inode)
+)
+#else
 LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
 
        TP_PROTO(struct btrfs_root *root),
 
        TP_ARGS(root),
 
-       TP_STRUCT__entry(
-               __field(        u64,  generation                )
-               __field(        u64,  root_objectid             )
-       ),
-
-       TP_fast_assign(
-               tp_assign(generation, root->fs_info->generation)
-               tp_assign(root_objectid, root->root_key.objectid)
-       ),
-
-       TP_printk("root = %llu(%s), gen = %llu",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long long)__entry->generation)
+       TP_FIELDS(
+               ctf_integer(u64, generation, root->fs_info->generation)
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode,
@@ -168,36 +117,16 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode,
 
        TP_ARGS(inode),
 
-       TP_STRUCT__entry(
-               __field(        ino_t,  ino                     )
-               __field(        blkcnt_t,  blocks               )
-               __field(        u64,  disk_i_size               )
-               __field(        u64,  generation                )
-               __field(        u64,  last_trans                )
-               __field(        u64,  logged_trans              )
-               __field(        u64,  root_objectid             )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ino, inode->i_ino)
-               tp_assign(blocks, inode->i_blocks)
-               tp_assign(disk_i_size, BTRFS_I(inode)->disk_i_size)
-               tp_assign(generation, BTRFS_I(inode)->generation)
-               tp_assign(last_trans, BTRFS_I(inode)->last_trans)
-               tp_assign(logged_trans, BTRFS_I(inode)->logged_trans)
-               tp_assign(root_objectid,
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(blkcnt_t, blocks, inode->i_blocks)
+               ctf_integer(u64, disk_i_size, BTRFS_I(inode)->disk_i_size)
+               ctf_integer(u64, generation, BTRFS_I(inode)->generation)
+               ctf_integer(u64, last_trans, BTRFS_I(inode)->last_trans)
+               ctf_integer(u64, logged_trans, BTRFS_I(inode)->logged_trans)
+               ctf_integer(u64, root_objectid,
                                BTRFS_I(inode)->root->root_key.objectid)
-       ),
-
-       TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
-                 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long long)__entry->generation,
-                 (unsigned long)__entry->ino,
-                 (unsigned long long)__entry->blocks,
-                 (unsigned long long)__entry->disk_i_size,
-                 (unsigned long long)__entry->last_trans,
-                 (unsigned long long)__entry->logged_trans)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_new,
@@ -220,59 +149,125 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict,
 
        TP_ARGS(inode)
 )
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,40))
-#define __show_map_type(type)                                          \
-       __print_symbolic_u64(type,                                      \
-               { EXTENT_MAP_LAST_BYTE, "LAST_BYTE"     },              \
-               { EXTENT_MAP_HOLE,      "HOLE"          },              \
-               { EXTENT_MAP_INLINE,    "INLINE"        },              \
-               { EXTENT_MAP_DELALLOC,  "DELALLOC"      })
-#else
-#define __show_map_type(type)                                          \
-       __print_symbolic(type,                                  \
-               { EXTENT_MAP_LAST_BYTE, "LAST_BYTE"     },              \
-               { EXTENT_MAP_HOLE,      "HOLE"          },              \
-               { EXTENT_MAP_INLINE,    "INLINE"        },              \
-               { EXTENT_MAP_DELALLOC,  "DELALLOC"      })
 #endif
 
-#define show_map_type(type)                    \
-       type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" :  __show_map_type(type)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
 
-#define show_map_flags(flag)                                           \
-       __print_flags(flag, "|",                                        \
-               { (1 << EXTENT_FLAG_PINNED),            "PINNED"        },\
-               { (1 << EXTENT_FLAG_COMPRESSED),        "COMPRESSED"    },\
-               { (1 << EXTENT_FLAG_VACANCY),           "VACANCY"       },\
-               { (1 << EXTENT_FLAG_PREALLOC),          "PREALLOC"      },\
-               { (1 << EXTENT_FLAG_LOGGING),           "LOGGING"       },\
-               { (1 << EXTENT_FLAG_FILLING),           "FILLING"       },\
-               { (1 << EXTENT_FLAG_FS_MAPPING),        "FS_MAPPING"    })
+       TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode,
+               const struct extent_map *map),
+
+       TP_ARGS(root, inode, map),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, ino, btrfs_ino(inode))
+               ctf_integer(u64, start, map->start)
+               ctf_integer(u64, len, map->len)
+               ctf_integer(u64, orig_start, map->orig_start)
+               ctf_integer(u64, block_start, map->block_start)
+               ctf_integer(u64, block_len, map->block_len)
+               ctf_integer(unsigned long, flags, map->flags)
+               ctf_integer(int, refs, refcount_read(&map->refs))
+               ctf_integer(unsigned int, compress_type, map->compress_type)
+       )
+)
 
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
 
-#define show_map_flags(flag)                                           \
-       __print_flags(flag, "|",                                        \
-               { EXTENT_FLAG_PINNED,           "PINNED"        },      \
-               { EXTENT_FLAG_COMPRESSED,       "COMPRESSED"    },      \
-               { EXTENT_FLAG_VACANCY,          "VACANCY"       },      \
-               { EXTENT_FLAG_PREALLOC,         "PREALLOC"      },      \
-               { EXTENT_FLAG_LOGGING,          "LOGGING"       },      \
-               { EXTENT_FLAG_FILLING,          "FILLING"       })
+LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
 
-#else
+       TP_PROTO(struct btrfs_root *root, struct btrfs_inode *inode,
+               struct extent_map *map),
+
+       TP_ARGS(root, inode, map),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, ino, btrfs_ino(inode))
+               ctf_integer(u64, start, map->start)
+               ctf_integer(u64, len, map->len)
+               ctf_integer(u64, orig_start, map->orig_start)
+               ctf_integer(u64, block_start, map->block_start)
+               ctf_integer(u64, block_len, map->block_len)
+               ctf_integer(unsigned long, flags, map->flags)
+               ctf_integer(int, refs, refcount_read(&map->refs))
+               ctf_integer(unsigned int, compress_type, map->compress_type)
+       )
+)
 
-#define show_map_flags(flag)                                           \
-       __print_flags(flag, "|",                                        \
-               { EXTENT_FLAG_PINNED,           "PINNED"        },      \
-               { EXTENT_FLAG_COMPRESSED,       "COMPRESSED"    },      \
-               { EXTENT_FLAG_VACANCY,          "VACANCY"       },      \
-               { EXTENT_FLAG_PREALLOC,         "PREALLOC"      })
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
 
-#endif
+LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
+
+       TP_PROTO(struct btrfs_root *root, struct btrfs_inode *inode,
+               struct extent_map *map),
+
+       TP_ARGS(root, inode, map),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, ino, btrfs_ino(inode))
+               ctf_integer(u64, start, map->start)
+               ctf_integer(u64, len, map->len)
+               ctf_integer(u64, orig_start, map->orig_start)
+               ctf_integer(u64, block_start, map->block_start)
+               ctf_integer(u64, block_len, map->block_len)
+               ctf_integer(unsigned long, flags, map->flags)
+               ctf_integer(int, refs, atomic_read(&map->refs))
+               ctf_integer(unsigned int, compress_type, map->compress_type)
+       )
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+
+LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
+
+       TP_PROTO(struct btrfs_root *root, struct inode *inode,
+               struct extent_map *map),
+
+       TP_ARGS(root, inode, map),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, ino, btrfs_ino(inode))
+               ctf_integer(u64, start, map->start)
+               ctf_integer(u64, len, map->len)
+               ctf_integer(u64, orig_start, map->orig_start)
+               ctf_integer(u64, block_start, map->block_start)
+               ctf_integer(u64, block_len, map->block_len)
+               ctf_integer(unsigned long, flags, map->flags)
+               ctf_integer(int, refs, atomic_read(&map->refs))
+               ctf_integer(unsigned int, compress_type, map->compress_type)
+       )
+)
+
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+
+LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
+
+       TP_PROTO(const struct btrfs_root *root, const struct extent_map *map),
+
+       TP_ARGS(root, map),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, start, map->start)
+               ctf_integer(u64, len, map->len)
+               ctf_integer(u64, orig_start, map->orig_start)
+               ctf_integer(u64, block_start, map->block_start)
+               ctf_integer(u64, block_len, map->block_len)
+               ctf_integer(unsigned long, flags, map->flags)
+               ctf_integer(int, refs, atomic_read(&map->refs))
+               ctf_integer(unsigned int, compress_type, map->compress_type)
+       )
+)
+
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 
 LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
 
@@ -280,682 +275,1869 @@ LTTNG_TRACEPOINT_EVENT(btrfs_get_extent,
 
        TP_ARGS(root, map),
 
-       TP_STRUCT__entry(
-               __field(        u64,  root_objectid     )
-               __field(        u64,  start             )
-               __field(        u64,  len               )
-               __field(        u64,  orig_start        )
-               __field(        u64,  block_start       )
-               __field(        u64,  block_len         )
-               __field(        unsigned long,  flags   )
-               __field(        int,  refs              )
-               __field(        unsigned int,  compress_type    )
-       ),
-
-       TP_fast_assign(
-               tp_assign(root_objectid, root->root_key.objectid)
-               tp_assign(start, map->start)
-               tp_assign(len, map->len)
-               tp_assign(orig_start, map->orig_start)
-               tp_assign(block_start, map->block_start)
-               tp_assign(block_len, map->block_len)
-               tp_assign(flags, map->flags)
-               tp_assign(refs, atomic_read(&map->refs))
-               tp_assign(compress_type, map->compress_type)
-       ),
-
-       TP_printk("root = %llu(%s), start = %llu, len = %llu, "
-                 "orig_start = %llu, block_start = %llu(%s), "
-                 "block_len = %llu, flags = %s, refs = %u, "
-                 "compress_type = %u",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long long)__entry->start,
-                 (unsigned long long)__entry->len,
-                 (unsigned long long)__entry->orig_start,
-                 show_map_type(__entry->block_start),
-                 (unsigned long long)__entry->block_len,
-                 show_map_flags(__entry->flags),
-                 __entry->refs, __entry->compress_type)
-)
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
-
-#define show_ordered_flags(flags)                                         \
-       __print_flags(flags, "|",                                          \
-               { (1 << BTRFS_ORDERED_IO_DONE),         "IO_DONE"       }, \
-               { (1 << BTRFS_ORDERED_COMPLETE),        "COMPLETE"      }, \
-               { (1 << BTRFS_ORDERED_NOCOW),           "NOCOW"         }, \
-               { (1 << BTRFS_ORDERED_COMPRESSED),      "COMPRESSED"    }, \
-               { (1 << BTRFS_ORDERED_PREALLOC),        "PREALLOC"      }, \
-               { (1 << BTRFS_ORDERED_DIRECT),          "DIRECT"        }, \
-               { (1 << BTRFS_ORDERED_IOERR),           "IOERR"         }, \
-               { (1 << BTRFS_ORDERED_UPDATED_ISIZE),   "UPDATED_ISIZE" }, \
-               { (1 << BTRFS_ORDERED_LOGGED_CSUM),     "LOGGED_CSUM"   }, \
-               { (1 << BTRFS_ORDERED_TRUNCATED),       "TRUNCATED"     })
-
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
-
-#define show_ordered_flags(flags)                                      \
-       __print_symbolic(flags,                                         \
-               { BTRFS_ORDERED_IO_DONE,        "IO_DONE"       },      \
-               { BTRFS_ORDERED_COMPLETE,       "COMPLETE"      },      \
-               { BTRFS_ORDERED_NOCOW,          "NOCOW"         },      \
-               { BTRFS_ORDERED_COMPRESSED,     "COMPRESSED"    },      \
-               { BTRFS_ORDERED_PREALLOC,       "PREALLOC"      },      \
-               { BTRFS_ORDERED_DIRECT,         "DIRECT"        },      \
-               { BTRFS_ORDERED_IOERR,          "IOERR"         },      \
-               { BTRFS_ORDERED_UPDATED_ISIZE,  "UPDATED_ISIZE" },      \
-               { BTRFS_ORDERED_LOGGED_CSUM,    "LOGGED_CSUM"   })
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, start, map->start)
+               ctf_integer(u64, len, map->len)
+               ctf_integer(u64, orig_start, map->orig_start)
+               ctf_integer(u64, block_start, map->block_start)
+               ctf_integer(u64, block_len, map->block_len)
+               ctf_integer(unsigned long, flags, map->flags)
+               ctf_integer(int, refs, atomic_read(&map->refs))
+               ctf_integer(unsigned int, compress_type, map->compress_type)
+       )
+)
+
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 
-#else
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+               const struct extent_map *existing, const struct extent_map *map,
+               u64 start, u64 len),
+
+       TP_ARGS(fs_info, existing, map, start, len),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, e_start, existing->start)
+               ctf_integer(u64, e_len, existing->len)
+               ctf_integer(u64, map_start, map->start)
+               ctf_integer(u64, map_len, map->len)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+               const struct extent_map *existing, const struct extent_map *map,
+               u64 start, u64 len),
+
+       TP_ARGS(fs_info, existing, map, start, len),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, e_start, existing->start)
+               ctf_integer(u64, e_len, existing->len)
+               ctf_integer(u64, map_start, map->start)
+               ctf_integer(u64, map_len, map->len)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
+
+       TP_PROTO(const struct extent_map *existing, const struct extent_map *map, u64 start, u64 len),
 
-#define show_ordered_flags(flags)                                      \
-       __print_symbolic(flags,                                 \
-               { BTRFS_ORDERED_IO_DONE,        "IO_DONE"       },      \
-               { BTRFS_ORDERED_COMPLETE,       "COMPLETE"      },      \
-               { BTRFS_ORDERED_NOCOW,          "NOCOW"         },      \
-               { BTRFS_ORDERED_COMPRESSED,     "COMPRESSED"    },      \
-               { BTRFS_ORDERED_PREALLOC,       "PREALLOC"      },      \
-               { BTRFS_ORDERED_DIRECT,         "DIRECT"        })
+       TP_ARGS(existing, map, start, len),
 
+       TP_FIELDS(
+               ctf_integer(u64, e_start, existing->start)
+               ctf_integer(u64, e_len, existing->len)
+               ctf_integer(u64, map_start, map->start)
+               ctf_integer(u64, map_len, map->len)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
 #endif
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
+
+       TP_PROTO(const struct inode *inode,
+                const struct btrfs_ordered_extent *ordered),
+
+       TP_ARGS(inode, ordered),
+
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(u64, file_offset, ordered->file_offset)
+               ctf_integer(u64, start, ordered->disk_bytenr)
+               ctf_integer(u64, len, ordered->num_bytes)
+               ctf_integer(u64, disk_len, ordered->disk_num_bytes)
+               ctf_integer(u64, bytes_left, ordered->bytes_left)
+               ctf_integer(unsigned long, flags, ordered->flags)
+               ctf_integer(int, compress_type, ordered->compress_type)
+               ctf_integer(int, refs, refcount_read(&ordered->refs))
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
+
+       TP_PROTO(const struct inode *inode,
+                const struct btrfs_ordered_extent *ordered),
+
+       TP_ARGS(inode, ordered),
+
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(u64, file_offset, ordered->file_offset)
+               ctf_integer(u64, start, ordered->start)
+               ctf_integer(u64, len, ordered->len)
+               ctf_integer(u64, disk_len, ordered->disk_len)
+               ctf_integer(u64, bytes_left, ordered->bytes_left)
+               ctf_integer(unsigned long, flags, ordered->flags)
+               ctf_integer(int, compress_type, ordered->compress_type)
+               ctf_integer(int, refs, refcount_read(&ordered->refs))
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
 
        TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
 
        TP_ARGS(inode, ordered),
 
-       TP_STRUCT__entry(
-               __field(        ino_t,  ino             )
-               __field(        u64,  file_offset       )
-               __field(        u64,  start             )
-               __field(        u64,  len               )
-               __field(        u64,  disk_len          )
-               __field(        u64,  bytes_left        )
-               __field(        unsigned long,  flags   )
-               __field(        int,  compress_type     )
-               __field(        int,  refs              )
-               __field(        u64,  root_objectid     )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ino, inode->i_ino)
-               tp_assign(file_offset, ordered->file_offset)
-               tp_assign(start, ordered->start)
-               tp_assign(len, ordered->len)
-               tp_assign(disk_len, ordered->disk_len)
-               tp_assign(bytes_left, ordered->bytes_left)
-               tp_assign(flags, ordered->flags)
-               tp_assign(compress_type, ordered->compress_type)
-               tp_assign(refs, atomic_read(&ordered->refs))
-               tp_assign(root_objectid,
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(u64, file_offset, ordered->file_offset)
+               ctf_integer(u64, start, ordered->start)
+               ctf_integer(u64, len, ordered->len)
+               ctf_integer(u64, disk_len, ordered->disk_len)
+               ctf_integer(u64, bytes_left, ordered->bytes_left)
+               ctf_integer(unsigned long, flags, ordered->flags)
+               ctf_integer(int, compress_type, ordered->compress_type)
+               ctf_integer(int, refs, refcount_read(&ordered->refs))
+               ctf_integer(u64, root_objectid,
                                BTRFS_I(inode)->root->root_key.objectid)
-       ),
-
-       TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
-                 "start = %llu, len = %llu, disk_len = %llu, "
-                 "bytes_left = %llu, flags = %s, compress_type = %d, "
-                 "refs = %d",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long long)__entry->ino,
-                 (unsigned long long)__entry->file_offset,
-                 (unsigned long long)__entry->start,
-                 (unsigned long long)__entry->len,
-                 (unsigned long long)__entry->disk_len,
-                 (unsigned long long)__entry->bytes_left,
-                 show_ordered_flags(__entry->flags),
-                 __entry->compress_type, __entry->refs)
+       )
 )
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
 
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
+       TP_PROTO(const struct inode *inode, const struct btrfs_ordered_extent *ordered),
+
+       TP_ARGS(inode, ordered),
+
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(u64, file_offset, ordered->file_offset)
+               ctf_integer(u64, start, ordered->start)
+               ctf_integer(u64, len, ordered->len)
+               ctf_integer(u64, disk_len, ordered->disk_len)
+               ctf_integer(u64, bytes_left, ordered->bytes_left)
+               ctf_integer(unsigned long, flags, ordered->flags)
+               ctf_integer(int, compress_type, ordered->compress_type)
+               ctf_integer(int, refs, atomic_read(&ordered->refs))
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
 
        TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
 
+       TP_ARGS(inode, ordered),
+
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(u64, file_offset, ordered->file_offset)
+               ctf_integer(u64, start, ordered->start)
+               ctf_integer(u64, len, ordered->len)
+               ctf_integer(u64, disk_len, ordered->disk_len)
+               ctf_integer(u64, bytes_left, ordered->bytes_left)
+               ctf_integer(unsigned long, flags, ordered->flags)
+               ctf_integer(int, compress_type, ordered->compress_type)
+               ctf_integer(int, refs, atomic_read(&ordered->refs))
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
+)
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
+
+       TP_PROTO(const struct inode *inode,
+                const struct btrfs_ordered_extent *ordered),
+
        TP_ARGS(inode, ordered)
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
 
-       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
+       TP_PROTO(const struct inode *inode,
+                const struct btrfs_ordered_extent *ordered),
 
        TP_ARGS(inode, ordered)
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
 
-       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
+       TP_PROTO(const struct inode *inode,
+                const struct btrfs_ordered_extent *ordered),
 
        TP_ARGS(inode, ordered)
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
 
-       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
+       TP_PROTO(const struct inode *inode,
+                const struct btrfs_ordered_extent *ordered),
 
        TP_ARGS(inode, ordered)
 )
 
 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
 
-       TP_PROTO(struct page *page, struct inode *inode,
-                struct writeback_control *wbc),
+       TP_PROTO(const struct page *page, const struct inode *inode,
+                const struct writeback_control *wbc),
 
        TP_ARGS(page, inode, wbc),
 
-       TP_STRUCT__entry(
-               __field(        ino_t,  ino                     )
-               __field(        pgoff_t,  index                 )
-               __field(        long,   nr_to_write             )
-               __field(        long,   pages_skipped           )
-               __field(        loff_t, range_start             )
-               __field(        loff_t, range_end               )
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
-               __field(        char,   nonblocking             )
-#endif
-               __field(        char,   for_kupdate             )
-               __field(        char,   for_reclaim             )
-               __field(        char,   range_cyclic            )
-               __field(        pgoff_t,  writeback_index       )
-               __field(        u64,    root_objectid           )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ino, inode->i_ino)
-               tp_assign(index, page->index)
-               tp_assign(nr_to_write, wbc->nr_to_write)
-               tp_assign(pages_skipped, wbc->pages_skipped)
-               tp_assign(range_start, wbc->range_start)
-               tp_assign(range_end, wbc->range_end)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
-               tp_assign(nonblocking, wbc->nonblocking)
-#endif
-               tp_assign(for_kupdate, wbc->for_kupdate)
-               tp_assign(for_reclaim, wbc->for_reclaim)
-               tp_assign(range_cyclic, wbc->range_cyclic)
-               tp_assign(writeback_index, inode->i_mapping->writeback_index)
-               tp_assign(root_objectid,
-                                BTRFS_I(inode)->root->root_key.objectid)
-       ),
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
-       TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
-                 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
-                 "range_end = %llu, nonblocking = %d, for_kupdate = %d, "
-                 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long)__entry->ino, __entry->index,
-                 __entry->nr_to_write, __entry->pages_skipped,
-                 __entry->range_start, __entry->range_end,
-                 __entry->nonblocking, __entry->for_kupdate,
-                 __entry->for_reclaim, __entry->range_cyclic,
-                 (unsigned long)__entry->writeback_index)
-#else
-       TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
-                 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
-                 "range_end = %llu, for_kupdate = %d, "
-                 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long)__entry->ino, __entry->index,
-                 __entry->nr_to_write, __entry->pages_skipped,
-                 __entry->range_start, __entry->range_end,
-                 __entry->for_kupdate,
-                 __entry->for_reclaim, __entry->range_cyclic,
-                 (unsigned long)__entry->writeback_index)
-#endif
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(pgoff_t, index, page->index)
+               ctf_integer(long, nr_to_write, wbc->nr_to_write)
+               ctf_integer(long, pages_skipped, wbc->pages_skipped)
+               ctf_integer(loff_t, range_start, wbc->range_start)
+               ctf_integer(loff_t, range_end, wbc->range_end)
+               ctf_integer(char, for_kupdate, wbc->for_kupdate)
+               ctf_integer(char, for_reclaim, wbc->for_reclaim)
+               ctf_integer(char, range_cyclic, wbc->range_cyclic)
+               ctf_integer(pgoff_t, writeback_index,
+                               inode->i_mapping->writeback_index)
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
 )
 
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__writepage, __extent_writepage,
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs__writepage,
 
-       TP_PROTO(struct page *page, struct inode *inode,
-                struct writeback_control *wbc),
+       __extent_writepage,
+
+       btrfs__extent_writepage,
+
+       TP_PROTO(const struct page *page, const struct inode *inode,
+                const struct writeback_control *wbc),
 
        TP_ARGS(page, inode, wbc)
 )
 
 LTTNG_TRACEPOINT_EVENT(btrfs_writepage_end_io_hook,
 
-       TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
+       TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate),
 
        TP_ARGS(page, start, end, uptodate),
 
-       TP_STRUCT__entry(
-               __field(        ino_t,   ino            )
-               __field(        pgoff_t, index          )
-               __field(        u64,     start          )
-               __field(        u64,     end            )
-               __field(        int,     uptodate       )
-               __field(        u64,    root_objectid   )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ino, page->mapping->host->i_ino)
-               tp_assign(index, page->index)
-               tp_assign(start, start)
-               tp_assign(end, end)
-               tp_assign(uptodate, uptodate)
-               tp_assign(root_objectid,
-                        BTRFS_I(page->mapping->host)->root->root_key.objectid)
-       ),
-
-       TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
-                 "end = %llu, uptodate = %d",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long)__entry->ino, (unsigned long)__entry->index,
-                 (unsigned long long)__entry->start,
-                 (unsigned long long)__entry->end, __entry->uptodate)
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, page->mapping->host->i_ino)
+               ctf_integer(pgoff_t, index, page->index)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, end, end)
+               ctf_integer(int, uptodate, uptodate)
+               ctf_integer(u64, root_objectid,
+                       BTRFS_I(page->mapping->host)->root->root_key.objectid)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT(btrfs_sync_file,
 
-       TP_PROTO(struct file *file, int datasync),
+       TP_PROTO(const struct file *file, int datasync),
 
        TP_ARGS(file, datasync),
 
-       TP_STRUCT__entry(
-               __field(        ino_t,  ino             )
-               __field(        ino_t,  parent          )
-               __field(        int,    datasync        )
-               __field(        u64,    root_objectid   )
-       ),
-
-       TP_fast_assign(
-               tp_assign(ino, file->f_path.dentry->d_inode->i_ino)
-               tp_assign(parent, file->f_path.dentry->d_parent->d_inode->i_ino)
-               tp_assign(datasync, datasync)
-               tp_assign(root_objectid,
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, file->f_path.dentry->d_inode->i_ino)
+               ctf_integer(ino_t, parent, file->f_path.dentry->d_parent->d_inode->i_ino)
+               ctf_integer(int, datasync, datasync)
+               ctf_integer(u64, root_objectid,
                        BTRFS_I(file->f_path.dentry->d_inode)->root->root_key.objectid)
-       ),
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
+
+       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
 
-       TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long)__entry->ino, (unsigned long)__entry->parent,
-                 __entry->datasync)
+       TP_ARGS(inode, ordered)
 )
 
-LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
 
-       TP_PROTO(int wait),
+       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
 
-       TP_ARGS(wait),
+       TP_ARGS(inode, ordered)
+)
 
-       TP_STRUCT__entry(
-               __field(        int,  wait              )
-       ),
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
 
-       TP_fast_assign(
-               tp_assign(wait, wait)
-       ),
+       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
 
-       TP_printk("wait = %d", __entry->wait)
+       TP_ARGS(inode, ordered)
 )
 
-#define show_ref_action(action)                                                \
-       __print_symbolic(action,                                        \
-               { BTRFS_ADD_DELAYED_REF,    "ADD_DELAYED_REF" },        \
-               { BTRFS_DROP_DELAYED_REF,   "DROP_DELAYED_REF" },       \
-               { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" },     \
-               { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
-                       
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
 
-LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
+       TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
 
-       TP_PROTO(struct btrfs_delayed_ref_node *ref,
-                struct btrfs_delayed_tree_ref *full_ref,
-                int action),
+       TP_ARGS(inode, ordered)
+)
 
-       TP_ARGS(ref, full_ref, action),
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
 
-       TP_STRUCT__entry(
-               __field(        u64,  bytenr            )
-               __field(        u64,  num_bytes         )
-               __field(        int,  action            ) 
-               __field(        u64,  parent            )
-               __field(        u64,  ref_root          )
-               __field(        int,  level             )
-               __field(        int,  type              )
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-               __field(        u64,  seq               )
-#endif
-       ),
-
-       TP_fast_assign(
-               tp_assign(bytenr, ref->bytenr)
-               tp_assign(num_bytes, ref->num_bytes)
-               tp_assign(action, action)
-               tp_assign(parent, full_ref->parent)
-               tp_assign(ref_root, full_ref->root)
-               tp_assign(level, full_ref->level)
-               tp_assign(type, ref->type)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-               tp_assign(seq, ref->seq)
-#endif
-       ),
+       TP_PROTO(struct page *page, struct inode *inode,
+                struct writeback_control *wbc),
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-       TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
-                 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
-                 "type = %s, seq = %llu",
-#else
-       TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
-                 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
-                 "type = %s",
-#endif
-                 (unsigned long long)__entry->bytenr,
-                 (unsigned long long)__entry->num_bytes,
-                 show_ref_action(__entry->action),
-                 show_root_type(__entry->parent),
-                 show_root_type(__entry->ref_root),
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-                 __entry->level, show_ref_type(__entry->type),
-                 (unsigned long long)__entry->seq)
-#else
-                 __entry->level, show_ref_type(__entry->type))
+       TP_ARGS(page, inode, wbc),
+
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, inode->i_ino)
+               ctf_integer(pgoff_t, index, page->index)
+               ctf_integer(long, nr_to_write, wbc->nr_to_write)
+               ctf_integer(long, pages_skipped, wbc->pages_skipped)
+               ctf_integer(loff_t, range_start, wbc->range_start)
+               ctf_integer(loff_t, range_end, wbc->range_end)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
+               ctf_integer(char, nonblocking, wbc->nonblocking)
 #endif
+               ctf_integer(char, for_kupdate, wbc->for_kupdate)
+               ctf_integer(char, for_reclaim, wbc->for_reclaim)
+               ctf_integer(char, range_cyclic, wbc->range_cyclic)
+               ctf_integer(pgoff_t, writeback_index,
+                               inode->i_mapping->writeback_index)
+               ctf_integer(u64, root_objectid,
+                               BTRFS_I(inode)->root->root_key.objectid)
+       )
 )
 
-LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs__writepage,
 
-       TP_PROTO(struct btrfs_delayed_ref_node *ref,
-                struct btrfs_delayed_data_ref *full_ref,
-                int action),
+       __extent_writepage,
 
-       TP_ARGS(ref, full_ref, action),
+       btrfs__extent_writepage,
 
-       TP_STRUCT__entry(
-               __field(        u64,  bytenr            )
-               __field(        u64,  num_bytes         )
-               __field(        int,  action            ) 
-               __field(        u64,  parent            )
-               __field(        u64,  ref_root          )
-               __field(        u64,  owner             )
-               __field(        u64,  offset            )
-               __field(        int,  type              )
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-               __field(        u64,  seq               )
-#endif
-       ),
-
-       TP_fast_assign(
-               tp_assign(bytenr, ref->bytenr)
-               tp_assign(num_bytes, ref->num_bytes)
-               tp_assign(action, action)
-               tp_assign(parent, full_ref->parent)
-               tp_assign(ref_root, full_ref->root)
-               tp_assign(owner, full_ref->objectid)
-               tp_assign(offset, full_ref->offset)
-               tp_assign(type, ref->type)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-               tp_assign(seq, ref->seq)
-#endif
-       ),
+       TP_PROTO(struct page *page, struct inode *inode,
+                struct writeback_control *wbc),
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-       TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
-                 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
-                 "offset = %llu, type = %s, seq = %llu",
-#else
-       TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
-                 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
-                 "offset = %llu, type = %s",
-#endif
-                 (unsigned long long)__entry->bytenr,
-                 (unsigned long long)__entry->num_bytes,
-                 show_ref_action(__entry->action),
-                 show_root_type(__entry->parent),
-                 show_root_type(__entry->ref_root),
-                 (unsigned long long)__entry->owner,
-                 (unsigned long long)__entry->offset,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
-                 show_ref_type(__entry->type),
-                 (unsigned long long)__entry->seq)
-#else
-                 show_ref_type(__entry->type))
-#endif
+       TP_ARGS(page, inode, wbc)
 )
 
-LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+LTTNG_TRACEPOINT_EVENT(btrfs_writepage_end_io_hook,
 
-       TP_PROTO(struct btrfs_delayed_ref_node *ref,
-                struct btrfs_delayed_ref_head *head_ref,
-                int action),
+       TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
 
-       TP_ARGS(ref, head_ref, action),
+       TP_ARGS(page, start, end, uptodate),
 
-       TP_STRUCT__entry(
-               __field(        u64,  bytenr            )
-               __field(        u64,  num_bytes         )
-               __field(        int,  action            ) 
-               __field(        int,  is_data           )
-       ),
-
-       TP_fast_assign(
-               tp_assign(bytenr, ref->bytenr)
-               tp_assign(num_bytes, ref->num_bytes)
-               tp_assign(action, action)
-               tp_assign(is_data, head_ref->is_data)
-       ),
-
-       TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
-                 (unsigned long long)__entry->bytenr,
-                 (unsigned long long)__entry->num_bytes,
-                 show_ref_action(__entry->action),
-                 __entry->is_data)
-)
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
-
-#define show_chunk_type(type)                                  \
-       __print_flags(type, "|",                                \
-               { BTRFS_BLOCK_GROUP_DATA,       "DATA"  },      \
-               { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"},      \
-               { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"},    \
-               { BTRFS_BLOCK_GROUP_RAID0,      "RAID0" },      \
-               { BTRFS_BLOCK_GROUP_RAID1,      "RAID1" },      \
-               { BTRFS_BLOCK_GROUP_DUP,        "DUP"   },      \
-               { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"},      \
-               { BTRFS_BLOCK_GROUP_RAID5,      "RAID5" },      \
-               { BTRFS_BLOCK_GROUP_RAID6,      "RAID6" })
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, page->mapping->host->i_ino)
+               ctf_integer(pgoff_t, index, page->index)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, end, end)
+               ctf_integer(int, uptodate, uptodate)
+               ctf_integer(u64, root_objectid,
+                       BTRFS_I(page->mapping->host)->root->root_key.objectid)
+       )
+)
 
-#else
+LTTNG_TRACEPOINT_EVENT(btrfs_sync_file,
+
+       TP_PROTO(struct file *file, int datasync),
 
-#define show_chunk_type(type)                                  \
-       __print_flags(type, "|",                                \
-               { BTRFS_BLOCK_GROUP_DATA,       "DATA"  },      \
-               { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"},      \
-               { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"},    \
-               { BTRFS_BLOCK_GROUP_RAID0,      "RAID0" },      \
-               { BTRFS_BLOCK_GROUP_RAID1,      "RAID1" },      \
-               { BTRFS_BLOCK_GROUP_DUP,        "DUP"   },      \
-               { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"})
+       TP_ARGS(file, datasync),
 
+       TP_FIELDS(
+               ctf_integer(ino_t, ino, file->f_path.dentry->d_inode->i_ino)
+               ctf_integer(ino_t, parent, file->f_path.dentry->d_parent->d_inode->i_ino)
+               ctf_integer(int, datasync, datasync)
+               ctf_integer(u64, root_objectid,
+                       BTRFS_I(file->f_path.dentry->d_inode)->root->root_key.objectid)
+       )
+)
 #endif
 
-LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
 
-       TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
-                u64 offset, u64 size),
+       TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
 
-       TP_ARGS(root, map, offset, size),
+       TP_ARGS(fs_info, wait),
 
-       TP_STRUCT__entry(
-               __field(        int,  num_stripes               )
-               __field(        u64,  type                      )
-               __field(        int,  sub_stripes               )
-               __field(        u64,  offset                    )
-               __field(        u64,  size                      )
-               __field(        u64,  root_objectid             )
-       ),
-
-       TP_fast_assign(
-               tp_assign(num_stripes, map->num_stripes)
-               tp_assign(type, map->type)
-               tp_assign(sub_stripes, map->sub_stripes)
-               tp_assign(offset, offset)
-               tp_assign(size, size)
-               tp_assign(root_objectid, root->root_key.objectid)
-       ),
-
-       TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
-                 "num_stripes = %d, sub_stripes = %d, type = %s",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long long)__entry->offset,
-                 (unsigned long long)__entry->size,
-                 __entry->num_stripes, __entry->sub_stripes,
-                 show_chunk_type(__entry->type))
+       TP_FIELDS(
+               ctf_integer(int, wait, wait)
+       )
 )
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
 
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_alloc,
+       TP_PROTO(struct btrfs_fs_info *fs_info, int wait),
 
-       TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
-                u64 offset, u64 size),
+       TP_ARGS(fs_info, wait),
 
-       TP_ARGS(root, map, offset, size)
+       TP_FIELDS(
+               ctf_integer(int, wait, wait)
+       )
 )
+#else
+LTTNG_TRACEPOINT_EVENT(btrfs_sync_fs,
 
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_free,
+       TP_PROTO(int wait),
 
-       TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
-                u64 offset, u64 size),
+       TP_ARGS(wait),
 
-       TP_ARGS(root, map, offset, size)
+       TP_FIELDS(
+               ctf_integer(int, wait, wait)
+       )
 )
+#endif
 
-LTTNG_TRACEPOINT_EVENT(btrfs_cow_block,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group,
 
-       TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
-                struct extent_buffer *cow),
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_block_group *block_group, int create),
 
-       TP_ARGS(root, buf, cow),
+       TP_ARGS(fs_info, block_group, create),
 
-       TP_STRUCT__entry(
-               __field(        u64,  root_objectid             )
-               __field(        u64,  buf_start                 )
-               __field(        int,  refs                      )
-               __field(        u64,  cow_start                 )
-               __field(        int,  buf_level                 )
-               __field(        int,  cow_level                 )
-       ),
-
-       TP_fast_assign(
-               tp_assign(root_objectid, root->root_key.objectid)
-               tp_assign(buf_start, buf->start)
-               tp_assign(refs, atomic_read(&buf->refs))
-               tp_assign(cow_start, cow->start)
-               tp_assign(buf_level, btrfs_header_level(buf))
-               tp_assign(cow_level, btrfs_header_level(cow))
-       ),
-
-       TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
-                 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
-                 show_root_type(__entry->root_objectid),
-                 __entry->refs,
-                 (unsigned long long)__entry->buf_start,
-                 __entry->buf_level,
-                 (unsigned long long)__entry->cow_start,
-                 __entry->cow_level)
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, offset, block_group->start)
+               ctf_integer(u64, size, block_group->length)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, bytes_used, block_group->used)
+               ctf_integer(u64, bytes_super, block_group->bytes_super)
+               ctf_integer(int, create, create)
+       )
 )
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
-
-       TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
-                u64 bytes, int reserve),
-
-       TP_ARGS(fs_info, type, val, bytes, reserve),
-
-       TP_STRUCT__entry(
-               __array(        u8,     fsid,   BTRFS_UUID_SIZE )
-               __string(       type,   type                    )
-               __field(        u64,    val                     )
-               __field(        u64,    bytes                   )
-               __field(        int,    reserve                 )
-       ),
-
-       TP_fast_assign(
-               tp_memcpy(fsid, fs_info->fsid, BTRFS_UUID_SIZE)
-               tp_strcpy(type, type)
-               tp_assign(val, val)
-               tp_assign(bytes, bytes)
-               tp_assign(reserve, reserve)
-       ),
-
-       TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type),
-                 __entry->val, __entry->reserve ? "reserve" : "release",
-                 __entry->bytes)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_block_group_cache *block_group, int create),
+
+       TP_ARGS(fs_info, block_group, create),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, offset, block_group->key.objectid)
+               ctf_integer(u64, size, block_group->key.offset)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, bytes_used, btrfs_block_group_used(&block_group->item))
+               ctf_integer(u64, bytes_super, block_group->bytes_super)
+               ctf_integer(int, create, create)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+               struct btrfs_block_group_cache *block_group, int create),
+
+       TP_ARGS(fs_info, block_group, create),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, offset, block_group->key.objectid)
+               ctf_integer(u64, size, block_group->key.offset)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, bytes_used, btrfs_block_group_used(&block_group->item))
+               ctf_integer(u64, bytes_super, block_group->bytes_super)
+               ctf_integer(int, create, create)
+       )
 )
 #endif
 
-LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_tree_ref *full_ref,
+                int action),
 
-       TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
+       TP_ARGS(fs_info, ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(int, level, full_ref->level)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
 
-       TP_ARGS(root, start, len),
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
 
-       TP_STRUCT__entry(
-               __field(        u64,  root_objectid             )
-               __field(        u64,  start                     )
-               __field(        u64,  len                       )
-       ),
+       add_delayed_tree_ref,
 
-       TP_fast_assign(
-               tp_assign(root_objectid, root->root_key.objectid)
-               tp_assign(start, start)
-               tp_assign(len, len)
-       ),
+       btrfs_add_delayed_tree_ref,
 
-       TP_printk("root = %llu(%s), start = %llu, len = %llu",
-                 show_root_type(__entry->root_objectid),
-                 (unsigned long long)__entry->start,
-                 (unsigned long long)__entry->len)
-)
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_tree_ref *full_ref,
+                int action),
 
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
 
-       TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
 
-       TP_ARGS(root, start, len)
-)
+       run_delayed_tree_ref,
 
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_free,
+       btrfs_run_delayed_tree_ref,
 
-       TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_tree_ref *full_ref,
+                int action),
 
-       TP_ARGS(root, start, len)
+       TP_ARGS(fs_info, ref, full_ref, action)
 )
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref,
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
 
-       btrfs_find_free_extent,
+       TP_ARGS(fs_info, ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(int, level, full_ref->level)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
 
-       TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
-                u64 data),
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
 
-       TP_ARGS(root, num_bytes, empty_size, data),
+       add_delayed_tree_ref,
 
-       TP_STRUCT__entry(
-               __field(        u64,    root_objectid           )
-               __field(        u64,    num_bytes               )
-               __field(        u64,    empty_size              )
-               __field(        u64,    data                    )
-       ),
+       btrfs_add_delayed_tree_ref,
 
-       TP_fast_assign(
-               tp_assign(root_objectid, root->root_key.objectid)
-               tp_assign(num_bytes, num_bytes)
-               tp_assign(empty_size, empty_size)
-               tp_assign(data, data)
-       ),
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
 
-       TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
-                 "flags = %Lu(%s)", show_root_type(__entry->root_objectid),
-                 __entry->num_bytes, __entry->empty_size, __entry->data,
-                 __print_flags((unsigned long)__entry->data, "|",
-                                BTRFS_GROUP_FLAGS))
+       TP_ARGS(fs_info, ref, full_ref, action)
 )
 
-LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
+
+       run_delayed_tree_ref,
+
+       btrfs_run_delayed_tree_ref,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,103,92,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(int, level, full_ref->level)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
+
+       add_delayed_tree_ref,
+
+       btrfs_add_delayed_tree_ref,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
+
+       run_delayed_tree_ref,
+
+       btrfs_run_delayed_tree_ref,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(int, level, full_ref->level)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
+
+       add_delayed_tree_ref,
+
+       btrfs_add_delayed_tree_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
+
+       run_delayed_tree_ref,
+
+       btrfs_run_delayed_tree_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(int, level, full_ref->level)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_tree_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(int, level, full_ref->level)
+               ctf_integer(int, type, ref->type)
+       )
+)
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(u64, owner, full_ref->objectid)
+               ctf_integer(u64, offset, full_ref->offset)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       add_delayed_data_ref,
+
+       btrfs_add_delayed_data_ref,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       run_delayed_data_ref,
+
+       btrfs_run_delayed_data_ref,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(u64, owner, full_ref->objectid)
+               ctf_integer(u64, offset, full_ref->offset)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       add_delayed_data_ref,
+
+       btrfs_add_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       run_delayed_data_ref,
+
+       btrfs_run_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,103,92,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(u64, owner, full_ref->objectid)
+               ctf_integer(u64, offset, full_ref->offset)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       add_delayed_data_ref,
+
+       btrfs_add_delayed_data_ref,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       run_delayed_data_ref,
+
+       btrfs_run_delayed_data_ref,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(u64, owner, full_ref->objectid)
+               ctf_integer(u64, offset, full_ref->offset)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       add_delayed_data_ref,
+
+       btrfs_add_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
+
+       run_delayed_data_ref,
+
+       btrfs_run_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, full_ref, action)
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(u64, owner, full_ref->objectid)
+               ctf_integer(u64, offset, full_ref->offset)
+               ctf_integer(int, type, ref->type)
+               ctf_integer(u64, seq, ref->seq)
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_data_ref *full_ref,
+                int action),
+
+       TP_ARGS(ref, full_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(u64, parent, full_ref->parent)
+               ctf_integer(u64, ref_root, full_ref->root)
+               ctf_integer(u64, owner, full_ref->objectid)
+               ctf_integer(u64, offset, full_ref->offset)
+               ctf_integer(int, type, ref->type)
+       )
+)
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, head_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, head_ref->bytenr)
+               ctf_integer(u64, num_bytes, head_ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(int, is_data, head_ref->is_data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       add_delayed_ref_head,
+
+       btrfs_add_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       run_delayed_ref_head,
+
+       btrfs_run_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,4,103,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,114,94,0,0, 4,4,114,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,120,94,0,0, 4,4,120,95,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,126,94,0,0, 4,5,0,0,0,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, head_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(int, is_data, head_ref->is_data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       add_delayed_ref_head,
+
+       btrfs_add_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       run_delayed_ref_head,
+
+       btrfs_run_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, head_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(int, is_data, head_ref->is_data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       add_delayed_ref_head,
+
+       btrfs_add_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       run_delayed_ref_head,
+
+       btrfs_run_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,103,92,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(int, is_data, head_ref->is_data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       add_delayed_ref_head,
+
+       btrfs_add_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       run_delayed_ref_head,
+
+       btrfs_run_delayed_ref_head,
+
+       TP_PROTO(const struct btrfs_delayed_ref_node *ref,
+                const struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(int, is_data, head_ref->is_data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       add_delayed_ref_head,
+
+       btrfs_add_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_ref_head,
+
+       run_delayed_ref_head,
+
+       btrfs_run_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action)
+)
+
+#else
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+
+       TP_PROTO(struct btrfs_delayed_ref_node *ref,
+                struct btrfs_delayed_ref_head *head_ref,
+                int action),
+
+       TP_ARGS(ref, head_ref, action),
+
+       TP_FIELDS(
+               ctf_integer(u64, bytenr, ref->bytenr)
+               ctf_integer(u64, num_bytes, ref->num_bytes)
+               ctf_integer(int, action, action)
+               ctf_integer(int, is_data, head_ref->is_data)
+       )
+)
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, const struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(fs_info, map, offset, size),
+
+       TP_FIELDS(
+               ctf_integer(int, num_stripes, map->num_stripes)
+               ctf_integer(u64, type, map->type)
+               ctf_integer(int, sub_stripes, map->sub_stripes)
+               ctf_integer(u64, offset, offset)
+               ctf_integer(u64, size, size)
+               ctf_integer(u64, root_objectid, fs_info->chunk_root->root_key.objectid)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_alloc,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, const struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(fs_info, map, offset, size)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_free,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, const struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(fs_info, map, offset, size)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(fs_info, map, offset, size),
+
+       TP_FIELDS(
+               ctf_integer(int, num_stripes, map->num_stripes)
+               ctf_integer(u64, type, map->type)
+               ctf_integer(int, sub_stripes, map->sub_stripes)
+               ctf_integer(u64, offset, offset)
+               ctf_integer(u64, size, size)
+               ctf_integer(u64, root_objectid, fs_info->chunk_root->root_key.objectid)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_alloc,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(fs_info, map, offset, size)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_free,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(fs_info, map, offset, size)
+)
+
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
+
+       TP_PROTO(const struct btrfs_root *root, const struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(root, map, offset, size),
+
+       TP_FIELDS(
+               ctf_integer(int, num_stripes, map->num_stripes)
+               ctf_integer(u64, type, map->type)
+               ctf_integer(int, sub_stripes, map->sub_stripes)
+               ctf_integer(u64, offset, offset)
+               ctf_integer(u64, size, size)
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_alloc,
+
+       TP_PROTO(const struct btrfs_root *root, const struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(root, map, offset, size)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_free,
+
+       TP_PROTO(const struct btrfs_root *root, const struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(root, map, offset, size)
+)
+
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__chunk,
+
+       TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(root, map, offset, size),
+
+       TP_FIELDS(
+               ctf_integer(int, num_stripes, map->num_stripes)
+               ctf_integer(u64, type, map->type)
+               ctf_integer(int, sub_stripes, map->sub_stripes)
+               ctf_integer(u64, offset, offset)
+               ctf_integer(u64, size, size)
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_alloc,
+
+       TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(root, map, offset, size)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__chunk,  btrfs_chunk_free,
+
+       TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
+                u64 offset, u64 size),
+
+       TP_ARGS(root, map, offset, size)
+)
+
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_cow_block,
+
+       TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf,
+                const struct extent_buffer *cow),
+
+       TP_ARGS(root, buf, cow),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, buf_start, buf->start)
+               ctf_integer(int, refs, atomic_read(&buf->refs))
+               ctf_integer(u64, cow_start, cow->start)
+               ctf_integer(int, buf_level, btrfs_header_level(buf))
+               ctf_integer(int, cow_level, btrfs_header_level(cow))
+       )
+)
+#else
+LTTNG_TRACEPOINT_EVENT(btrfs_cow_block,
+
+       TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
+                struct extent_buffer *cow),
+
+       TP_ARGS(root, buf, cow),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, buf_start, buf->start)
+               ctf_integer(int, refs, atomic_read(&buf->refs))
+               ctf_integer(u64, cow_start, cow->start)
+               ctf_integer(int, buf_level, btrfs_header_level(buf))
+               ctf_integer(int, cow_level, btrfs_header_level(cow))
+       )
+)
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val,
+                u64 bytes, int reserve),
+
+       TP_ARGS(fs_info, type, val, bytes, reserve),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_string(type, type)
+               ctf_integer(u64, val, val)
+               ctf_integer(u64, bytes, bytes)
+               ctf_integer(int, reserve, reserve)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val,
+                u64 bytes, int reserve),
+
+       TP_ARGS(fs_info, type, val, bytes, reserve),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_string(type, type)
+               ctf_integer(u64, val, val)
+               ctf_integer(u64, bytes, bytes)
+               ctf_integer(int, reserve, reserve)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_space_reservation,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
+                u64 bytes, int reserve),
+
+       TP_ARGS(fs_info, type, val, bytes, reserve),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_string(type, type)
+               ctf_integer(u64, val, val)
+               ctf_integer(u64, bytes, bytes)
+               ctf_integer(int, reserve, reserve)
+       )
+)
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
+
+       TP_ARGS(fs_info, start, len),
+
+       TP_FIELDS(
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
+
+       TP_ARGS(fs_info, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_free,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
+
+       TP_ARGS(fs_info, start, len)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len),
+
+       TP_ARGS(fs_info, start, len),
+
+       TP_FIELDS(
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len),
+
+       TP_ARGS(fs_info, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_free,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len),
+
+       TP_ARGS(fs_info, start, len)
+)
+
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
+
+       TP_PROTO(const struct btrfs_root *root, u64 start, u64 len),
+
+       TP_ARGS(root, start, len),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
+
+       TP_PROTO(const struct btrfs_root *root, u64 start, u64 len),
+
+       TP_ARGS(root, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_free,
+
+       TP_PROTO(const struct btrfs_root *root, u64 start, u64 len),
+
+       TP_ARGS(root, start, len)
+)
+
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserved_extent,
+
+       TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
+
+       TP_ARGS(root, start, len),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
+
+       TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
+
+       TP_ARGS(root, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent,  btrfs_reserved_extent_free,
+
+       TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
+
+       TP_ARGS(root, start, len)
+)
+
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+       btrfs_find_free_extent,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
+                u64 data),
+
+       TP_ARGS(fs_info, num_bytes, empty_size, data),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, num_bytes, num_bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, data, data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+
+       TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(block_group, start, len),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, block_group->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bg_objectid, block_group->start)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
+
+       TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(block_group, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
+
+       TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(block_group, start, len)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+       btrfs_find_free_extent,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
+                u64 data),
+
+       TP_ARGS(fs_info, num_bytes, empty_size, data),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, num_bytes, num_bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, data, data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+
+       TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(block_group, start, len),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, block_group->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
+
+       TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(block_group, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
+
+       TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(block_group, start, len)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+       btrfs_find_free_extent,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
+                u64 data),
+
+       TP_ARGS(fs_info, num_bytes, empty_size, data),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, num_bytes, num_bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, data, data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(fs_info, block_group, start, len),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(fs_info, block_group, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
+
+       TP_PROTO(const struct btrfs_fs_info *fs_info,
+                const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(fs_info, block_group, start, len)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+       btrfs_find_free_extent,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
+                u64 data),
+
+       TP_ARGS(fs_info, num_bytes, empty_size, data),
+
+       TP_FIELDS(
+               ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
+               ctf_integer(u64, num_bytes, num_bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, data, data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(fs_info, block_group, start, len),
+
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(fs_info, block_group, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
+
+       TP_PROTO(struct btrfs_fs_info *fs_info,
+                struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(fs_info, block_group, start, len)
+)
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+       btrfs_find_free_extent,
+
+       TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
+                u64 data),
+
+       TP_ARGS(root, num_bytes, empty_size, data),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, num_bytes, num_bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, data, data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
+
+       TP_PROTO(const struct btrfs_root *root,
+                const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(root, block_group, start, len),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
+
+       TP_PROTO(const struct btrfs_root *root,
+                const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(root, block_group, start, len)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
+
+       TP_PROTO(const struct btrfs_root *root,
+                const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 len),
+
+       TP_ARGS(root, block_group, start, len)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
+
+       btrfs_find_free_extent,
+
+       TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
+                u64 data),
+
+       TP_ARGS(root, num_bytes, empty_size, data),
+
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, num_bytes, num_bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, data, data)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
 
        TP_PROTO(struct btrfs_root *root,
                 struct btrfs_block_group_cache *block_group, u64 start,
@@ -963,28 +2145,13 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
 
        TP_ARGS(root, block_group, start, len),
 
-       TP_STRUCT__entry(
-               __field(        u64,    root_objectid           )
-               __field(        u64,    bg_objectid             )
-               __field(        u64,    flags                   )
-               __field(        u64,    start                   )
-               __field(        u64,    len                     )
-       ),
-
-       TP_fast_assign(
-               tp_assign(root_objectid, root->root_key.objectid)
-               tp_assign(bg_objectid, block_group->key.objectid)
-               tp_assign(flags, block_group->flags)
-               tp_assign(start, start)
-               tp_assign(len, len)
-       ),
-
-       TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
-                 "start = %Lu, len = %Lu",
-                 show_root_type(__entry->root_objectid), __entry->bg_objectid,
-                 __entry->flags, __print_flags((unsigned long)__entry->flags,
-                                               "|", BTRFS_GROUP_FLAGS),
-                 __entry->start, __entry->len)
+       TP_FIELDS(
+               ctf_integer(u64, root_objectid, root->root_key.objectid)
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, len, len)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent,
@@ -1005,54 +2172,129 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
        TP_ARGS(root, block_group, start, len)
 )
 
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
 LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster,
 
-       TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
+       TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
                 u64 bytes, u64 empty_size, u64 min_bytes),
 
        TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
 
-       TP_STRUCT__entry(
-               __field(        u64,    bg_objectid             )
-               __field(        u64,    flags                   )
-               __field(        u64,    start                   )
-               __field(        u64,    bytes                   )
-               __field(        u64,    empty_size              )
-               __field(        u64,    min_bytes               )
-       ),
-
-       TP_fast_assign(
-               tp_assign(bg_objectid, block_group->key.objectid)
-               tp_assign(flags, block_group->flags)
-               tp_assign(start, start)
-               tp_assign(bytes, bytes)
-               tp_assign(empty_size, empty_size)
-               tp_assign(min_bytes, min_bytes)
-       ),
-
-       TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
-                 " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid,
-                 __entry->flags,
-                 __print_flags((unsigned long)__entry->flags, "|",
-                               BTRFS_GROUP_FLAGS), __entry->start,
-                 __entry->bytes, __entry->empty_size,  __entry->min_bytes)
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->start)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, bytes, bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, min_bytes, min_bytes)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup,
 
-       TP_PROTO(struct btrfs_block_group_cache *block_group),
+       TP_PROTO(const struct btrfs_block_group *block_group),
+
+       TP_ARGS(block_group),
+
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->start)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
+
+       TP_PROTO(const struct btrfs_block_group *block_group,
+                const struct btrfs_free_cluster *cluster, u64 size, int bitmap),
+
+       TP_ARGS(block_group, cluster, size, bitmap),
+
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->start)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, cluster->window_start)
+               ctf_integer(u64, max_size, cluster->max_size)
+               ctf_integer(u64, size, size)
+               ctf_integer(int, bitmap, bitmap)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster,
+
+       TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
+                u64 bytes, u64 empty_size, u64 min_bytes),
+
+       TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
+
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, bytes, bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, min_bytes, min_bytes)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup,
+
+       TP_PROTO(const struct btrfs_block_group_cache *block_group),
 
        TP_ARGS(block_group),
 
-       TP_STRUCT__entry(
-               __field(        u64,    bg_objectid             )
-       ),
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
+
+       TP_PROTO(const struct btrfs_block_group_cache *block_group,
+                const struct btrfs_free_cluster *cluster, u64 size, int bitmap),
+
+       TP_ARGS(block_group, cluster, size, bitmap),
+
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, cluster->window_start)
+               ctf_integer(u64, max_size, cluster->max_size)
+               ctf_integer(u64, size, size)
+               ctf_integer(int, bitmap, bitmap)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_find_cluster,
+
+       TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
+                u64 bytes, u64 empty_size, u64 min_bytes),
+
+       TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
+
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, start)
+               ctf_integer(u64, bytes, bytes)
+               ctf_integer(u64, empty_size, empty_size)
+               ctf_integer(u64, min_bytes, min_bytes)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT(btrfs_failed_cluster_setup,
+
+       TP_PROTO(struct btrfs_block_group_cache *block_group),
 
-       TP_fast_assign(
-               tp_assign(bg_objectid, block_group->key.objectid)
-       ),
+       TP_ARGS(block_group),
 
-       TP_printk("block_group = %Lu", __entry->bg_objectid)
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
@@ -1062,57 +2304,64 @@ LTTNG_TRACEPOINT_EVENT(btrfs_setup_cluster,
 
        TP_ARGS(block_group, cluster, size, bitmap),
 
-       TP_STRUCT__entry(
-               __field(        u64,    bg_objectid             )
-               __field(        u64,    flags                   )
-               __field(        u64,    start                   )
-               __field(        u64,    max_size                )
-               __field(        u64,    size                    )
-               __field(        int,    bitmap                  )
-       ),
-
-       TP_fast_assign(
-               tp_assign(bg_objectid, block_group->key.objectid)
-               tp_assign(flags, block_group->flags)
-               tp_assign(start, cluster->window_start)
-               tp_assign(max_size, cluster->max_size)
-               tp_assign(size, size)
-               tp_assign(bitmap, bitmap)
-       ),
-
-       TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
-                 "size = %Lu, max_size = %Lu, bitmap = %d",
-                 __entry->bg_objectid,
-                 __entry->flags,
-                 __print_flags((unsigned long)__entry->flags, "|",
-                               BTRFS_GROUP_FLAGS), __entry->start,
-                 __entry->size, __entry->max_size, __entry->bitmap)
+       TP_FIELDS(
+               ctf_integer(u64, bg_objectid, block_group->key.objectid)
+               ctf_integer(u64, flags, block_group->flags)
+               ctf_integer(u64, start, cluster->window_start)
+               ctf_integer(u64, max_size, cluster->max_size)
+               ctf_integer(u64, size, size)
+               ctf_integer(int, bitmap, bitmap)
+       )
 )
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
+       LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
 LTTNG_TRACEPOINT_EVENT_MAP(alloc_extent_state,
 
        btrfs_alloc_extent_state,
 
-       TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
+       TP_PROTO(const struct extent_state *state, gfp_t mask, unsigned long IP),
 
        TP_ARGS(state, mask, IP),
 
-       TP_STRUCT__entry(
-               __field(struct extent_state *, state)
-               __field(gfp_t, mask)
-               __field(unsigned long, ip)
-       ),
+       TP_FIELDS(
+               ctf_integer_hex(const struct extent_state *, state, state)
+               ctf_integer(gfp_t, mask, mask)
+               ctf_integer(unsigned long, ip, IP)
+       )
+)
+
+LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state,
+
+       btrfs_free_extent_state,
+
+       TP_PROTO(const struct extent_state *state, unsigned long IP),
+
+       TP_ARGS(state, IP),
+
+       TP_FIELDS(
+               ctf_integer_hex(const struct extent_state *, state, state)
+               ctf_integer(unsigned long, ip, IP)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+LTTNG_TRACEPOINT_EVENT_MAP(alloc_extent_state,
+
+       btrfs_alloc_extent_state,
+
+       TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
 
-       TP_fast_assign(
-               tp_assign(state, state)
-               tp_assign(mask, mask)
-               tp_assign(ip, IP)
-       ),
+       TP_ARGS(state, mask, IP),
 
-       TP_printk("state=%p; mask = %s; caller = %pF", __entry->state,
-                 show_gfp_flags(__entry->mask), (void *)__entry->ip)
+       TP_FIELDS(
+               ctf_integer_hex(struct extent_state *, state, state)
+               ctf_integer(gfp_t, mask, mask)
+               ctf_integer(unsigned long, ip, IP)
+       )
 )
 
 LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state,
@@ -1123,22 +2372,14 @@ LTTNG_TRACEPOINT_EVENT_MAP(free_extent_state,
 
        TP_ARGS(state, IP),
 
-       TP_STRUCT__entry(
-               __field(struct extent_state *, state)
-               __field(unsigned long, ip)
-       ),
-
-       TP_fast_assign(
-               tp_assign(state, state)
-               tp_assign(ip, IP)
-       ),
-
-       TP_printk(" state=%p; caller = %pF", __entry->state,
-                 (void *)__entry->ip)
+       TP_FIELDS(
+               ctf_integer_hex(struct extent_state *, state, state)
+               ctf_integer(unsigned long, ip, IP)
+       )
 )
 #endif
 
 #endif /* LTTNG_TRACE_BTRFS_H */
 
 /* This part must be outside protection */
-#include "../../../probes/define_trace.h"
+#include <probes/define_trace.h>
This page took 0.053656 seconds and 4 git commands to generate.