Skip to contentSkip to conversation

f2fs: fix to update page flag

PATCH New Chao Yu 1 participant 1 message Jul 8, 2015 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 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.

---
 fs/f2fs/data.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
fs/f2fs/data.c +7 -4
index 056f4f9..a869d80 100644
@@ -1249,8 +1249,10 @@ put_next:
 	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);
 
@@ -1260,7 +1262,7 @@ put_next:
 
 		/* 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) {
@@ -1298,8 +1300,9 @@ put_next:
 			}
 		}
 	}
-out:
+out_update:
 	SetPageUptodate(page);
+out_clear:
 	clear_cold_data(page);
 	return 0;
 
Signature · 1 line
2.4.2