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>

Changed files
+6
fs
+6
fs/fs-writeback.c
··· 1546 1546 .range_cyclic = 1, 1547 1547 .reason = reason, 1548 1548 }; 1549 + struct blk_plug plug; 1549 1550 1551 + blk_start_plug(&plug); 1550 1552 spin_lock(&wb->list_lock); 1551 1553 if (list_empty(&wb->b_io)) 1552 1554 queue_io(wb, &work); 1553 1555 __writeback_inodes_wb(wb, &work); 1554 1556 spin_unlock(&wb->list_lock); 1557 + blk_finish_plug(&plug); 1555 1558 1556 1559 return nr_pages - work.nr_pages; 1557 1560 } ··· 1582 1579 unsigned long oldest_jif; 1583 1580 struct inode *inode; 1584 1581 long progress; 1582 + struct blk_plug plug; 1585 1583 1586 1584 oldest_jif = jiffies; 1587 1585 work->older_than_this = &oldest_jif; 1588 1586 1587 + blk_start_plug(&plug); 1589 1588 spin_lock(&wb->list_lock); 1590 1589 for (;;) { 1591 1590 /* ··· 1667 1662 } 1668 1663 } 1669 1664 spin_unlock(&wb->list_lock); 1665 + blk_finish_plug(&plug); 1670 1666 1671 1667 return nr_pages - work->nr_pages; 1672 1668 }