diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index aa501d3f93f1..221c5e98957b 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1871,8 +1871,7 @@ relock: | |||
1871 | goto out_dio; | 1871 | goto out_dio; |
1872 | } | 1872 | } |
1873 | } else { | 1873 | } else { |
1874 | written = generic_file_aio_write_nolock(iocb, iov, nr_segs, | 1874 | written = __generic_file_aio_write(iocb, iov, nr_segs, ppos); |
1875 | *ppos); | ||
1876 | } | 1875 | } |
1877 | 1876 | ||
1878 | out_dio: | 1877 | out_dio: |
@@ -1880,18 +1879,21 @@ out_dio: | |||
1880 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); | 1879 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); |
1881 | 1880 | ||
1882 | if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) { | 1881 | if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) { |
1883 | /* | 1882 | ret = filemap_fdatawrite_range(file->f_mapping, pos, |
1884 | * The generic write paths have handled getting data | 1883 | pos + count - 1); |
1885 | * to disk, but since we don't make use of the dirty | 1884 | if (ret < 0) |
1886 | * inode list, a manual journal commit is necessary | 1885 | written = ret; |
1887 | * here. | 1886 | |
1888 | */ | 1887 | if (!ret && (old_size != i_size_read(inode) || |
1889 | if (old_size != i_size_read(inode) || | 1888 | old_clusters != OCFS2_I(inode)->ip_clusters)) { |
1890 | old_clusters != OCFS2_I(inode)->ip_clusters) { | ||
1891 | ret = jbd2_journal_force_commit(osb->journal->j_journal); | 1889 | ret = jbd2_journal_force_commit(osb->journal->j_journal); |
1892 | if (ret < 0) | 1890 | if (ret < 0) |
1893 | written = ret; | 1891 | written = ret; |
1894 | } | 1892 | } |
1893 | |||
1894 | if (!ret) | ||
1895 | ret = filemap_fdatawait_range(file->f_mapping, pos, | ||
1896 | pos + count - 1); | ||
1895 | } | 1897 | } |
1896 | 1898 | ||
1897 | /* | 1899 | /* |
@@ -1991,31 +1993,16 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
1991 | 1993 | ||
1992 | if (ret > 0) { | 1994 | if (ret > 0) { |
1993 | unsigned long nr_pages; | 1995 | unsigned long nr_pages; |
1996 | int err; | ||
1994 | 1997 | ||
1995 | *ppos += ret; | ||
1996 | nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 1998 | nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
1997 | 1999 | ||
1998 | /* | 2000 | err = generic_write_sync(out, *ppos, ret); |
1999 | * If file or inode is SYNC and we actually wrote some data, | 2001 | if (err) |
2000 | * sync it. | 2002 | ret = err; |
2001 | */ | 2003 | else |
2002 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { | 2004 | *ppos += ret; |
2003 | int err; | ||
2004 | |||
2005 | mutex_lock(&inode->i_mutex); | ||
2006 | err = ocfs2_rw_lock(inode, 1); | ||
2007 | if (err < 0) { | ||
2008 | mlog_errno(err); | ||
2009 | } else { | ||
2010 | err = generic_osync_inode(inode, mapping, | ||
2011 | OSYNC_METADATA|OSYNC_DATA); | ||
2012 | ocfs2_rw_unlock(inode, 1); | ||
2013 | } | ||
2014 | mutex_unlock(&inode->i_mutex); | ||
2015 | 2005 | ||
2016 | if (err) | ||
2017 | ret = err; | ||
2018 | } | ||
2019 | balance_dirty_pages_ratelimited_nr(mapping, nr_pages); | 2006 | balance_dirty_pages_ratelimited_nr(mapping, nr_pages); |
2020 | } | 2007 | } |
2021 | 2008 | ||