[PATCH 12/41] fs: Drop sync_mapping_buffers() from __generic_file_fsync()

Jan Kara
2026-03-20T13:42:36Z

No filesystem calling __generic_file_fsync() uses metadata bh tracking.
Drop sync_mapping_buffers() call from __generic_file_fsync() as it's
pointless now.

Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/libfs.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index 74134ba2e8d1..548e119668df 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1555,23 +1555,19 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end,
{
struct inode *inode = file->f_mapping->host;
int err;
- int ret;
+ int ret = 0;

err = file_write_and_wait_range(file, start, end);
if (err)
return err;

inode_lock(inode);
- ret = sync_mapping_buffers(inode->i_mapping);
if (!(inode_state_read_once(inode) & I_DIRTY_ALL))
goto out;
if (datasync && !(inode_state_read_once(inode) & I_DIRTY_DATASYNC))
goto out;

- err = sync_inode_metadata(inode, 1);
- if (ret == 0)
- ret = err;
-
+ ret = sync_inode_metadata(inode, 1);
out:
inode_unlock(inode);
/* check and advance again to catch errors after syncing out buffers */
--
2.51.0