Skip to content

Commit

Permalink
ext4: return correct wbc.nr_to_write in ext4_da_writepages
Browse files Browse the repository at this point in the history
When ext4_da_writepages increases the nr_to_write in writeback_control
then it must always re-base the return value.  Originally there was a
(misguided) attempt prevent wbc.nr_to_write from going negative.  In
fact, it's necessary to allow nr_to_write to be negative so that
wb_writeback() can correctly calculate how many pages were actually
written.  

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Richard Kennedy authored and Theodore Ts'o committed Dec 25, 2009
1 parent 6d3b82f commit 2faf2e1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2967,8 +2967,7 @@ static int ext4_da_writepages(struct address_space *mapping,
out_writepages:
if (!no_nrwrite_index_update)
wbc->no_nrwrite_index_update = 0;
if (wbc->nr_to_write > nr_to_writebump)
wbc->nr_to_write -= nr_to_writebump;
wbc->nr_to_write -= nr_to_writebump;
wbc->range_start = range_start;
trace_ext4_da_writepages_result(inode, wbc, ret, pages_written);
return ret;
Expand Down

0 comments on commit 2faf2e1

Please sign in to comment.