If a file not set type as hot, has dirty pages more than
threshold 64 before starting atomic write, may be lose hot
flag.

Signed-off-by: Yunlei He <heyun...@huawei.com>
---
 fs/f2fs/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 79eeed5..bf61e20 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
                goto out;
 
        set_inode_flag(inode, FI_ATOMIC_FILE);
-       set_inode_flag(inode, FI_HOT_DATA);
        f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
 
        if (!get_dirty_pages(inode))
@@ -1697,11 +1696,11 @@ static int f2fs_ioc_start_atomic_write(struct file 
*filp)
        ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
        if (ret) {
                clear_inode_flag(inode, FI_ATOMIC_FILE);
-               clear_inode_flag(inode, FI_HOT_DATA);
                goto out;
        }
 
 inc_stat:
+       set_inode_flag(inode, FI_HOT_DATA);
        F2FS_I(inode)->inmem_task = current;
        stat_inc_atomic_write(inode);
        stat_update_max_atomic_write(inode);
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to