aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-08-18 12:24:31 -0400
committerJan Kara <jack@suse.cz>2009-09-14 11:08:16 -0400
commitd23c937b0f740888765676f6f82f509dbbb2bbad (patch)
treedf4e085d935805f54061436ee820460c79143087 /fs
parentebbbf757c6b8577ac2fb6181c08c2059153bb0e2 (diff)
ocfs2: Update syncing after splicing to match generic version
Update ocfs2 specific splicing code to use generic syncing helper. The sync now does not happen under rw_lock because generic_write_sync() acquires i_mutex which ranks above rw_lock. That should not matter because standard fsync path does not hold it either. Acked-by: Joel Becker <Joel.Becker@oracle.com> Acked-by: Mark Fasheh <mfasheh@suse.com> CC: ocfs2-devel@oss.oracle.com Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/file.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 600227389387..221c5e98957b 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1993,31 +1993,16 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
1993 1993
1994 if (ret > 0) { 1994 if (ret > 0) {
1995 unsigned long nr_pages; 1995 unsigned long nr_pages;
1996 int err;
1996 1997
1997 *ppos += ret;
1998 nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 1998 nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
1999 1999
2000 /* 2000 err = generic_write_sync(out, *ppos, ret);
2001 * If file or inode is SYNC and we actually wrote some data, 2001 if (err)
2002 * sync it. 2002 ret = err;
2003 */ 2003 else
2004 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { 2004 *ppos += ret;
2005 int err;
2006
2007 mutex_lock(&inode->i_mutex);
2008 err = ocfs2_rw_lock(inode, 1);
2009 if (err < 0) {
2010 mlog_errno(err);
2011 } else {
2012 err = generic_osync_inode(inode, mapping,
2013 OSYNC_METADATA|OSYNC_DATA);
2014 ocfs2_rw_unlock(inode, 1);
2015 }
2016 mutex_unlock(&inode->i_mutex);
2017 2005
2018 if (err)
2019 ret = err;
2020 }
2021 balance_dirty_pages_ratelimited_nr(mapping, nr_pages); 2006 balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
2022 } 2007 }
2023 2008