summaryrefslogtreecommitdiffstats
path: root/fs/fs-writeback.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-11 16:37:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-12 14:13:07 -0400
commit505a666ee3fc611518e85df203eb8c707995ceaa (patch)
treec4df72f1504a245d027e7c3c7617e3d08c0c7385 /fs/fs-writeback.c
parent0ba13fd19d39b7cb672bcec052bc813389c079a4 (diff)
writeback: plug writeback in wb_writeback() and writeback_inodes_wb()
We had to revert the pluggin in writeback_sb_inodes() because the wb->list_lock is held, but we could easily plug at a higher level before taking that lock, and unplug after releasing it. This does that. Chris will run performance numbers, just to verify that this approach is comparable to the alternative (we could just drop and re-take the lock around the blk_finish_plug() rather than these two commits. I'd have preferred waiting for actual performance numbers before picking one approach over the other, but I don't want to release rc1 with the known "sleeping function called from invalid context" issue, so I'll pick this cleanup version for now. But if the numbers show that we really want to plug just at the writeback_sb_inodes() level, and we should just play ugly games with the spinlock, we'll switch to that. Cc: Chris Mason <clm@fb.com> Cc: Josef Bacik <jbacik@fb.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Neil Brown <neilb@suse.de> Cc: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r--fs/fs-writeback.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index d8ea7ed411b2..587ac08eabb6 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1546,12 +1546,15 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
1546 .range_cyclic = 1, 1546 .range_cyclic = 1,
1547 .reason = reason, 1547 .reason = reason,
1548 }; 1548 };
1549 struct blk_plug plug;
1549 1550
1551 blk_start_plug(&plug);
1550 spin_lock(&wb->list_lock); 1552 spin_lock(&wb->list_lock);
1551 if (list_empty(&wb->b_io)) 1553 if (list_empty(&wb->b_io))
1552 queue_io(wb, &work); 1554 queue_io(wb, &work);
1553 __writeback_inodes_wb(wb, &work); 1555 __writeback_inodes_wb(wb, &work);
1554 spin_unlock(&wb->list_lock); 1556 spin_unlock(&wb->list_lock);
1557 blk_finish_plug(&plug);
1555 1558
1556 return nr_pages - work.nr_pages; 1559 return nr_pages - work.nr_pages;
1557} 1560}
@@ -1579,10 +1582,12 @@ static long wb_writeback(struct bdi_writeback *wb,
1579 unsigned long oldest_jif; 1582 unsigned long oldest_jif;
1580 struct inode *inode; 1583 struct inode *inode;
1581 long progress; 1584 long progress;
1585 struct blk_plug plug;
1582 1586
1583 oldest_jif = jiffies; 1587 oldest_jif = jiffies;
1584 work->older_than_this = &oldest_jif; 1588 work->older_than_this = &oldest_jif;
1585 1589
1590 blk_start_plug(&plug);
1586 spin_lock(&wb->list_lock); 1591 spin_lock(&wb->list_lock);
1587 for (;;) { 1592 for (;;) {
1588 /* 1593 /*
@@ -1662,6 +1667,7 @@ static long wb_writeback(struct bdi_writeback *wb,
1662 } 1667 }
1663 } 1668 }
1664 spin_unlock(&wb->list_lock); 1669 spin_unlock(&wb->list_lock);
1670 blk_finish_plug(&plug);
1665 1671
1666 return nr_pages - work->nr_pages; 1672 return nr_pages - work->nr_pages;
1667} 1673}