* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: Btrfs: be more polite in the async caching threads Btrfs: preserve commit_root for async caching
···825 struct mutex drop_mutex;826 struct mutex volume_mutex;827 struct mutex tree_reloc_mutex;0828829 /*830 * this protects the ordered operations list only while we are···959960 /* the node lock is held while changing the node pointer */961 spinlock_t node_lock;962-963- /* taken when updating the commit root */964- struct rw_semaphore commit_root_sem;965966 struct extent_buffer *commit_root;967 struct btrfs_root *log_root;
···825 struct mutex drop_mutex;826 struct mutex volume_mutex;827 struct mutex tree_reloc_mutex;828+ struct rw_semaphore extent_commit_sem;829830 /*831 * this protects the ordered operations list only while we are···958959 /* the node lock is held while changing the node pointer */960 spinlock_t node_lock;000961962 struct extent_buffer *commit_root;963 struct btrfs_root *log_root;
···267 last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET);268again:269 /* need to make sure the commit_root doesn't disappear */270- down_read(&fs_info->extent_root->commit_root_sem);271272 /*273 * We don't want to deadlock with somebody trying to allocate a new···302 else if (ret)303 break;304305- if (need_resched()) {0306 btrfs_release_path(fs_info->extent_root, path);307- up_read(&fs_info->extent_root->commit_root_sem);308- cond_resched();309 goto again;310 }311···346347err:348 btrfs_free_path(path);349- up_read(&fs_info->extent_root->commit_root_sem);350 atomic_dec(&block_group->space_info->caching_threads);351 wake_up(&block_group->caching_q);352
···267 last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET);268again:269 /* need to make sure the commit_root doesn't disappear */270+ down_read(&fs_info->extent_commit_sem);271272 /*273 * We don't want to deadlock with somebody trying to allocate a new···302 else if (ret)303 break;304305+ if (need_resched() ||306+ btrfs_transaction_in_commit(fs_info)) {307 btrfs_release_path(fs_info->extent_root, path);308+ up_read(&fs_info->extent_commit_sem);309+ schedule_timeout(1);310 goto again;311 }312···345346err:347 btrfs_free_path(path);348+ up_read(&fs_info->extent_commit_sem);349 atomic_dec(&block_group->space_info->caching_threads);350 wake_up(&block_group->caching_q);351