Commit 918941a3 authored by Jan Kara's avatar Jan Kara

ocfs2: Use __generic_file_aio_write instead of generic_file_aio_write_nolock

Use the new helper. We have to submit data pages ourselves in case of O_SYNC
write because __generic_file_aio_write does not do it for us. OCFS2 developpers
might think about moving the sync out of i_mutex which seems to be easily
possible but that's out of scope of this patch.

CC: ocfs2-devel@oss.oracle.com
Acked-by: default avatarJoel Becker <joel.becker@oracle.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent b04f9321
...@@ -1871,8 +1871,7 @@ relock: ...@@ -1871,8 +1871,7 @@ relock:
goto out_dio; goto out_dio;
} }
} else { } else {
written = generic_file_aio_write_nolock(iocb, iov, nr_segs, written = __generic_file_aio_write(iocb, iov, nr_segs, ppos);
*ppos);
} }
out_dio: out_dio:
...@@ -1880,18 +1879,21 @@ out_dio: ...@@ -1880,18 +1879,21 @@ out_dio:
BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) { if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) {
/* ret = filemap_fdatawrite_range(file->f_mapping, pos,
* The generic write paths have handled getting data pos + count - 1);
* to disk, but since we don't make use of the dirty if (ret < 0)
* inode list, a manual journal commit is necessary written = ret;
* here.
*/ if (!ret && (old_size != i_size_read(inode) ||
if (old_size != i_size_read(inode) || old_clusters != OCFS2_I(inode)->ip_clusters)) {
old_clusters != OCFS2_I(inode)->ip_clusters) {
ret = jbd2_journal_force_commit(osb->journal->j_journal); ret = jbd2_journal_force_commit(osb->journal->j_journal);
if (ret < 0) if (ret < 0)
written = ret; written = ret;
} }
if (!ret)
ret = filemap_fdatawait_range(file->f_mapping, pos,
pos + count - 1);
} }
/* /*
......
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