aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-03-27 22:14:10 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-03-27 22:14:10 -0400
commita64c8610bd3b753c6aff58f51c04cdf0ae478c18 (patch)
treeca9ec4d9ca3d7195521a4004c6a599a35faafe5e
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
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>
-rw-r--r--fs/buffer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 891e1c78e4f1..e7ebd95e0c68 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1714,6 +1714,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1714 struct buffer_head *bh, *head; 1714 struct buffer_head *bh, *head;
1715 const unsigned blocksize = 1 << inode->i_blkbits; 1715 const unsigned blocksize = 1 << inode->i_blkbits;
1716 int nr_underway = 0; 1716 int nr_underway = 0;
1717 int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
1717 1718
1718 BUG_ON(!PageLocked(page)); 1719 BUG_ON(!PageLocked(page));
1719 1720
@@ -1805,7 +1806,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1805 do { 1806 do {
1806 struct buffer_head *next = bh->b_this_page; 1807 struct buffer_head *next = bh->b_this_page;
1807 if (buffer_async_write(bh)) { 1808 if (buffer_async_write(bh)) {
1808 submit_bh(WRITE, bh); 1809 submit_bh(write_op, bh);
1809 nr_underway++; 1810 nr_underway++;
1810 } 1811 }
1811 bh = next; 1812 bh = next;
@@ -1859,7 +1860,7 @@ recover:
1859 struct buffer_head *next = bh->b_this_page; 1860 struct buffer_head *next = bh->b_this_page;
1860 if (buffer_async_write(bh)) { 1861 if (buffer_async_write(bh)) {
1861 clear_buffer_dirty(bh); 1862 clear_buffer_dirty(bh);
1862 submit_bh(WRITE, bh); 1863 submit_bh(write_op, bh);
1863 nr_underway++; 1864 nr_underway++;
1864 } 1865 }
1865 bh = next; 1866 bh = next;