aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/fsync.c
diff options
context:
space:
mode:
authorJiaying Zhang <jiayingz@google.com>2011-03-21 21:38:05 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-03-21 21:38:05 -0400
commit0562e0bad483d10e9651fbb8f21dc3d0bad57374 (patch)
tree19f6597f92c028badcb6df360ccac22240378e25 /fs/ext4/fsync.c
parent4596fe07679ff0fae904515691ea747467614871 (diff)
ext4: add more tracepoints and use dev_t in the trace buffer
- Add more ext4 tracepoints. - Change ext4 tracepoints to use dev_t field with MAJOR/MINOR macros so that we can save 4 bytes in the ring buffer on some platforms. - Add sync_mode to ext4_da_writepages, ext4_da_write_pages, and ext4_da_writepages_result tracepoints. Also remove for_reclaim field from ext4_da_writepages since it is usually not very useful. Signed-off-by: Jiaying Zhang <jiayingz@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/fsync.c')
-rw-r--r--fs/ext4/fsync.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 7829b287822a..7f74019d6d77 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -164,20 +164,20 @@ int ext4_sync_file(struct file *file, int datasync)
164 164
165 J_ASSERT(ext4_journal_current_handle() == NULL); 165 J_ASSERT(ext4_journal_current_handle() == NULL);
166 166
167 trace_ext4_sync_file(file, datasync); 167 trace_ext4_sync_file_enter(file, datasync);
168 168
169 if (inode->i_sb->s_flags & MS_RDONLY) 169 if (inode->i_sb->s_flags & MS_RDONLY)
170 return 0; 170 return 0;
171 171
172 ret = ext4_flush_completed_IO(inode); 172 ret = ext4_flush_completed_IO(inode);
173 if (ret < 0) 173 if (ret < 0)
174 return ret; 174 goto out;
175 175
176 if (!journal) { 176 if (!journal) {
177 ret = generic_file_fsync(file, datasync); 177 ret = generic_file_fsync(file, datasync);
178 if (!ret && !list_empty(&inode->i_dentry)) 178 if (!ret && !list_empty(&inode->i_dentry))
179 ext4_sync_parent(inode); 179 ext4_sync_parent(inode);
180 return ret; 180 goto out;
181 } 181 }
182 182
183 /* 183 /*
@@ -194,8 +194,10 @@ int ext4_sync_file(struct file *file, int datasync)
194 * (they were dirtied by commit). But that's OK - the blocks are 194 * (they were dirtied by commit). But that's OK - the blocks are
195 * safe in-journal, which is all fsync() needs to ensure. 195 * safe in-journal, which is all fsync() needs to ensure.
196 */ 196 */
197 if (ext4_should_journal_data(inode)) 197 if (ext4_should_journal_data(inode)) {
198 return ext4_force_commit(inode->i_sb); 198 ret = ext4_force_commit(inode->i_sb);
199 goto out;
200 }
199 201
200 commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid; 202 commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid;
201 if (jbd2_log_start_commit(journal, commit_tid)) { 203 if (jbd2_log_start_commit(journal, commit_tid)) {
@@ -215,5 +217,7 @@ int ext4_sync_file(struct file *file, int datasync)
215 ret = jbd2_log_wait_commit(journal, commit_tid); 217 ret = jbd2_log_wait_commit(journal, commit_tid);
216 } else if (journal->j_flags & JBD2_BARRIER) 218 } else if (journal->j_flags & JBD2_BARRIER)
217 blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); 219 blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
220 out:
221 trace_ext4_sync_file_exit(inode, ret);
218 return ret; 222 return ret;
219} 223}