diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2011-04-23 13:26:07 -0400 |
---|---|---|
committer | Wu Fengguang <fengguang.wu@intel.com> | 2011-06-07 20:25:22 -0400 |
commit | e185dda89d69cde142b48059413a03561f41f78a (patch) | |
tree | 505fa875bdf7968892882a1f93993c9114d768b0 | |
parent | e8dfc30582995ae12454cda517b17d6294175b07 (diff) |
writeback: avoid extra sync work at enqueue time
This removes writeback_control.wb_start and does more straightforward
sync livelock prevention by setting .older_than_this to prevent extra
inodes from being enqueued in the first place.
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
-rw-r--r-- | fs/fs-writeback.c | 16 | ||||
-rw-r--r-- | include/linux/writeback.h | 3 |
2 files changed, 3 insertions, 16 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 565b1fd15be6..d0553f33fb50 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -544,15 +544,6 @@ static int writeback_sb_inodes(struct super_block *sb, struct bdi_writeback *wb, | |||
544 | continue; | 544 | continue; |
545 | } | 545 | } |
546 | 546 | ||
547 | /* | ||
548 | * Was this inode dirtied after sync_sb_inodes was called? | ||
549 | * This keeps sync from extra jobs and livelock. | ||
550 | */ | ||
551 | if (inode_dirtied_after(inode, wbc->wb_start)) { | ||
552 | spin_unlock(&inode->i_lock); | ||
553 | return 1; | ||
554 | } | ||
555 | |||
556 | __iget(inode); | 547 | __iget(inode); |
557 | 548 | ||
558 | pages_skipped = wbc->pages_skipped; | 549 | pages_skipped = wbc->pages_skipped; |
@@ -585,9 +576,6 @@ static void __writeback_inodes_wb(struct bdi_writeback *wb, | |||
585 | { | 576 | { |
586 | int ret = 0; | 577 | int ret = 0; |
587 | 578 | ||
588 | if (!wbc->wb_start) | ||
589 | wbc->wb_start = jiffies; /* livelock avoidance */ | ||
590 | |||
591 | while (!list_empty(&wb->b_io)) { | 579 | while (!list_empty(&wb->b_io)) { |
592 | struct inode *inode = wb_inode(wb->b_io.prev); | 580 | struct inode *inode = wb_inode(wb->b_io.prev); |
593 | struct super_block *sb = inode->i_sb; | 581 | struct super_block *sb = inode->i_sb; |
@@ -686,7 +674,9 @@ static long wb_writeback(struct bdi_writeback *wb, | |||
686 | if (wbc.sync_mode == WB_SYNC_ALL || wbc.tagged_writepages) | 674 | if (wbc.sync_mode == WB_SYNC_ALL || wbc.tagged_writepages) |
687 | write_chunk = LONG_MAX; | 675 | write_chunk = LONG_MAX; |
688 | 676 | ||
689 | wbc.wb_start = jiffies; /* livelock avoidance */ | 677 | oldest_jif = jiffies; |
678 | wbc.older_than_this = &oldest_jif; | ||
679 | |||
690 | spin_lock(&wb->list_lock); | 680 | spin_lock(&wb->list_lock); |
691 | for (;;) { | 681 | for (;;) { |
692 | /* | 682 | /* |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index c2d957fb38d3..d8e96a480850 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -26,9 +26,6 @@ struct writeback_control { | |||
26 | enum writeback_sync_modes sync_mode; | 26 | enum writeback_sync_modes sync_mode; |
27 | unsigned long *older_than_this; /* If !NULL, only write back inodes | 27 | unsigned long *older_than_this; /* If !NULL, only write back inodes |
28 | older than this */ | 28 | older than this */ |
29 | unsigned long wb_start; /* Time writeback_inodes_wb was | ||
30 | called. This is needed to avoid | ||
31 | extra jobs and livelock */ | ||
32 | long nr_to_write; /* Write this many pages, and decrement | 29 | long nr_to_write; /* Write this many pages, and decrement |
33 | this for each page written */ | 30 | this for each page written */ |
34 | long pages_skipped; /* Pages which were not written */ | 31 | long pages_skipped; /* Pages which were not written */ |