Commit 858f38c0 authored by Nathan Scott's avatar Nathan Scott

[XFS] Fix sync issues - use correct writepage page re-dirty interface,

and do not clear dirty flag if page only partially written.

SGI Modid: xfs-linux:xfs-kern:19622a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 88ae9439
...@@ -552,18 +552,21 @@ xfs_submit_page( ...@@ -552,18 +552,21 @@ xfs_submit_page(
struct page *page, struct page *page,
struct writeback_control *wbc, struct writeback_control *wbc,
struct buffer_head *bh_arr[], struct buffer_head *bh_arr[],
int cnt) int bh_count,
int probed_page,
int clear_dirty)
{ {
struct buffer_head *bh; struct buffer_head *bh;
int i; int i;
BUG_ON(PageWriteback(page)); BUG_ON(PageWriteback(page));
set_page_writeback(page); set_page_writeback(page);
clear_page_dirty(page); if (clear_dirty)
clear_page_dirty(page);
unlock_page(page); unlock_page(page);
if (cnt) { if (bh_count) {
for (i = 0; i < cnt; i++) { for (i = 0; i < bh_count; i++) {
bh = bh_arr[i]; bh = bh_arr[i];
mark_buffer_async_write(bh); mark_buffer_async_write(bh);
if (buffer_unwritten(bh)) if (buffer_unwritten(bh))
...@@ -572,8 +575,11 @@ xfs_submit_page( ...@@ -572,8 +575,11 @@ xfs_submit_page(
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
} }
for (i = 0; i < cnt; i++) for (i = 0; i < bh_count; i++)
submit_bh(WRITE, bh_arr[i]); submit_bh(WRITE, bh_arr[i]);
if (probed_page && clear_dirty)
wbc->nr_to_write--; /* Wrote an "extra" page */
} else { } else {
end_page_writeback(page); end_page_writeback(page);
wbc->pages_skipped++; /* We didn't write this page */ wbc->pages_skipped++; /* We didn't write this page */
...@@ -612,11 +618,13 @@ xfs_convert_page( ...@@ -612,11 +618,13 @@ xfs_convert_page(
bh = head = page_buffers(page); bh = head = page_buffers(page);
do { do {
offset = i << bbits; offset = i << bbits;
if (offset >= end)
break;
if (!(PageUptodate(page) || buffer_uptodate(bh))) if (!(PageUptodate(page) || buffer_uptodate(bh)))
continue; continue;
if (buffer_mapped(bh) && all_bh && if (buffer_mapped(bh) && all_bh &&
!buffer_unwritten(bh) && !buffer_delay(bh)) { !(buffer_unwritten(bh) || buffer_delay(bh))) {
if (startio && (offset < end)) { if (startio) {
lock_buffer(bh); lock_buffer(bh);
bh_arr[index++] = bh; bh_arr[index++] = bh;
} }
...@@ -644,7 +652,7 @@ xfs_convert_page( ...@@ -644,7 +652,7 @@ xfs_convert_page(
ASSERT(private); ASSERT(private);
} }
} }
if (startio && (offset < end)) { if (startio) {
bh_arr[index++] = bh; bh_arr[index++] = bh;
} else { } else {
set_buffer_dirty(bh); set_buffer_dirty(bh);
...@@ -654,8 +662,7 @@ xfs_convert_page( ...@@ -654,8 +662,7 @@ xfs_convert_page(
} while (i++, (bh = bh->b_this_page) != head); } while (i++, (bh = bh->b_this_page) != head);
if (startio) { if (startio) {
wbc->nr_to_write--; xfs_submit_page(page, wbc, bh_arr, index, 1, index == i);
xfs_submit_page(page, wbc, bh_arr, index);
} else { } else {
unlock_page(page); unlock_page(page);
} }
...@@ -867,7 +874,7 @@ xfs_page_state_convert( ...@@ -867,7 +874,7 @@ xfs_page_state_convert(
SetPageUptodate(page); SetPageUptodate(page);
if (startio) if (startio)
xfs_submit_page(page, wbc, bh_arr, cnt); xfs_submit_page(page, wbc, bh_arr, cnt, 0, 1);
if (iomp) { if (iomp) {
tlast = (iomp->iomap_offset + iomp->iomap_bsize - 1) >> tlast = (iomp->iomap_offset + iomp->iomap_bsize - 1) >>
...@@ -1174,7 +1181,7 @@ linvfs_writepage( ...@@ -1174,7 +1181,7 @@ linvfs_writepage(
return 0; return 0;
out_fail: out_fail:
set_page_dirty(page); redirty_page_for_writepage(wbc, page);
unlock_page(page); unlock_page(page);
return 0; return 0;
out_unlock: out_unlock:
......
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