break out of ext4_num_dirty_pages() when we hit max_pages
PATCH 1/1 break out of ext4_num_dirty_pages() when we hit max_pages
ext4_num_dirty_pages() will continue scanning after we accumulate max_pages, possibly for a very long time without doing anything useful at all. When we hit max_pages, we should set done=1 so that the break will release the pagevec, exit the loop, and return from the function.
Signed-off-by Eric Sandeen <[email protected]>
---
fs/ext4/inode.c +3 -1
@@ -1207,8 +1207,10 @@ static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx,break ; idx++; num++; -if (num >= max_pages) +if (num >= max_pages) { + done =1 ;break ; + } }pagevec_release (&pvec); }
Ted Ts'o
maintainerQuoted 7 lines · Eric Sandeen
ext4_num_dirty_pages()will continue scanning after we accumulatemax_pages, possibly for a very long time without doing anything useful at all. When we hitmax_pages, we should set done=1 so that the break will release the pagevec, exit the loop, and return from the function.Signed-off-by Eric Sandeen <[email protected]>
Added to the ext4 tree, thanks.
- Ted