]> Pileus Git - ~andy/linux/commitdiff
ext4: yield during large unlinks
authorTheodore Ts'o <tytso@mit.edu>
Mon, 15 Jul 2013 16:27:47 +0000 (12:27 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 15 Jul 2013 16:27:47 +0000 (12:27 -0400)
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: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/extents.c

index 593091537e7697dc22dfb11f6ea6dcccade3f590..cfdc51e302575e7c57e7baf12d37ab0c53b6273d 100644 (file)
@@ -2835,6 +2835,9 @@ again:
                                err = -EIO;
                                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)) {
                                err = -EIO;
                                break;