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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux