Commit a64c8610 authored by Theodore Ts'o's avatar Theodore Ts'o

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: default avatar"Theodore Ts'o" <tytso@mit.edu>
Acked-by: default avatarJan Kara <jack@suse.cz>
parent 8e0ee43b
...@@ -1714,6 +1714,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, ...@@ -1714,6 +1714,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
const unsigned blocksize = 1 << inode->i_blkbits; const unsigned blocksize = 1 << inode->i_blkbits;
int nr_underway = 0; int nr_underway = 0;
int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
BUG_ON(!PageLocked(page)); BUG_ON(!PageLocked(page));
...@@ -1805,7 +1806,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, ...@@ -1805,7 +1806,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
do { do {
struct buffer_head *next = bh->b_this_page; struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) { if (buffer_async_write(bh)) {
submit_bh(WRITE, bh); submit_bh(write_op, bh);
nr_underway++; nr_underway++;
} }
bh = next; bh = next;
...@@ -1859,7 +1860,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page, ...@@ -1859,7 +1860,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
struct buffer_head *next = bh->b_this_page; struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) { if (buffer_async_write(bh)) {
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
submit_bh(WRITE, bh); submit_bh(write_op, bh);
nr_underway++; nr_underway++;
} }
bh = next; bh = next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment