f2fs: fix to spread clear_cold_data()
authorChao Yu <yuchao0@huawei.com>
Fri, 27 Jul 2018 10:15:16 +0000 (18:15 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 26 Oct 2018 18:26:59 +0000 (11:26 -0700)
We need to drop PG_checked flag on page as well when we clear PG_uptodate
flag, in order to avoid treating the page as GCing one later.

Signed-off-by: Weichao Guo <guoweichao@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c
fs/f2fs/dir.c
fs/f2fs/segment.c

index 1e986beec0eca62cdd7028690cd8b1d58c6c17b0..e88952070773888338f3ea1dc891ae5374de4a77 100644 (file)
@@ -1815,6 +1815,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
        /* This page is already truncated */
        if (fio->old_blkaddr == NULL_ADDR) {
                ClearPageUptodate(page);
+               clear_cold_data(page);
                goto out_writepage;
        }
 got_it:
@@ -1990,8 +1991,10 @@ done:
 
 out:
        inode_dec_dirty_pages(inode);
-       if (err)
+       if (err) {
                ClearPageUptodate(page);
+               clear_cold_data(page);
+       }
 
        if (wbc->for_reclaim) {
                f2fs_submit_merged_write_cond(sbi, NULL, page, 0, DATA);
@@ -2620,6 +2623,8 @@ void f2fs_invalidate_page(struct page *page, unsigned int offset,
                }
        }
 
+       clear_cold_data(page);
+
        /* This is atomic written page, keep Private */
        if (IS_ATOMIC_WRITTEN_PAGE(page))
                return f2fs_drop_inmem_page(inode, page);
@@ -2638,6 +2643,7 @@ int f2fs_release_page(struct page *page, gfp_t wait)
        if (IS_ATOMIC_WRITTEN_PAGE(page))
                return 0;
 
+       clear_cold_data(page);
        set_page_private(page, 0);
        ClearPagePrivate(page);
        return 1;
index e02db5db62dc2a78263beae0979efae8168ea1a3..2ef84b4590ead0367e6d518a865e75838a41f373 100644 (file)
@@ -730,6 +730,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
                clear_page_dirty_for_io(page);
                ClearPagePrivate(page);
                ClearPageUptodate(page);
+               clear_cold_data(page);
                inode_dec_dirty_pages(dir);
                f2fs_remove_dirty_inode(dir);
        }
index 805c8310d7b0c2880b2c7459ec679f91e030fbb0..e38b2f69b68e0101405b8bb1efcbbb56dcdf87cb 100644 (file)
@@ -266,8 +266,10 @@ retry:
                }
 next:
                /* we don't need to invalidate this in the sccessful status */
-               if (drop || recover)
+               if (drop || recover) {
                        ClearPageUptodate(page);
+                       clear_cold_data(page);
+               }
                set_page_private(page, 0);
                ClearPagePrivate(page);
                f2fs_put_page(page, 1);