Skip to content

Commit

Permalink
ext4: avoid issuing unnecessary barriers
Browse files Browse the repository at this point in the history
We don't to issue an I/O barrier on an error or if we force commit
because we are doing data journaling.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
  • Loading branch information
Theodore Ts'o committed Nov 23, 2009
1 parent 1032988 commit 6b17d90
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/ext4/fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)

ret = flush_aio_dio_completed_IO(inode);
if (ret < 0)
goto out;
return ret;
/*
* data=writeback:
* The caller's filemap_fdatawrite()/wait will sync the data.
Expand All @@ -79,10 +79,8 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
* (they were dirtied by commit). But that's OK - the blocks are
* safe in-journal, which is all fsync() needs to ensure.
*/
if (ext4_should_journal_data(inode)) {
ret = ext4_force_commit(inode->i_sb);
goto out;
}
if (ext4_should_journal_data(inode))
return ext4_force_commit(inode->i_sb);

if (!journal)
ret = sync_mapping_buffers(inode->i_mapping);
Expand Down

0 comments on commit 6b17d90

Please sign in to comment.