diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-05-23 23:48:23 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-05-23 23:48:23 +0300 |
commit | df1c5d73d2856af0425bdf6f023202e957bd7435 (patch) | |
tree | d4f1731cd902ecc5620b94fe92434a775d11ba68 | |
parent | 9836e93c0a7e031ac6a71c56171c229de1eea7cf (diff) | |
parent | 68f4c6eba70df70a720188bce95c85570ddfcc87 (diff) | |
download | linux-df1c5d73d2856af0425bdf6f023202e957bd7435.tar.xz |
Merge tag 'for-5.19/writeback-2022-05-22' of git://git.kernel.dk/linux-block
Pull writeback fix from Jens Axboe:
"A single writeback fix that didn't belong in any other branch,
correcting the number of skipped pages"
* tag 'for-5.19/writeback-2022-05-22' of git://git.kernel.dk/linux-block:
fs-writeback: writeback_sb_inodes:Recalculate 'wrote' according skipped pages
-rw-r--r-- | fs/fs-writeback.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 1fae0196292a..a1074a26e784 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1779,11 +1779,12 @@ static long writeback_sb_inodes(struct super_block *sb, }; unsigned long start_time = jiffies; long write_chunk; - long wrote = 0; /* count both pages and inodes */ + long total_wrote = 0; /* count both pages and inodes */ while (!list_empty(&wb->b_io)) { struct inode *inode = wb_inode(wb->b_io.prev); struct bdi_writeback *tmp_wb; + long wrote; if (inode->i_sb != sb) { if (work->sb) { @@ -1859,7 +1860,9 @@ static long writeback_sb_inodes(struct super_block *sb, wbc_detach_inode(&wbc); work->nr_pages -= write_chunk - wbc.nr_to_write; - wrote += write_chunk - wbc.nr_to_write; + wrote = write_chunk - wbc.nr_to_write - wbc.pages_skipped; + wrote = wrote < 0 ? 0 : wrote; + total_wrote += wrote; if (need_resched()) { /* @@ -1881,7 +1884,7 @@ static long writeback_sb_inodes(struct super_block *sb, tmp_wb = inode_to_wb_and_lock_list(inode); spin_lock(&inode->i_lock); if (!(inode->i_state & I_DIRTY_ALL)) - wrote++; + total_wrote++; requeue_inode(inode, tmp_wb, &wbc); inode_sync_complete(inode); spin_unlock(&inode->i_lock); @@ -1895,14 +1898,14 @@ static long writeback_sb_inodes(struct super_block *sb, * bail out to wb_writeback() often enough to check * background threshold and other termination conditions. */ - if (wrote) { + if (total_wrote) { if (time_is_before_jiffies(start_time + HZ / 10UL)) break; if (work->nr_pages <= 0) break; } } - return wrote; + return total_wrote; } static long __writeback_inodes_wb(struct bdi_writeback *wb, |