writeback: make writeback_control.nr_to_write straight
Pass struct wb_writeback_work all the way down to writeback_sb_inodes(), and initialize the struct writeback_control there. struct writeback_control is basically designed to control writeback of a single file, but we keep abuse it for writing multiple files in writeback_sb_inodes() and its callers. It immediately clean things up, e.g. suddenly wbc.nr_to_write vs work->nr_pages starts to make sense, and instead of saving and restoring pages_skipped in writeback_sb_inodes it can always start with a clean zero value. It also makes a neat IO pattern change: large dirty files are now written in the full 4MB writeback chunk size, rather than whatever remained quota in wbc->nr_to_write. Acked-by: Jan Kara <jack@suse.cz> Proposed-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
This commit is contained in:
@@ -62,6 +62,9 @@ DEFINE_EVENT(writeback_work_class, name, \
|
||||
DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
|
||||
DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
|
||||
DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
|
||||
DEFINE_WRITEBACK_WORK_EVENT(writeback_start);
|
||||
DEFINE_WRITEBACK_WORK_EVENT(writeback_written);
|
||||
DEFINE_WRITEBACK_WORK_EVENT(writeback_wait);
|
||||
|
||||
TRACE_EVENT(writeback_pages_written,
|
||||
TP_PROTO(long pages_written),
|
||||
@@ -101,6 +104,30 @@ DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
|
||||
DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
|
||||
DEFINE_WRITEBACK_EVENT(writeback_thread_start);
|
||||
DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
|
||||
DEFINE_WRITEBACK_EVENT(balance_dirty_start);
|
||||
DEFINE_WRITEBACK_EVENT(balance_dirty_wait);
|
||||
|
||||
TRACE_EVENT(balance_dirty_written,
|
||||
|
||||
TP_PROTO(struct backing_dev_info *bdi, int written),
|
||||
|
||||
TP_ARGS(bdi, written),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array(char, name, 32)
|
||||
__field(int, written)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
strncpy(__entry->name, dev_name(bdi->dev), 32);
|
||||
__entry->written = written;
|
||||
),
|
||||
|
||||
TP_printk("bdi %s written %d",
|
||||
__entry->name,
|
||||
__entry->written
|
||||
)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(wbc_class,
|
||||
TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
|
||||
@@ -114,7 +141,6 @@ DECLARE_EVENT_CLASS(wbc_class,
|
||||
__field(int, for_background)
|
||||
__field(int, for_reclaim)
|
||||
__field(int, range_cyclic)
|
||||
__field(unsigned long, older_than_this)
|
||||
__field(long, range_start)
|
||||
__field(long, range_end)
|
||||
),
|
||||
@@ -128,14 +154,12 @@ DECLARE_EVENT_CLASS(wbc_class,
|
||||
__entry->for_background = wbc->for_background;
|
||||
__entry->for_reclaim = wbc->for_reclaim;
|
||||
__entry->range_cyclic = wbc->range_cyclic;
|
||||
__entry->older_than_this = wbc->older_than_this ?
|
||||
*wbc->older_than_this : 0;
|
||||
__entry->range_start = (long)wbc->range_start;
|
||||
__entry->range_end = (long)wbc->range_end;
|
||||
),
|
||||
|
||||
TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
|
||||
"bgrd=%d reclm=%d cyclic=%d older=0x%lx "
|
||||
"bgrd=%d reclm=%d cyclic=%d "
|
||||
"start=0x%lx end=0x%lx",
|
||||
__entry->name,
|
||||
__entry->nr_to_write,
|
||||
@@ -145,7 +169,6 @@ DECLARE_EVENT_CLASS(wbc_class,
|
||||
__entry->for_background,
|
||||
__entry->for_reclaim,
|
||||
__entry->range_cyclic,
|
||||
__entry->older_than_this,
|
||||
__entry->range_start,
|
||||
__entry->range_end)
|
||||
)
|
||||
@@ -154,12 +177,6 @@ DECLARE_EVENT_CLASS(wbc_class,
|
||||
DEFINE_EVENT(wbc_class, name, \
|
||||
TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
|
||||
TP_ARGS(wbc, bdi))
|
||||
DEFINE_WBC_EVENT(wbc_writeback_start);
|
||||
DEFINE_WBC_EVENT(wbc_writeback_written);
|
||||
DEFINE_WBC_EVENT(wbc_writeback_wait);
|
||||
DEFINE_WBC_EVENT(wbc_balance_dirty_start);
|
||||
DEFINE_WBC_EVENT(wbc_balance_dirty_written);
|
||||
DEFINE_WBC_EVENT(wbc_balance_dirty_wait);
|
||||
DEFINE_WBC_EVENT(wbc_writepage);
|
||||
|
||||
TRACE_EVENT(writeback_queue_io,
|
||||
|
Reference in New Issue
Block a user