The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [RFC PATCH] f2fs: remove some redundant flow about FI_ATOMIC_DIRTIED
@ 2025-03-26  8:46 Zhiguo Niu
  2025-03-26  9:26 ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Zhiguo Niu @ 2025-03-26  8:46 UTC (permalink / raw)
  To: jaegeuk, chao
  Cc: linux-f2fs-devel, linux-kernel, daehojeong, niuzhiguo84,
	zhiguo.niu, ke.wang, Hao_hao.Wang

Commit fccaa81de87e ("f2fs: prevent atomic file from being dirtied before commit")
adds the processing of FI_ATOMIC_DIRTIED in the following two positions,
[1]
f2fs_commit_atomic_write
 - __f2fs_commit_atomic_write
  - sbi->committed_atomic_block += fi->atomic_write_cnt;
  - set_inode_flag(inode, FI_ATOMIC_COMMITTED);
  - if (is_inode_flag_set(inode, FI_ATOMIC_DIRTIED)) {
  -    clear_inode_flag(inode, FI_ATOMIC_DIRTIED);
  -    f2fs_mark_inode_dirty_sync(inode, true);
  - }
[2]
f2fs_abort_atomic_write
  - if (is_inode_flag_set(inode, FI_ATOMIC_DIRTIED)) {
  -    clear_inode_flag(inode, FI_ATOMIC_DIRTIED);
  -    f2fs_mark_inode_dirty_sync(inode, true);
  - }

but [1] seems to be redundant:
The atomic file flag FI_ATOMIC_FILE is still set here, so f2fs_mark_inode_dirty_sync
still does not set the dirty state to vfs. If FI_ATOMIC_DIRTIED was originally set
when atomic file is committing, then FI_ATOMIC_DIRTIED is just cleared here, and
then do the repeating action of setting FI_ATOMIC_DIRTIED?
So is it enough to do this only in [2]?

Cc: Daeho Jeong <daehojeong@google.com>
Fixes: fccaa81de87e ("f2fs: prevent atomic file from being dirtied before commit")
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/segment.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 396ef71..d4ea3af 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -376,10 +376,6 @@ static int __f2fs_commit_atomic_write(struct inode *inode)
 	} else {
 		sbi->committed_atomic_block += fi->atomic_write_cnt;
 		set_inode_flag(inode, FI_ATOMIC_COMMITTED);
-		if (is_inode_flag_set(inode, FI_ATOMIC_DIRTIED)) {
-			clear_inode_flag(inode, FI_ATOMIC_DIRTIED);
-			f2fs_mark_inode_dirty_sync(inode, true);
-		}
 	}
 
 	__complete_revoke_list(inode, &revoke_list, ret ? true : false);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-27  3:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26  8:46 [RFC PATCH] f2fs: remove some redundant flow about FI_ATOMIC_DIRTIED Zhiguo Niu
2025-03-26  9:26 ` Chao Yu
2025-03-26 10:51   ` Zhiguo Niu
2025-03-26 12:10     ` Chao Yu
2025-03-26 18:51       ` [f2fs-dev] " Daeho Jeong
2025-03-27  3:21         ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox