Lines Matching refs:log_root_tree
160 if (!fs_info->log_root_tree) in start_log_trans()
2943 ret = btrfs_insert_root(trans, fs_info->log_root_tree, in update_log_root()
2946 ret = btrfs_update_root(trans, fs_info->log_root_tree, in update_log_root()
3044 struct btrfs_root *log_root_tree = fs_info->log_root_tree; in btrfs_sync_log() local
3137 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
3138 atomic_inc(&log_root_tree->log_batch); in btrfs_sync_log()
3139 atomic_inc(&log_root_tree->log_writers); in btrfs_sync_log()
3141 index2 = log_root_tree->log_transid % 2; in btrfs_sync_log()
3142 list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]); in btrfs_sync_log()
3143 root_log_ctx.log_transid = log_root_tree->log_transid; in btrfs_sync_log()
3145 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3147 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
3156 if (atomic_dec_and_test(&log_root_tree->log_writers)) { in btrfs_sync_log()
3158 cond_wake_up_nomb(&log_root_tree->log_writer_wait); in btrfs_sync_log()
3170 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3174 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3179 if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { in btrfs_sync_log()
3182 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3188 if (atomic_read(&log_root_tree->log_commit[index2])) { in btrfs_sync_log()
3191 wait_log_commit(log_root_tree, in btrfs_sync_log()
3193 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3198 ASSERT(root_log_ctx.log_transid == log_root_tree->log_transid); in btrfs_sync_log()
3199 atomic_set(&log_root_tree->log_commit[index2], 1); in btrfs_sync_log()
3201 if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2])) { in btrfs_sync_log()
3202 wait_log_commit(log_root_tree, in btrfs_sync_log()
3206 wait_for_writer(log_root_tree); in btrfs_sync_log()
3215 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3221 &log_root_tree->dirty_log_pages, in btrfs_sync_log()
3227 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3232 ret = btrfs_wait_tree_log_extents(log_root_tree, in btrfs_sync_log()
3236 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3241 log_root_tree->node->start); in btrfs_sync_log()
3243 btrfs_header_level(log_root_tree->node)); in btrfs_sync_log()
3245 log_root_tree->log_transid++; in btrfs_sync_log()
3246 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3268 mutex_lock(&log_root_tree->log_mutex); in btrfs_sync_log()
3269 btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); in btrfs_sync_log()
3271 log_root_tree->log_transid_committed++; in btrfs_sync_log()
3272 atomic_set(&log_root_tree->log_commit[index2], 0); in btrfs_sync_log()
3273 mutex_unlock(&log_root_tree->log_mutex); in btrfs_sync_log()
3280 cond_wake_up(&log_root_tree->log_commit_wait[index2]); in btrfs_sync_log()
3336 if (fs_info->log_root_tree) { in btrfs_free_log_root_tree()
3337 free_log_tree(trans, fs_info->log_root_tree); in btrfs_free_log_root_tree()
3338 fs_info->log_root_tree = NULL; in btrfs_free_log_root_tree()
6241 int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) in btrfs_recover_log_trees() argument
6250 struct btrfs_fs_info *fs_info = log_root_tree->fs_info; in btrfs_recover_log_trees()
6271 ret = walk_log_tree(trans, log_root_tree, &wc); in btrfs_recover_log_trees()
6284 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); in btrfs_recover_log_trees()
6302 log = btrfs_read_fs_root(log_root_tree, &found_key); in btrfs_recover_log_trees()
6385 free_extent_buffer(log_root_tree->node); in btrfs_recover_log_trees()
6386 log_root_tree->log_root = NULL; in btrfs_recover_log_trees()
6388 kfree(log_root_tree); in btrfs_recover_log_trees()