Commit a64c8610bd3b753c6aff58f51c04cdf0ae478c18
1 parent
8e0ee43bc2
Exists in
master
and in
7 other branches
block_write_full_page: Use synchronous writes for WBC_SYNC_ALL writebacks
When doing synchronous writes because wbc->sync_mode is set to WBC_SYNC_ALL, send the write request using WRITE_SYNC, so that we don't unduly block system calls such as fsync(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Acked-by: Jan Kara <jack@suse.cz>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
fs/buffer.c
... | ... | @@ -1714,6 +1714,7 @@ |
1714 | 1714 | struct buffer_head *bh, *head; |
1715 | 1715 | const unsigned blocksize = 1 << inode->i_blkbits; |
1716 | 1716 | int nr_underway = 0; |
1717 | + int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE); | |
1717 | 1718 | |
1718 | 1719 | BUG_ON(!PageLocked(page)); |
1719 | 1720 | |
... | ... | @@ -1805,7 +1806,7 @@ |
1805 | 1806 | do { |
1806 | 1807 | struct buffer_head *next = bh->b_this_page; |
1807 | 1808 | if (buffer_async_write(bh)) { |
1808 | - submit_bh(WRITE, bh); | |
1809 | + submit_bh(write_op, bh); | |
1809 | 1810 | nr_underway++; |
1810 | 1811 | } |
1811 | 1812 | bh = next; |
... | ... | @@ -1859,7 +1860,7 @@ |
1859 | 1860 | struct buffer_head *next = bh->b_this_page; |
1860 | 1861 | if (buffer_async_write(bh)) { |
1861 | 1862 | clear_buffer_dirty(bh); |
1862 | - submit_bh(WRITE, bh); | |
1863 | + submit_bh(write_op, bh); | |
1863 | 1864 | nr_underway++; |
1864 | 1865 | } |
1865 | 1866 | bh = next; |