Lines Matching defs:log_root_tree
292 if (!fs_info->log_root_tree) {
328 * This means fs_info->log_root_tree was already created
3175 ret = btrfs_insert_root(trans, fs_info->log_root_tree,
3178 ret = btrfs_update_root(trans, fs_info->log_root_tree,
3316 struct btrfs_root *log_root_tree = fs_info->log_root_tree;
3405 * log_root_tree->log_mutex yet. This is important because when we
3406 * commit the log_root_tree we must have a consistent view of the
3407 * log_root_tree when we update the super block to point at the
3408 * log_root_tree bytenr. If we update the log_root_tree here we'll race
3427 if (!log_root_tree->node) {
3428 ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
3441 mutex_lock(&log_root_tree->log_mutex);
3443 index2 = log_root_tree->log_transid % 2;
3444 list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]);
3445 root_log_ctx.log_transid = log_root_tree->log_transid;
3448 * Now we are safe to update the log_root_tree because we're under the
3463 mutex_unlock(&log_root_tree->log_mutex);
3467 if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) {
3470 mutex_unlock(&log_root_tree->log_mutex);
3476 if (atomic_read(&log_root_tree->log_commit[index2])) {
3479 wait_log_commit(log_root_tree,
3481 mutex_unlock(&log_root_tree->log_mutex);
3487 ASSERT(root_log_ctx.log_transid == log_root_tree->log_transid,
3488 "root_log_ctx.log_transid=%d log_root_tree->log_transid=%d",
3489 root_log_ctx.log_transid, log_root_tree->log_transid);
3490 atomic_set(&log_root_tree->log_commit[index2], 1);
3492 if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2])) {
3493 wait_log_commit(log_root_tree,
3504 mutex_unlock(&log_root_tree->log_mutex);
3511 &log_root_tree->dirty_log_pages,
3523 mutex_unlock(&log_root_tree->log_mutex);
3528 mutex_unlock(&log_root_tree->log_mutex);
3533 ret = btrfs_wait_tree_log_extents(log_root_tree,
3538 mutex_unlock(&log_root_tree->log_mutex);
3542 log_root_start = log_root_tree->node->start;
3543 log_root_level = btrfs_header_level(log_root_tree->node);
3544 log_root_tree->log_transid++;
3545 mutex_unlock(&log_root_tree->log_mutex);
3605 mutex_lock(&log_root_tree->log_mutex);
3606 btrfs_remove_all_log_ctxs(log_root_tree, index2, ret);
3608 log_root_tree->log_transid_committed++;
3609 atomic_set(&log_root_tree->log_commit[index2], 0);
3610 mutex_unlock(&log_root_tree->log_mutex);
3617 cond_wake_up(&log_root_tree->log_commit_wait[index2]);
3699 if (fs_info->log_root_tree) {
3700 free_log_tree(trans, fs_info->log_root_tree);
3701 fs_info->log_root_tree = NULL;
7760 int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
7766 struct btrfs_fs_info *fs_info = log_root_tree->fs_info;
7786 wc.log = log_root_tree;
7803 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0);
7820 wc.log = btrfs_read_tree_root(log_root_tree, &found_key);