Lines Matching refs:log_root_tree
154 if (!fs_info->log_root_tree) in start_log_trans()
2916 ret = btrfs_insert_root(trans, fs_info->log_root_tree, in update_log_root()
2919 ret = btrfs_update_root(trans, fs_info->log_root_tree, in update_log_root()
3017 struct btrfs_root *log_root_tree = fs_info->log_root_tree; in btrfs_sync_log() local
3110 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
3111 atomic_inc(&log_root_tree->log_batch); in btrfs_sync_log()
3112 atomic_inc(&log_root_tree->log_writers); in btrfs_sync_log()
3114 index2 = log_root_tree->log_transid % 2; in btrfs_sync_log()
3115 list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]); in btrfs_sync_log()
3116 root_log_ctx.log_transid = log_root_tree->log_transid; in btrfs_sync_log()
3118 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3120 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
3129 if (atomic_dec_and_test(&log_root_tree->log_writers)) { in btrfs_sync_log()
3131 cond_wake_up_nomb(&log_root_tree->log_writer_wait); in btrfs_sync_log()
3143 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3147 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3152 if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { in btrfs_sync_log()
3155 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3161 if (atomic_read(&log_root_tree->log_commit[index2])) { in btrfs_sync_log()
3164 wait_log_commit(log_root_tree, in btrfs_sync_log()
3166 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3171 ASSERT(root_log_ctx.log_transid == log_root_tree->log_transid); in btrfs_sync_log()
3172 atomic_set(&log_root_tree->log_commit[index2], 1); in btrfs_sync_log()
3174 if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2])) { in btrfs_sync_log()
3175 wait_log_commit(log_root_tree, in btrfs_sync_log()
3179 wait_for_writer(log_root_tree); in btrfs_sync_log()
3188 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3194 &log_root_tree->dirty_log_pages, in btrfs_sync_log()
3200 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3205 ret = btrfs_wait_tree_log_extents(log_root_tree, in btrfs_sync_log()
3209 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3214 log_root_tree->node->start); in btrfs_sync_log()
3216 btrfs_header_level(log_root_tree->node)); in btrfs_sync_log()
3218 log_root_tree->log_transid++; in btrfs_sync_log()
3219 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3241 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
3242 btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); in btrfs_sync_log()
3244 log_root_tree->log_transid_committed++; in btrfs_sync_log()
3245 atomic_set(&log_root_tree->log_commit[index2], 0); in btrfs_sync_log()
3246 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3253 cond_wake_up(&log_root_tree->log_commit_wait[index2]); in btrfs_sync_log()
3321 if (fs_info->log_root_tree) { in btrfs_free_log_root_tree()
3322 free_log_tree(trans, fs_info->log_root_tree); in btrfs_free_log_root_tree()
3323 fs_info->log_root_tree = NULL; in btrfs_free_log_root_tree()
5858 int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) in btrfs_recover_log_trees() argument
5867 struct btrfs_fs_info *fs_info = log_root_tree->fs_info; in btrfs_recover_log_trees()
5888 ret = walk_log_tree(trans, log_root_tree, &wc); in btrfs_recover_log_trees()
5901 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
5919 log = btrfs_read_fs_root(log_root_tree, &found_key); in btrfs_recover_log_trees()
6021 free_extent_buffer(log_root_tree->node); in btrfs_recover_log_trees()
6022 log_root_tree->log_root = NULL; in btrfs_recover_log_trees()
6024 kfree(log_root_tree); in btrfs_recover_log_trees()