Skip to content

Commit

Permalink
ocfs2: Use __generic_file_aio_write instead of generic_file_aio_write…
Browse files Browse the repository at this point in the history
…_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: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Sep 14, 2009
1 parent b04f932 commit 918941a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1871,27 +1871,29 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
goto out_dio;
}
} else {
written = generic_file_aio_write_nolock(iocb, iov, nr_segs,
*ppos);
written = __generic_file_aio_write(iocb, iov, nr_segs, ppos);
}

out_dio:
/* buffered aio wouldn't have proper lock coverage today */
BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));

if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) {
/*
* The generic write paths have handled getting data
* to disk, but since we don't make use of the dirty
* inode list, a manual journal commit is necessary
* here.
*/
if (old_size != i_size_read(inode) ||
old_clusters != OCFS2_I(inode)->ip_clusters) {
ret = filemap_fdatawrite_range(file->f_mapping, pos,
pos + count - 1);
if (ret < 0)
written = ret;

if (!ret && (old_size != i_size_read(inode) ||
old_clusters != OCFS2_I(inode)->ip_clusters)) {
ret = jbd2_journal_force_commit(osb->journal->j_journal);
if (ret < 0)
written = ret;
}

if (!ret)
ret = filemap_fdatawait_range(file->f_mapping, pos,
pos + count - 1);
}

/*
Expand Down

0 comments on commit 918941a

Please sign in to comment.