[Devel] [PATCH vz10 v3 07/11] ext4: force commit only for non-regular files in ext4_sync_files

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 22 22:14:13 MSK 2025


From: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Change the logic to force commit only for non-regular files instead of
checking if data should be journaled. This aligns with upstream behavior
and improves consistency.

Similar to upstream commits:
e360c6ed7274 ("ext4: Drop special handling of journalled data from ext4_sync_file()")
1077b2d53ef5 ("ext4: fix fsync for non-directories")

Part of rework for ext4_sync_files function.

Fixes: 26337aacaafa9 ("ext4: add mfsync support")
https://virtuozzo.atlassian.net/browse/VSTOR-107255
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Feature: ext4: optimized sync of a set of files - mfsync()
---
 fs/ext4/fsync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 592f564c146c4..cd5105081d43f 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -239,7 +239,7 @@ int ext4_sync_files(struct file **files, unsigned int *flags, unsigned int nr_fi
 				err = err2;
 		}
 
-		force_commit  |= ext4_should_journal_data(inode);
+		force_commit |= !S_ISREG(inode->i_mode);
 		tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid;
 		trace_ext4_sync_files_iterate(files[j]->f_path.dentry, tid, datasync);
 		if (j == 0 || !tid_geq(commit_tid, tid))
-- 
2.43.0



More information about the Devel mailing list