f2fs: allocate hot_data for atomic write more strictly
PATCH 1/1 f2fs: allocate hot_data for atomic write more strictly
If a file not set type as hot, has dirty pages more than threshold 64 before starting atomic write, may be lose hot flag.
--- fs/f2fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/f2fs/file.c +1 -2
@@ -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);
Signature · 6 lines
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
Quoted 14 lines · Yunlei He
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 <[email protected]>--- fs/f2fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/file.c +0
-0
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1687
Quoted 3 lines
fs/f2fs/file.c +0
-0@@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) goto out;set_inode_flag (inode,FI_ATOMIC_FILE );
How about moving this below inc_stat tag? If there is still dirty page, for reclaim path, we may redirty page with atomic write mode, we need to avoid that.
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1688
Quoted 2 lines
fs/f2fs/file.c +0
-1-set_inode_flag (inode,FI_HOT_DATA );f2fs_update_time (F2FS_I_SB (inode),REQ_TIME );
Ditto.
Thanks,
Quoted 6 lines
fs/f2fs/file.c +0
-0if (!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) {
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1706
Quoted 10 lines
fs/f2fs/file.c +1
-1clear_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);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 26 lines
-----Original Message-----
From: Yuchao (T)
Sent: Tuesday, April 17, 2018 4:31 PM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Zhangdianfang (Euler)
Subject: Re: [f2fs-dev][PATCH] f2fs: allocatehot_datafor atomic write more strictlyQuoted 16 lines · Yunlei He
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 <[email protected]>--- fs/f2fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/file.c +0
-0@@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) goto out;
Quoted 5 lines
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1687
Quoted 1 line
fs/f2fs/file.c +0
-0set_inode_flag (inode,FI_ATOMIC_FILE );How about moving this below
inc_stattag? If there is still dirty page, for reclaim path, we may redirty page with atomic write mode, we need to avoid that.
With it,maybe still has dirty pages after filemap_write_and_wait_range, which are not inmem pages and maybe affect atomicity?
Thanks.
Quoted 17 lines
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1688
Quoted 2 lines
fs/f2fs/file.c +0
-1-set_inode_flag (inode,FI_HOT_DATA );f2fs_update_time (F2FS_I_SB (inode),REQ_TIME );Ditto.
Thanks,
Quoted 10 lines
fs/f2fs/file.c +0
-1if (!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; }
Quoted 6 lines
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1706
Quoted 6 lines
fs/f2fs/file.c +1
-0inc_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);
------------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 26 lines · heyunlei
Quoted 26 lines
-----Original Message-----
From: Yuchao (T)
Sent: Tuesday, April 17, 2018 4:31 PM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Zhangdianfang (Euler)
Subject: Re: [f2fs-dev][PATCH] f2fs: allocatehot_datafor atomic write more strictlyQuoted 16 lines · Yunlei He
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 <[email protected]>--- fs/f2fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/file.c +0
-0@@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) goto out;
Quoted 7 lines
Quoted 5 lines
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1687
Quoted 1 line
fs/f2fs/file.c +0
-0set_inode_flag (inode,FI_ATOMIC_FILE );How about moving this below
inc_stattag? If there is still dirty page, for reclaim path, we may redirty page with atomic write mode, we need to avoid that.With it,maybe still has dirty pages after filemap_write_and_wait_range, which are not inmem pages and maybe affect atomicity?
I just send a patch, could you check that?
Thanks,
Quoted 20 lines
Thanks.
Quoted 17 lines
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1688
Quoted 2 lines
fs/f2fs/file.c +0
-1-set_inode_flag (inode,FI_HOT_DATA );f2fs_update_time (F2FS_I_SB (inode),REQ_TIME );Ditto.
Thanks,
Quoted 10 lines
fs/f2fs/file.c +0
-1if (!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; }
Quoted 7 lines
Quoted 6 lines
fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 1706
Quoted 6 lines
fs/f2fs/file.c +1
-0inc_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);
------------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel