xfs
[Top] [All Lists]

[PATCH 1/5] splice: move balance_dirty_pages_ratelimited into pipe_to_fi

To: Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, Mark Fasheh <mfasheh@xxxxxxxx>, Joel Becker <jlbec@xxxxxxxxxxxx>
Subject: [PATCH 1/5] splice: move balance_dirty_pages_ratelimited into pipe_to_file
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 12 Dec 2013 10:15:00 -0800
Cc: linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
References: <20131212181459.994196463@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.60-1
Try to balance the dirty pages for every written pages instead of once
per system call, mirroring the regular write path.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/ocfs2/file.c |    2 --
 fs/splice.c     |    5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 6fff128..a77ef6e 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2494,8 +2494,6 @@ static ssize_t ocfs2_file_splice_write(struct 
pipe_inode_info *pipe,
                        ret = err;
                else
                        *ppos += ret;
-
-               balance_dirty_pages_ratelimited(mapping);
        }
 
        return ret;
diff --git a/fs/splice.c b/fs/splice.c
index 46a08f7..fcb459d 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -759,6 +759,10 @@ int pipe_to_file(struct pipe_inode_info *pipe, struct 
pipe_buffer *buf,
        }
        ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len,
                                page, fsdata);
+       if (ret)
+               goto out;
+
+       balance_dirty_pages_ratelimited(mapping);
 out:
        return ret;
 }
@@ -1034,7 +1038,6 @@ generic_file_splice_write(struct pipe_inode_info *pipe, 
struct file *out,
                        ret = err;
                else
                        *ppos += ret;
-               balance_dirty_pages_ratelimited(mapping);
        }
 
        return ret;
-- 
1.7.10.4


<Prev in Thread] Current Thread [Next in Thread>