aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-28 12:54:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-28 12:54:45 -0400
commit90324cc1b11a211e37eabd8cb863e1a1561d6b1d (patch)
treec8b79c6850420a114ca6660c1b44fc486b1ba86d /include
parentfb8b00675eb6462aacab56bca31ed6107bda5314 (diff)
parent169ebd90131b2ffca74bb2dbe7eeacd39fb83714 (diff)
Merge tag 'writeback' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux
Pull writeback tree from Wu Fengguang: "Mainly from Jan Kara to avoid iput() in the flusher threads." * tag 'writeback' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux: writeback: Avoid iput() from flusher thread vfs: Rename end_writeback() to clear_inode() vfs: Move waiting for inode writeback from end_writeback() to evict_inode() writeback: Refactor writeback_single_inode() writeback: Remove wb->list_lock from writeback_single_inode() writeback: Separate inode requeueing after writeback writeback: Move I_DIRTY_PAGES handling writeback: Move requeueing when I_SYNC set to writeback_sb_inodes() writeback: Move clearing of I_SYNC into inode_sync_complete() writeback: initialize global_dirty_limit fs: remove 8 bytes of padding from struct writeback_control on 64 bit builds mm: page-writeback.c: local functions should not be exposed globally
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h13
-rw-r--r--include/linux/writeback.h10
-rw-r--r--include/trace/events/writeback.h36
3 files changed, 39 insertions, 20 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c0e53372b082..cdc1a9630948 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1764,8 +1764,8 @@ struct super_operations {
1764 * I_FREEING Set when inode is about to be freed but still has dirty 1764 * I_FREEING Set when inode is about to be freed but still has dirty
1765 * pages or buffers attached or the inode itself is still 1765 * pages or buffers attached or the inode itself is still
1766 * dirty. 1766 * dirty.
1767 * I_CLEAR Added by end_writeback(). In this state the inode is clean 1767 * I_CLEAR Added by clear_inode(). In this state the inode is
1768 * and can be destroyed. Inode keeps I_FREEING. 1768 * clean and can be destroyed. Inode keeps I_FREEING.
1769 * 1769 *
1770 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1770 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1771 * prohibited for many purposes. iget() must wait for 1771 * prohibited for many purposes. iget() must wait for
@@ -1773,9 +1773,10 @@ struct super_operations {
1773 * anew. Other functions will just ignore such inodes, 1773 * anew. Other functions will just ignore such inodes,
1774 * if appropriate. I_NEW is used for waiting. 1774 * if appropriate. I_NEW is used for waiting.
1775 * 1775 *
1776 * I_SYNC Synchonized write of dirty inode data. The bits is 1776 * I_SYNC Writeback of inode is running. The bit is set during
1777 * set during data writeback, and cleared with a wakeup 1777 * data writeback, and cleared with a wakeup on the bit
1778 * on the bit address once it is done. 1778 * address once it is done. The bit is also used to pin
1779 * the inode in memory for flusher thread.
1779 * 1780 *
1780 * I_REFERENCED Marks the inode as recently references on the LRU list. 1781 * I_REFERENCED Marks the inode as recently references on the LRU list.
1781 * 1782 *
@@ -2349,7 +2350,7 @@ extern unsigned int get_next_ino(void);
2349 2350
2350extern void __iget(struct inode * inode); 2351extern void __iget(struct inode * inode);
2351extern void iget_failed(struct inode *); 2352extern void iget_failed(struct inode *);
2352extern void end_writeback(struct inode *); 2353extern void clear_inode(struct inode *);
2353extern void __destroy_inode(struct inode *); 2354extern void __destroy_inode(struct inode *);
2354extern struct inode *new_inode_pseudo(struct super_block *sb); 2355extern struct inode *new_inode_pseudo(struct super_block *sb);
2355extern struct inode *new_inode(struct super_block *sb); 2356extern struct inode *new_inode(struct super_block *sb);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a2b84f598e2b..6d0a0fcd80e7 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -58,7 +58,6 @@ extern const char *wb_reason_name[];
58 * in a manner such that unspecified fields are set to zero. 58 * in a manner such that unspecified fields are set to zero.
59 */ 59 */
60struct writeback_control { 60struct writeback_control {
61 enum writeback_sync_modes sync_mode;
62 long nr_to_write; /* Write this many pages, and decrement 61 long nr_to_write; /* Write this many pages, and decrement
63 this for each page written */ 62 this for each page written */
64 long pages_skipped; /* Pages which were not written */ 63 long pages_skipped; /* Pages which were not written */
@@ -71,6 +70,8 @@ struct writeback_control {
71 loff_t range_start; 70 loff_t range_start;
72 loff_t range_end; 71 loff_t range_end;
73 72
73 enum writeback_sync_modes sync_mode;
74
74 unsigned for_kupdate:1; /* A kupdate writeback */ 75 unsigned for_kupdate:1; /* A kupdate writeback */
75 unsigned for_background:1; /* A background writeback */ 76 unsigned for_background:1; /* A background writeback */
76 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ 77 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
@@ -94,6 +95,7 @@ long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
94 enum wb_reason reason); 95 enum wb_reason reason);
95long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 96long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
96void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 97void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
98void inode_wait_for_writeback(struct inode *inode);
97 99
98/* writeback.h requires fs.h; it, too, is not included from here. */ 100/* writeback.h requires fs.h; it, too, is not included from here. */
99static inline void wait_on_inode(struct inode *inode) 101static inline void wait_on_inode(struct inode *inode)
@@ -101,12 +103,6 @@ static inline void wait_on_inode(struct inode *inode)
101 might_sleep(); 103 might_sleep();
102 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); 104 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE);
103} 105}
104static inline void inode_sync_wait(struct inode *inode)
105{
106 might_sleep();
107 wait_on_bit(&inode->i_state, __I_SYNC, inode_wait,
108 TASK_UNINTERRUPTIBLE);
109}
110 106
111 107
112/* 108/*
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 7b81887b023f..b453d92c2253 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -372,6 +372,35 @@ TRACE_EVENT(balance_dirty_pages,
372 ) 372 )
373); 373);
374 374
375TRACE_EVENT(writeback_sb_inodes_requeue,
376
377 TP_PROTO(struct inode *inode),
378 TP_ARGS(inode),
379
380 TP_STRUCT__entry(
381 __array(char, name, 32)
382 __field(unsigned long, ino)
383 __field(unsigned long, state)
384 __field(unsigned long, dirtied_when)
385 ),
386
387 TP_fast_assign(
388 strncpy(__entry->name,
389 dev_name(inode_to_bdi(inode)->dev), 32);
390 __entry->ino = inode->i_ino;
391 __entry->state = inode->i_state;
392 __entry->dirtied_when = inode->dirtied_when;
393 ),
394
395 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu",
396 __entry->name,
397 __entry->ino,
398 show_inode_state(__entry->state),
399 __entry->dirtied_when,
400 (jiffies - __entry->dirtied_when) / HZ
401 )
402);
403
375DECLARE_EVENT_CLASS(writeback_congest_waited_template, 404DECLARE_EVENT_CLASS(writeback_congest_waited_template,
376 405
377 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 406 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
@@ -450,13 +479,6 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template,
450 ) 479 )
451); 480);
452 481
453DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue,
454 TP_PROTO(struct inode *inode,
455 struct writeback_control *wbc,
456 unsigned long nr_to_write),
457 TP_ARGS(inode, wbc, nr_to_write)
458);
459
460DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, 482DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode,
461 TP_PROTO(struct inode *inode, 483 TP_PROTO(struct inode *inode,
462 struct writeback_control *wbc, 484 struct writeback_control *wbc,