Lines Matching refs:log_root_tree

161 		if (!root->fs_info->log_root_tree)  in start_log_trans()
2631 ret = btrfs_insert_root(trans, log->fs_info->log_root_tree, in update_log_root()
2634 ret = btrfs_update_root(trans, log->fs_info->log_root_tree, in update_log_root()
2731 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; in btrfs_sync_log() local
2811 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
2812 atomic_inc(&log_root_tree->log_batch); in btrfs_sync_log()
2813 atomic_inc(&log_root_tree->log_writers); in btrfs_sync_log()
2815 index2 = log_root_tree->log_transid % 2; in btrfs_sync_log()
2816 list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]); in btrfs_sync_log()
2817 root_log_ctx.log_transid = log_root_tree->log_transid; in btrfs_sync_log()
2819 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2823 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
2824 if (atomic_dec_and_test(&log_root_tree->log_writers)) { in btrfs_sync_log()
2828 if (waitqueue_active(&log_root_tree->log_writer_wait)) in btrfs_sync_log()
2829 wake_up(&log_root_tree->log_writer_wait); in btrfs_sync_log()
2841 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2846 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2851 if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { in btrfs_sync_log()
2853 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2859 if (atomic_read(&log_root_tree->log_commit[index2])) { in btrfs_sync_log()
2864 wait_log_commit(log_root_tree, in btrfs_sync_log()
2866 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2871 ASSERT(root_log_ctx.log_transid == log_root_tree->log_transid); in btrfs_sync_log()
2872 atomic_set(&log_root_tree->log_commit[index2], 1); in btrfs_sync_log()
2874 if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2])) { in btrfs_sync_log()
2875 wait_log_commit(log_root_tree, in btrfs_sync_log()
2879 wait_for_writer(log_root_tree); in btrfs_sync_log()
2889 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2894 ret = btrfs_write_marked_extents(log_root_tree, in btrfs_sync_log()
2895 &log_root_tree->dirty_log_pages, in btrfs_sync_log()
2902 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2907 ret = btrfs_wait_marked_extents(log_root_tree, in btrfs_sync_log()
2908 &log_root_tree->dirty_log_pages, in btrfs_sync_log()
2913 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2919 log_root_tree->node->start); in btrfs_sync_log()
2921 btrfs_header_level(log_root_tree->node)); in btrfs_sync_log()
2923 log_root_tree->log_transid++; in btrfs_sync_log()
2924 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2950 btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); in btrfs_sync_log()
2952 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
2953 log_root_tree->log_transid_committed++; in btrfs_sync_log()
2954 atomic_set(&log_root_tree->log_commit[index2], 0); in btrfs_sync_log()
2955 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
2960 if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) in btrfs_sync_log()
2961 wake_up(&log_root_tree->log_commit_wait[index2]); in btrfs_sync_log()
3034 if (fs_info->log_root_tree) { in btrfs_free_log_root_tree()
3035 free_log_tree(trans, fs_info->log_root_tree); in btrfs_free_log_root_tree()
3036 fs_info->log_root_tree = NULL; in btrfs_free_log_root_tree()
5432 int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) in btrfs_recover_log_trees() argument
5441 struct btrfs_fs_info *fs_info = log_root_tree->fs_info; in btrfs_recover_log_trees()
5462 ret = walk_log_tree(trans, log_root_tree, &wc); in btrfs_recover_log_trees()
5475 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
5493 log = btrfs_read_fs_root(log_root_tree, &found_key); in btrfs_recover_log_trees()
5559 free_extent_buffer(log_root_tree->node); in btrfs_recover_log_trees()
5560 log_root_tree->log_root = NULL; in btrfs_recover_log_trees()
5562 kfree(log_root_tree); in btrfs_recover_log_trees()