diff options
author | Filipe Manana <fdmanana@suse.com> | 2022-09-19 15:06:31 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-09-29 17:08:30 +0200 |
commit | 99ba0c815058805a179d0edf8ddd421898798957 (patch) | |
tree | 48f8cc0d641eae20859556fe7262041295394616 /fs/btrfs | |
parent | f3109e33bb0a523f70a3394b51c878dbedb60528 (diff) |
btrfs: use cond_resched_rwlock_write() during inode eviction
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8f0376a4efb7..491c2b7f48bf 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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); |