Lines Matching refs:log_root_tree
172 if (!root->fs_info->log_root_tree) in start_log_trans()
2529 ret = btrfs_insert_root(trans, log->fs_info->log_root_tree, in update_log_root()
2532 ret = btrfs_update_root(trans, log->fs_info->log_root_tree, in update_log_root()
2631 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; in btrfs_sync_log() local
2711 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
2712 atomic_inc(&log_root_tree->log_batch); in btrfs_sync_log()
2713 atomic_inc(&log_root_tree->log_writers); in btrfs_sync_log()
2715 index2 = log_root_tree->log_transid % 2; in btrfs_sync_log()
2716 list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]); in btrfs_sync_log()
2717 root_log_ctx.log_transid = log_root_tree->log_transid; in btrfs_sync_log()
2719 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2723 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
2724 if (atomic_dec_and_test(&log_root_tree->log_writers)) { in btrfs_sync_log()
2726 if (waitqueue_active(&log_root_tree->log_writer_wait)) in btrfs_sync_log()
2727 wake_up(&log_root_tree->log_writer_wait); in btrfs_sync_log()
2739 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2744 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2749 if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { in btrfs_sync_log()
2751 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2757 if (atomic_read(&log_root_tree->log_commit[index2])) { in btrfs_sync_log()
2762 wait_log_commit(trans, log_root_tree, in btrfs_sync_log()
2764 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2769 ASSERT(root_log_ctx.log_transid == log_root_tree->log_transid); in btrfs_sync_log()
2770 atomic_set(&log_root_tree->log_commit[index2], 1); in btrfs_sync_log()
2772 if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2])) { in btrfs_sync_log()
2773 wait_log_commit(trans, log_root_tree, in btrfs_sync_log()
2777 wait_for_writer(trans, log_root_tree); in btrfs_sync_log()
2787 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2792 ret = btrfs_write_marked_extents(log_root_tree, in btrfs_sync_log()
2793 &log_root_tree->dirty_log_pages, in btrfs_sync_log()
2800 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2805 ret = btrfs_wait_marked_extents(log_root_tree, in btrfs_sync_log()
2806 &log_root_tree->dirty_log_pages, in btrfs_sync_log()
2811 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2817 log_root_tree->node->start); in btrfs_sync_log()
2819 btrfs_header_level(log_root_tree->node)); in btrfs_sync_log()
2821 log_root_tree->log_transid++; in btrfs_sync_log()
2822 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2848 btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); in btrfs_sync_log()
2850 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
2851 log_root_tree->log_transid_committed++; in btrfs_sync_log()
2852 atomic_set(&log_root_tree->log_commit[index2], 0); in btrfs_sync_log()
2853 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2855 if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) in btrfs_sync_log()
2856 wake_up(&log_root_tree->log_commit_wait[index2]); in btrfs_sync_log()
2926 if (fs_info->log_root_tree) { in btrfs_free_log_root_tree()
2927 free_log_tree(trans, fs_info->log_root_tree); in btrfs_free_log_root_tree()
2928 fs_info->log_root_tree = NULL; in btrfs_free_log_root_tree()
5212 int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) in btrfs_recover_log_trees() argument
5221 struct btrfs_fs_info *fs_info = log_root_tree->fs_info; in btrfs_recover_log_trees()
5242 ret = walk_log_tree(trans, log_root_tree, &wc); in btrfs_recover_log_trees()
5255 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
5273 log = btrfs_read_fs_root(log_root_tree, &found_key); in btrfs_recover_log_trees()
5339 free_extent_buffer(log_root_tree->node); in btrfs_recover_log_trees()
5340 log_root_tree->log_root = NULL; in btrfs_recover_log_trees()
5342 kfree(log_root_tree); in btrfs_recover_log_trees()