[XFS] fix writeback control handling fix a reversed condition on where to trylock and deal with block layer congestion properly. Patch from David Chinner and Christoph Hellwig.

SGI-PV: 947118
SGI-Modid: xfs-linux-melb:xfs-kern:203830a

Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>

authored by Christoph Hellwig and committed by Nathan Scott f5e596bb 6c4fe19f

+12 -3
+12 -3
fs/xfs/linux-2.6/xfs_aops.c
··· 722 SetPageUptodate(page); 723 724 if (startio) { 725 - if (count) 726 - wbc->nr_to_write--; 727 xfs_start_page_writeback(page, wbc, !page_dirty, count); 728 } 729 ··· 821 int all_bh = unmapped; 822 823 /* wait for other IO threads? */ 824 - if (startio && wbc->sync_mode != WB_SYNC_NONE) 825 trylock_flag |= BMAPI_TRYLOCK; 826 827 /* Is this page beyond the end of the file? */
··· 722 SetPageUptodate(page); 723 724 if (startio) { 725 + if (count) { 726 + struct backing_dev_info *bdi; 727 + 728 + bdi = inode->i_mapping->backing_dev_info; 729 + if (bdi_write_congested(bdi)) { 730 + wbc->encountered_congestion = 1; 731 + done = 1; 732 + } else if (--wbc->nr_to_write <= 0) { 733 + done = 1; 734 + } 735 + } 736 xfs_start_page_writeback(page, wbc, !page_dirty, count); 737 } 738 ··· 812 int all_bh = unmapped; 813 814 /* wait for other IO threads? */ 815 + if (startio && (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)) 816 trylock_flag |= BMAPI_TRYLOCK; 817 818 /* Is this page beyond the end of the file? */