* 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
···825825 struct mutex drop_mutex;826826 struct mutex volume_mutex;827827 struct mutex tree_reloc_mutex;828828+ struct rw_semaphore extent_commit_sem;828829829830 /*830831 * this protects the ordered operations list only while we are···959958960959 /* the node lock is held while changing the node pointer */961960 spinlock_t node_lock;962962-963963- /* taken when updating the commit root */964964- struct rw_semaphore commit_root_sem;965961966962 struct extent_buffer *commit_root;967963 struct btrfs_root *log_root;
···267267 last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET);268268again:269269 /* need to make sure the commit_root doesn't disappear */270270- down_read(&fs_info->extent_root->commit_root_sem);270270+ down_read(&fs_info->extent_commit_sem);271271272272 /*273273 * We don't want to deadlock with somebody trying to allocate a new···302302 else if (ret)303303 break;304304305305- if (need_resched()) {305305+ if (need_resched() ||306306+ btrfs_transaction_in_commit(fs_info)) {306307 btrfs_release_path(fs_info->extent_root, path);307307- up_read(&fs_info->extent_root->commit_root_sem);308308- cond_resched();308308+ up_read(&fs_info->extent_commit_sem);309309+ schedule_timeout(1);309310 goto again;310311 }311312···346345347346err:348347 btrfs_free_path(path);349349- up_read(&fs_info->extent_root->commit_root_sem);348348+ up_read(&fs_info->extent_commit_sem);350349 atomic_dec(&block_group->space_info->caching_threads);351350 wake_up(&block_group->caching_q);352351