diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-08-31 23:13:11 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-08-31 23:13:11 -0400 |
commit | b3a3ca8ca0c3c29abc5b2bfe94bb14f3f4590df9 (patch) | |
tree | 1006f780d43ec8ff90ed11b1eb0d5ed961c9f613 | |
parent | de89de6e0cf4b1eb13f27137cf2aa40d287aabdf (diff) |
ext4: Add new tracepoint: trace_ext4_da_write_pages()
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>
-rw-r--r-- | fs/ext4/ext4.h | 15 | ||||
-rw-r--r-- | fs/ext4/inode.c | 13 | ||||
-rw-r--r-- | include/trace/events/ext4.h | 34 |
3 files changed, 50 insertions, 12 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 41a76e163b99..81014f4ed22d 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -114,6 +114,21 @@ struct ext4_allocation_request { | |||
114 | }; | 114 | }; |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * For delayed allocation tracking | ||
118 | */ | ||
119 | struct mpage_da_data { | ||
120 | struct inode *inode; | ||
121 | sector_t b_blocknr; /* start block number of extent */ | ||
122 | size_t b_size; /* size of extent */ | ||
123 | unsigned long b_state; /* state of the extent */ | ||
124 | unsigned long first_page, next_page; /* extent of pages */ | ||
125 | struct writeback_control *wbc; | ||
126 | int io_done; | ||
127 | int pages_written; | ||
128 | int retval; | ||
129 | }; | ||
130 | |||
131 | /* | ||
117 | * Special inodes numbers | 132 | * Special inodes numbers |
118 | */ | 133 | */ |
119 | #define EXT4_BAD_INO 1 /* Bad blocks inode */ | 134 | #define EXT4_BAD_INO 1 /* Bad blocks inode */ |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ff659e757578..17802a96af9f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1875,18 +1875,6 @@ static void ext4_da_page_release_reservation(struct page *page, | |||
1875 | * Delayed allocation stuff | 1875 | * Delayed allocation stuff |
1876 | */ | 1876 | */ |
1877 | 1877 | ||
1878 | struct mpage_da_data { | ||
1879 | struct inode *inode; | ||
1880 | sector_t b_blocknr; /* start block number of extent */ | ||
1881 | size_t b_size; /* size of extent */ | ||
1882 | unsigned long b_state; /* state of the extent */ | ||
1883 | unsigned long first_page, next_page; /* extent of pages */ | ||
1884 | struct writeback_control *wbc; | ||
1885 | int io_done; | ||
1886 | int pages_written; | ||
1887 | int retval; | ||
1888 | }; | ||
1889 | |||
1890 | /* | 1878 | /* |
1891 | * mpage_da_submit_io - walks through extent of pages and try to write | 1879 | * mpage_da_submit_io - walks through extent of pages and try to write |
1892 | * them with writepage() call back | 1880 | * them with writepage() call back |
@@ -2863,6 +2851,7 @@ retry: | |||
2863 | mpd.io_done = 1; | 2851 | mpd.io_done = 1; |
2864 | ret = MPAGE_DA_EXTENT_TAIL; | 2852 | ret = MPAGE_DA_EXTENT_TAIL; |
2865 | } | 2853 | } |
2854 | trace_ext4_da_write_pages(inode, &mpd); | ||
2866 | wbc->nr_to_write -= mpd.pages_written; | 2855 | wbc->nr_to_write -= mpd.pages_written; |
2867 | 2856 | ||
2868 | ext4_journal_stop(handle); | 2857 | ext4_journal_stop(handle); |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 15051d2d1219..dd43399288ea 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -251,6 +251,40 @@ TRACE_EVENT(ext4_da_writepages, | |||
251 | __entry->range_cyclic) | 251 | __entry->range_cyclic) |
252 | ); | 252 | ); |
253 | 253 | ||
254 | TRACE_EVENT(ext4_da_write_pages, | ||
255 | TP_PROTO(struct inode *inode, struct mpage_da_data *mpd), | ||
256 | |||
257 | TP_ARGS(inode, mpd), | ||
258 | |||
259 | TP_STRUCT__entry( | ||
260 | __field( dev_t, dev ) | ||
261 | __field( ino_t, ino ) | ||
262 | __field( __u64, b_blocknr ) | ||
263 | __field( __u32, b_size ) | ||
264 | __field( __u32, b_state ) | ||
265 | __field( unsigned long, first_page ) | ||
266 | __field( int, io_done ) | ||
267 | __field( int, pages_written ) | ||
268 | ), | ||
269 | |||
270 | TP_fast_assign( | ||
271 | __entry->dev = inode->i_sb->s_dev; | ||
272 | __entry->ino = inode->i_ino; | ||
273 | __entry->b_blocknr = mpd->b_blocknr; | ||
274 | __entry->b_size = mpd->b_size; | ||
275 | __entry->b_state = mpd->b_state; | ||
276 | __entry->first_page = mpd->first_page; | ||
277 | __entry->io_done = mpd->io_done; | ||
278 | __entry->pages_written = mpd->pages_written; | ||
279 | ), | ||
280 | |||
281 | 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", | ||
282 | jbd2_dev_to_name(__entry->dev), __entry->ino, | ||
283 | __entry->b_blocknr, __entry->b_size, | ||
284 | __entry->b_state, __entry->first_page, | ||
285 | __entry->io_done, __entry->pages_written) | ||
286 | ); | ||
287 | |||
254 | TRACE_EVENT(ext4_da_writepages_result, | 288 | TRACE_EVENT(ext4_da_writepages_result, |
255 | TP_PROTO(struct inode *inode, struct writeback_control *wbc, | 289 | TP_PROTO(struct inode *inode, struct writeback_control *wbc, |
256 | int ret, int pages_written), | 290 | int ret, int pages_written), |