Commit 92e6222d authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: remove i_mutex from ext4_file_sync()

After removal of ext4_flush_unwritten_io() call, ext4_file_sync()
doesn't need i_mutex anymore. Forcing of transaction commits doesn't
need i_mutex as there's nothing inode specific in that code apart from
grabbing transaction ids from the inode. So remove the lock.
Reviewed-by: default avatarZheng Liu <wenqing.lz@taobao.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 37b10dd0
...@@ -99,20 +99,18 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -99,20 +99,18 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
trace_ext4_sync_file_enter(file, datasync); trace_ext4_sync_file_enter(file, datasync);
if (inode->i_sb->s_flags & MS_RDONLY) if (inode->i_sb->s_flags & MS_RDONLY)
goto out_trace; goto out;
if (!journal) { if (!journal) {
ret = generic_file_fsync(file, start, end, datasync); ret = generic_file_fsync(file, start, end, datasync);
if (!ret && !hlist_empty(&inode->i_dentry)) if (!ret && !hlist_empty(&inode->i_dentry))
ret = ext4_sync_parent(inode); ret = ext4_sync_parent(inode);
goto out_trace; goto out;
} }
ret = filemap_write_and_wait_range(inode->i_mapping, start, end); ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (ret) if (ret)
return ret; return ret;
mutex_lock(&inode->i_mutex);
/* /*
* data=writeback,ordered: * data=writeback,ordered:
* The caller's filemap_fdatawrite()/wait will sync the data. * The caller's filemap_fdatawrite()/wait will sync the data.
...@@ -143,8 +141,6 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -143,8 +141,6 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
ret = err; ret = err;
} }
out: out:
mutex_unlock(&inode->i_mutex);
out_trace:
trace_ext4_sync_file_exit(inode, ret); trace_ext4_sync_file_exit(inode, ret);
return ret; return ret;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment