diff options
author | Jan Kara <jack@suse.cz> | 2013-06-04 14:40:39 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-06-04 14:40:39 -0400 |
commit | 92e6222dfb85db780ebd8caea6a3f9326c375bc0 (patch) | |
tree | d57c6ca43d9b57117f5fe029ea0ccdc61a7369ab | |
parent | 37b10dd06334ebc89f551d405a0fe27e1a622458 (diff) |
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: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/fsync.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 6019bd449576..fc938ebbddec 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -99,20 +99,18 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
99 | trace_ext4_sync_file_enter(file, datasync); | 99 | trace_ext4_sync_file_enter(file, datasync); |
100 | 100 | ||
101 | if (inode->i_sb->s_flags & MS_RDONLY) | 101 | if (inode->i_sb->s_flags & MS_RDONLY) |
102 | goto out_trace; | 102 | goto out; |
103 | 103 | ||
104 | if (!journal) { | 104 | if (!journal) { |
105 | ret = generic_file_fsync(file, start, end, datasync); | 105 | ret = generic_file_fsync(file, start, end, datasync); |
106 | if (!ret && !hlist_empty(&inode->i_dentry)) | 106 | if (!ret && !hlist_empty(&inode->i_dentry)) |
107 | ret = ext4_sync_parent(inode); | 107 | ret = ext4_sync_parent(inode); |
108 | goto out_trace; | 108 | goto out; |
109 | } | 109 | } |
110 | 110 | ||
111 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 111 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
112 | if (ret) | 112 | if (ret) |
113 | return ret; | 113 | return ret; |
114 | mutex_lock(&inode->i_mutex); | ||
115 | |||
116 | /* | 114 | /* |
117 | * data=writeback,ordered: | 115 | * data=writeback,ordered: |
118 | * The caller's filemap_fdatawrite()/wait will sync the data. | 116 | * 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 | ret = err; | 141 | ret = err; |
144 | } | 142 | } |
145 | out: | 143 | out: |
146 | mutex_unlock(&inode->i_mutex); | ||
147 | out_trace: | ||
148 | trace_ext4_sync_file_exit(inode, ret); | 144 | trace_ext4_sync_file_exit(inode, ret); |
149 | return ret; | 145 | return ret; |
150 | } | 146 | } |