Commit 76828c88 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: yield during large unlinks

During large unlink operations on files with extents, we can use a lot
of CPU time.  This adds a cond_resched() call when starting to examine
the next level of a multi-level extent tree.  Multi-level extent trees
are rare in the first place, and this should rarely be executed.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent e15f742c
...@@ -2835,6 +2835,9 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start, ...@@ -2835,6 +2835,9 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
err = -EIO; err = -EIO;
break; break;
} }
/* Yield here to deal with large extent trees.
* Should be a no-op if we did IO above. */
cond_resched();
if (WARN_ON(i + 1 > depth)) { if (WARN_ON(i + 1 > depth)) {
err = -EIO; err = -EIO;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment