1
0
Fork 0

f2fs: avoid to truncate non-updated page partially

After we call find_data_page in truncate_partial_data_page, we could not
guarantee this page is updated or not as error may occurred in lower layer.

We'd better check status of the page to avoid this no updated page be
writebacked to device.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
wifi-calibration
Chao Yu 2014-06-12 13:31:50 +08:00 committed by Jaegeuk Kim
parent 5576cd6ca5
commit ca0a81b397
1 changed files with 6 additions and 4 deletions

View File

@ -380,13 +380,15 @@ static void truncate_partial_data_page(struct inode *inode, u64 from)
return;
lock_page(page);
if (unlikely(page->mapping != inode->i_mapping)) {
f2fs_put_page(page, 1);
return;
}
if (unlikely(!PageUptodate(page) ||
page->mapping != inode->i_mapping))
goto out;
f2fs_wait_on_page_writeback(page, DATA);
zero_user(page, offset, PAGE_CACHE_SIZE - offset);
set_page_dirty(page);
out:
f2fs_put_page(page, 1);
}