]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: use cond_resched_rwlock_write() during inode eviction
authorFilipe Manana <fdmanana@suse.com>
Mon, 19 Sep 2022 14:06:31 +0000 (15:06 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 29 Sep 2022 15:08:30 +0000 (17:08 +0200)
At evict_inode_truncate_pages(), instead of manually checking if
rescheduling is needed, then unlock the extent map tree, reschedule and
then write lock again the tree, use the helper cond_resched_rwlock_write()
which does all that.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index 8f0376a4efb7f8068dfd37a25a4f42b4d22b6acb..491c2b7f48bfd88f28ac6d38d3fb699fcefca86b 100644 (file)
@@ -5305,11 +5305,7 @@ static void evict_inode_truncate_pages(struct inode *inode)
                clear_bit(EXTENT_FLAG_LOGGING, &em->flags);
                remove_extent_mapping(map_tree, em);
                free_extent_map(em);
-               if (need_resched()) {
-                       write_unlock(&map_tree->lock);
-                       cond_resched();
-                       write_lock(&map_tree->lock);
-               }
+               cond_resched_rwlock_write(&map_tree->lock);
        }
        write_unlock(&map_tree->lock);