diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c9d0f8b06d15438b721309b7f705877a7e6b21c9..de55c088948f7bb09522328dc0e47b3f6b59a360 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1790,8 +1790,10 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, f2fs_put_dnode(&dn); f2fs_unlock_op(sbi); - if ((len == PAGE_CACHE_SIZE) || PageUptodate(page)) - return 0; + if (len == PAGE_CACHE_SIZE) + goto out_update; + if (PageUptodate(page)) + goto out_clear; f2fs_wait_on_page_writeback(page, DATA); @@ -1801,7 +1803,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, /* Reading beyond i_size is simple: memset to zero */ zero_user_segments(page, 0, start, end, PAGE_CACHE_SIZE); - goto out; + goto out_update; } if (dn.data_blkaddr == NEW_ADDR) { @@ -1839,8 +1841,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, } } } -out: +out_update: SetPageUptodate(page); +out_clear: clear_cold_data(page); return 0;