Commit 90d4388a authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix to update page flag

This patch fixes to update page flag (e.g. Uptodate/cold flag) in
->write_begin.

Otherwise, page will be non-uptodate when we try to write entire
page, and cold data flag in page will not be clean when gced page
is being rewritten.
Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 7023a1ad
...@@ -1790,8 +1790,10 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, ...@@ -1790,8 +1790,10 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
f2fs_put_dnode(&dn); f2fs_put_dnode(&dn);
f2fs_unlock_op(sbi); f2fs_unlock_op(sbi);
if ((len == PAGE_CACHE_SIZE) || PageUptodate(page)) if (len == PAGE_CACHE_SIZE)
return 0; goto out_update;
if (PageUptodate(page))
goto out_clear;
f2fs_wait_on_page_writeback(page, DATA); f2fs_wait_on_page_writeback(page, DATA);
...@@ -1801,7 +1803,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, ...@@ -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 */ /* Reading beyond i_size is simple: memset to zero */
zero_user_segments(page, 0, start, end, PAGE_CACHE_SIZE); zero_user_segments(page, 0, start, end, PAGE_CACHE_SIZE);
goto out; goto out_update;
} }
if (dn.data_blkaddr == NEW_ADDR) { if (dn.data_blkaddr == NEW_ADDR) {
...@@ -1839,8 +1841,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, ...@@ -1839,8 +1841,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
} }
} }
} }
out: out_update:
SetPageUptodate(page); SetPageUptodate(page);
out_clear:
clear_cold_data(page); clear_cold_data(page);
return 0; return 0;
......
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