diff options
author | Jan Kara <jack@suse.cz> | 2013-06-04 13:17:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-06-04 13:17:40 -0400 |
commit | 4e7ea81db53465ddd753678bc4cebf95369d0984 (patch) | |
tree | 39d71bab48ba0406c17410aa37d291485cd00b17 /include/trace/events/ext4.h | |
parent | fffb273997cc52f255bde5f18e7f6b4686c914fb (diff) |
ext4: restructure writeback path
There are two issues with current writeback path in ext4. For one we
don't necessarily map complete pages when blocksize < pagesize and
thus needn't do any writeback in one iteration. We always map some
blocks though so we will eventually finish mapping the page. Just if
writeback races with other operations on the file, forward progress is
not really guaranteed. The second problem is that current code
structure makes it hard to associate all the bios to some range of
pages with one io_end structure so that unwritten extents can be
converted after all the bios are finished. This will be especially
difficult later when io_end will be associated with reserved
transaction handle.
We restructure the writeback path to a relatively simple loop which
first prepares extent of pages, then maps one or more extents so that
no page is partially mapped, and once page is fully mapped it is
submitted for IO. We keep all the mapping and IO submission
information in mpage_da_data structure to somewhat reduce stack usage.
Resulting code is somewhat shorter than the old one and hopefully also
easier to read.
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/trace/events/ext4.h')
-rw-r--r-- | include/trace/events/ext4.h | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 1f2ea7140d56..832a412e6515 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -324,43 +324,59 @@ TRACE_EVENT(ext4_da_writepages, | |||
324 | ); | 324 | ); |
325 | 325 | ||
326 | TRACE_EVENT(ext4_da_write_pages, | 326 | TRACE_EVENT(ext4_da_write_pages, |
327 | TP_PROTO(struct inode *inode, struct mpage_da_data *mpd), | 327 | TP_PROTO(struct inode *inode, pgoff_t first_page, |
328 | struct writeback_control *wbc), | ||
328 | 329 | ||
329 | TP_ARGS(inode, mpd), | 330 | TP_ARGS(inode, first_page, wbc), |
330 | 331 | ||
331 | TP_STRUCT__entry( | 332 | TP_STRUCT__entry( |
332 | __field( dev_t, dev ) | 333 | __field( dev_t, dev ) |
333 | __field( ino_t, ino ) | 334 | __field( ino_t, ino ) |
334 | __field( __u64, b_blocknr ) | 335 | __field( pgoff_t, first_page ) |
335 | __field( __u32, b_size ) | 336 | __field( long, nr_to_write ) |
336 | __field( __u32, b_state ) | 337 | __field( int, sync_mode ) |
337 | __field( unsigned long, first_page ) | ||
338 | __field( int, io_done ) | ||
339 | __field( int, pages_written ) | ||
340 | __field( int, sync_mode ) | ||
341 | ), | 338 | ), |
342 | 339 | ||
343 | TP_fast_assign( | 340 | TP_fast_assign( |
344 | __entry->dev = inode->i_sb->s_dev; | 341 | __entry->dev = inode->i_sb->s_dev; |
345 | __entry->ino = inode->i_ino; | 342 | __entry->ino = inode->i_ino; |
346 | __entry->b_blocknr = mpd->b_blocknr; | 343 | __entry->first_page = first_page; |
347 | __entry->b_size = mpd->b_size; | 344 | __entry->nr_to_write = wbc->nr_to_write; |
348 | __entry->b_state = mpd->b_state; | 345 | __entry->sync_mode = wbc->sync_mode; |
349 | __entry->first_page = mpd->first_page; | ||
350 | __entry->io_done = mpd->io_done; | ||
351 | __entry->pages_written = mpd->pages_written; | ||
352 | __entry->sync_mode = mpd->wbc->sync_mode; | ||
353 | ), | 346 | ), |
354 | 347 | ||
355 | TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x " | 348 | TP_printk("dev %d,%d ino %lu first_page %lu nr_to_write %ld " |
356 | "first_page %lu io_done %d pages_written %d sync_mode %d", | 349 | "sync_mode %d", |
357 | MAJOR(__entry->dev), MINOR(__entry->dev), | 350 | MAJOR(__entry->dev), MINOR(__entry->dev), |
358 | (unsigned long) __entry->ino, | 351 | (unsigned long) __entry->ino, __entry->first_page, |
359 | __entry->b_blocknr, __entry->b_size, | 352 | __entry->nr_to_write, __entry->sync_mode) |
360 | __entry->b_state, __entry->first_page, | 353 | ); |
361 | __entry->io_done, __entry->pages_written, | 354 | |
362 | __entry->sync_mode | 355 | TRACE_EVENT(ext4_da_write_pages_extent, |
363 | ) | 356 | TP_PROTO(struct inode *inode, struct ext4_map_blocks *map), |
357 | |||
358 | TP_ARGS(inode, map), | ||
359 | |||
360 | TP_STRUCT__entry( | ||
361 | __field( dev_t, dev ) | ||
362 | __field( ino_t, ino ) | ||
363 | __field( __u64, lblk ) | ||
364 | __field( __u32, len ) | ||
365 | __field( __u32, flags ) | ||
366 | ), | ||
367 | |||
368 | TP_fast_assign( | ||
369 | __entry->dev = inode->i_sb->s_dev; | ||
370 | __entry->ino = inode->i_ino; | ||
371 | __entry->lblk = map->m_lblk; | ||
372 | __entry->len = map->m_len; | ||
373 | __entry->flags = map->m_flags; | ||
374 | ), | ||
375 | |||
376 | TP_printk("dev %d,%d ino %lu lblk %llu len %u flags 0x%04x", | ||
377 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
378 | (unsigned long) __entry->ino, __entry->lblk, __entry->len, | ||
379 | __entry->flags) | ||
364 | ); | 380 | ); |
365 | 381 | ||
366 | TRACE_EVENT(ext4_da_writepages_result, | 382 | TRACE_EVENT(ext4_da_writepages_result, |