ext4: Add a tracepoint for ext4_alloc_da_blocks()
authorTheodore Ts'o <tytso@mit.edu>
Wed, 16 Sep 2009 23:30:40 +0000 (19:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 16 Sep 2009 23:30:40 +0000 (19:30 -0400)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/inode.c
include/trace/events/ext4.h

index a5b4ce40cc6648ce250973f746d664138780dc9c..9887a0c562d56b2c396aa9e577e8a80e75438ed4 100644 (file)
@@ -3128,6 +3128,8 @@ out:
  */
 int ext4_alloc_da_blocks(struct inode *inode)
 {
+       trace_ext4_alloc_da_blocks(inode);
+
        if (!EXT4_I(inode)->i_reserved_data_blocks &&
            !EXT4_I(inode)->i_reserved_meta_blocks)
                return 0;
index 6fe6ce9ee071423e5a114579e6edea3e50f5988e..c1bd8f1e8b94e0eefcf67b45a398c0bc07ccc37c 100644 (file)
@@ -10,6 +10,9 @@
 struct ext4_allocation_context;
 struct ext4_allocation_request;
 struct ext4_prealloc_space;
+struct ext4_inode_info;
+
+#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
 
 TRACE_EVENT(ext4_free_inode,
        TP_PROTO(struct inode *inode),
@@ -710,6 +713,30 @@ TRACE_EVENT(ext4_sync_fs,
                  __entry->wait)
 );
 
+TRACE_EVENT(ext4_alloc_da_blocks,
+       TP_PROTO(struct inode *inode),
+
+       TP_ARGS(inode),
+
+       TP_STRUCT__entry(
+               __field(        dev_t,  dev                     )
+               __field(        ino_t,  ino                     )
+               __field( unsigned int,  data_blocks     )
+               __field( unsigned int,  meta_blocks     )
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = inode->i_sb->s_dev;
+               __entry->ino    = inode->i_ino;
+               __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
+               __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
+       ),
+
+       TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u",
+                 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
+                 __entry->data_blocks, __entry->meta_blocks)
+);
+
 #endif /* _TRACE_EXT4_H */
 
 /* This part must be outside protection */