Skip to content

Commit

Permalink
splice: adjust balance_dirty_pages_ratelimited() call
Browse files Browse the repository at this point in the history
As we have potentially dirtied more than 1 page, we should indicate as
such to the dirty page balancing. So call
balance_dirty_pages_ratelimited_nr() and pass in the approximate number
of pages we dirtied.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Jun 15, 2007
1 parent 22b1a92 commit 17ee4f4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,10 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,

ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
if (ret > 0) {
unsigned long nr_pages;

*ppos += ret;
nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;

/*
* If file or inode is SYNC and we actually wrote some data,
Expand All @@ -824,7 +827,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
if (err)
ret = err;
}
balance_dirty_pages_ratelimited(mapping);
balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
}

return ret;
Expand Down Expand Up @@ -863,7 +866,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,

ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
if (ret > 0) {
unsigned long nr_pages;

*ppos += ret;
nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;

/*
* If file or inode is SYNC and we actually wrote some data,
Expand All @@ -878,7 +884,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
if (err)
ret = err;
}
balance_dirty_pages_ratelimited(mapping);
balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
}

return ret;
Expand Down

0 comments on commit 17ee4f4

Please sign in to comment.