Jan Kara
2009-Aug-21 17:24 UTC
[Ocfs2-devel] [PATCH 12/17] 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. CC: Joel Becker <Joel.Becker at oracle.com> CC: ocfs2-devel at oss.oracle.com Signed-off-by: Jan Kara <jack at suse.cz> --- fs/ocfs2/file.c | 27 ++++++--------------------- 1 files changed, 6 insertions(+), 21 deletions(-) diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1c71f0a..bd7fdf8 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1990,31 +1990,16 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, if (ret > 0) { unsigned long nr_pages; + int err; - *ppos += ret; nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; - /* - * If file or inode is SYNC and we actually wrote some data, - * sync it. - */ - if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { - int err; - - mutex_lock(&inode->i_mutex); - err = ocfs2_rw_lock(inode, 1); - if (err < 0) { - mlog_errno(err); - } else { - err = generic_osync_inode(inode, mapping, - OSYNC_METADATA|OSYNC_DATA); - ocfs2_rw_unlock(inode, 1); - } - mutex_unlock(&inode->i_mutex); + err = generic_write_sync(out, *ppos, ret); + if (err) + ret = err; + else + *ppos += ret; - if (err) - ret = err; - } balance_dirty_pages_ratelimited_nr(mapping, nr_pages); } -- 1.6.0.2
Mark Fasheh
2009-Aug-24 18:35 UTC
[Ocfs2-devel] [PATCH 12/17] ocfs2: Update syncing after splicing to match generic version
On Fri, Aug 21, 2009 at 07:24:02PM +0200, Jan Kara wrote:> 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.Thanks Jan, Acked-by: Mark Fasheh <mfasheh at suse.com> -- Mark Fasheh
Joel Becker
2009-Aug-24 18:40 UTC
[Ocfs2-devel] [PATCH 12/17] ocfs2: Update syncing after splicing to match generic version
On Mon, Aug 24, 2009 at 11:35:43AM -0700, Mark Fasheh wrote:> On Fri, Aug 21, 2009 at 07:24:02PM +0200, Jan Kara wrote: > > 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. > > Thanks Jan, > > Acked-by: Mark Fasheh <mfasheh at suse.com><aol>Me too!</aol> Acked-by: Joel Becker <joel.becker at oracle.com> Joel -- A good programming language should have features that make the kind of people who use the phrase "software engineering" shake their heads disapprovingly. - Paul Graham Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127