ext4: Add new tracepoint: trace_ext4_da_write_pages()
authorTheodore Ts'o <tytso@mit.edu>
Tue, 1 Sep 2009 03:13:11 +0000 (23:13 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 1 Sep 2009 03:13:11 +0000 (23:13 -0400)
Add a new tracepoint which shows the pages that will be written using
write_cache_pages() by ext4_da_writepages().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/inode.c
include/trace/events/ext4.h

index 41a76e163b998fe335e75a530fcca42145d83dda..81014f4ed22dd3158da2c99daf29f9f172644e6c 100644 (file)
@@ -113,6 +113,21 @@ struct ext4_allocation_request {
        unsigned int flags;
 };
 
+/*
+ * For delayed allocation tracking
+ */
+struct mpage_da_data {
+       struct inode *inode;
+       sector_t b_blocknr;             /* start block number of extent */
+       size_t b_size;                  /* size of extent */
+       unsigned long b_state;          /* state of the extent */
+       unsigned long first_page, next_page;    /* extent of pages */
+       struct writeback_control *wbc;
+       int io_done;
+       int pages_written;
+       int retval;
+};
+
 /*
  * Special inodes numbers
  */
index ff659e75757865057f4633376b0156c66c56aa5e..17802a96af9f70e8214c89378bf748d3ebcd13a5 100644 (file)
@@ -1875,18 +1875,6 @@ static void ext4_da_page_release_reservation(struct page *page,
  * Delayed allocation stuff
  */
 
-struct mpage_da_data {
-       struct inode *inode;
-       sector_t b_blocknr;             /* start block number of extent */
-       size_t b_size;                  /* size of extent */
-       unsigned long b_state;          /* state of the extent */
-       unsigned long first_page, next_page;    /* extent of pages */
-       struct writeback_control *wbc;
-       int io_done;
-       int pages_written;
-       int retval;
-};
-
 /*
  * mpage_da_submit_io - walks through extent of pages and try to write
  * them with writepage() call back
@@ -2863,6 +2851,7 @@ retry:
                        mpd.io_done = 1;
                        ret = MPAGE_DA_EXTENT_TAIL;
                }
+               trace_ext4_da_write_pages(inode, &mpd);
                wbc->nr_to_write -= mpd.pages_written;
 
                ext4_journal_stop(handle);
index 15051d2d1219887486350330e3985272a4ad1a10..dd43399288eae56d993883b897236e8f9d6e254b 100644 (file)
@@ -251,6 +251,40 @@ TRACE_EVENT(ext4_da_writepages,
                  __entry->range_cyclic)
 );
 
+TRACE_EVENT(ext4_da_write_pages,
+       TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),
+
+       TP_ARGS(inode, mpd),
+
+       TP_STRUCT__entry(
+               __field(        dev_t,  dev                     )
+               __field(        ino_t,  ino                     )
+               __field(        __u64,  b_blocknr               )
+               __field(        __u32,  b_size                  )
+               __field(        __u32,  b_state                 )
+               __field(        unsigned long,  first_page      )
+               __field(        int,    io_done                 )
+               __field(        int,    pages_written           )
+       ),
+
+       TP_fast_assign(
+               __entry->dev            = inode->i_sb->s_dev;
+               __entry->ino            = inode->i_ino;
+               __entry->b_blocknr      = mpd->b_blocknr;
+               __entry->b_size         = mpd->b_size;
+               __entry->b_state        = mpd->b_state;
+               __entry->first_page     = mpd->first_page;
+               __entry->io_done        = mpd->io_done;
+               __entry->pages_written  = mpd->pages_written;
+       ),
+
+       TP_printk("dev %s ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d",
+                 jbd2_dev_to_name(__entry->dev), __entry->ino,
+                 __entry->b_blocknr, __entry->b_size,
+                 __entry->b_state, __entry->first_page,
+                 __entry->io_done, __entry->pages_written)
+);
+
 TRACE_EVENT(ext4_da_writepages_result,
        TP_PROTO(struct inode *inode, struct writeback_control *wbc,
                        int ret, int pages_written),