diff options
author | David Sterba <dsterba@suse.cz> | 2015-01-08 15:20:54 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-03-03 17:23:56 +0100 |
commit | 351810c1d2aafa288af61844d877941d516fb031 (patch) | |
tree | 895beffc58abf520af6b1672d1245bb889e1ec11 /fs/btrfs/file.c | |
parent | 853d8ec4b288ce52b49e12beeef0f3659ac423ce (diff) | |
download | linux-351810c1d2aafa288af61844d877941d516fb031.tar.bz2 |
btrfs: use cond_resched_lock where possible
Clean the opencoded variant, cond_resched_lock also checks the lock for
contention so it might help in some cases that were not covered by
simple need_resched().
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index e4090259569b..1e34bc00249f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -273,11 +273,7 @@ void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info) defrag = rb_entry(node, struct inode_defrag, rb_node); kmem_cache_free(btrfs_inode_defrag_cachep, defrag); - if (need_resched()) { - spin_unlock(&fs_info->defrag_inodes_lock); - cond_resched(); - spin_lock(&fs_info->defrag_inodes_lock); - } + cond_resched_lock(&fs_info->defrag_inodes_lock); node = rb_first(&fs_info->defrag_inodes); } |