backref.c (92a7cc4252231d1641b36c38cf845cfc50308ab0) backref.c (56e9357a1e8167134388d4c70654795353765c7b)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2011 STRATO. All rights reserved.
4 */
5
6#include <linux/mm.h>
7#include <linux/rbtree.h>
8#include <trace/events/btrfs.h>

--- 524 unchanged lines hidden (view full) ---

533 */
534static int resolve_indirect_ref(struct btrfs_fs_info *fs_info,
535 struct btrfs_path *path, u64 time_seq,
536 struct preftrees *preftrees,
537 struct prelim_ref *ref, struct ulist *parents,
538 const u64 *extent_item_pos, bool ignore_offset)
539{
540 struct btrfs_root *root;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2011 STRATO. All rights reserved.
4 */
5
6#include <linux/mm.h>
7#include <linux/rbtree.h>
8#include <trace/events/btrfs.h>

--- 524 unchanged lines hidden (view full) ---

533 */
534static int resolve_indirect_ref(struct btrfs_fs_info *fs_info,
535 struct btrfs_path *path, u64 time_seq,
536 struct preftrees *preftrees,
537 struct prelim_ref *ref, struct ulist *parents,
538 const u64 *extent_item_pos, bool ignore_offset)
539{
540 struct btrfs_root *root;
541 struct btrfs_key root_key;
542 struct extent_buffer *eb;
543 int ret = 0;
544 int root_level;
545 int level = ref->level;
546 struct btrfs_key search_key = ref->key_for_search;
547
541 struct extent_buffer *eb;
542 int ret = 0;
543 int root_level;
544 int level = ref->level;
545 struct btrfs_key search_key = ref->key_for_search;
546
548 root_key.objectid = ref->root_id;
549 root_key.type = BTRFS_ROOT_ITEM_KEY;
550 root_key.offset = (u64)-1;
551
552 root = btrfs_get_fs_root(fs_info, &root_key, false);
547 root = btrfs_get_fs_root(fs_info, ref->root_id, false);
553 if (IS_ERR(root)) {
554 ret = PTR_ERR(root);
555 goto out_free;
556 }
557
558 if (!path->search_commit_root &&
559 test_bit(BTRFS_ROOT_DELETING, &root->state)) {
560 ret = -ENOENT;

--- 2124 unchanged lines hidden (view full) ---

2685 struct btrfs_backref_node *cur)
2686{
2687 struct btrfs_fs_info *fs_info = cache->fs_info;
2688 struct btrfs_backref_node *upper;
2689 struct btrfs_backref_node *lower;
2690 struct btrfs_backref_edge *edge;
2691 struct extent_buffer *eb;
2692 struct btrfs_root *root;
548 if (IS_ERR(root)) {
549 ret = PTR_ERR(root);
550 goto out_free;
551 }
552
553 if (!path->search_commit_root &&
554 test_bit(BTRFS_ROOT_DELETING, &root->state)) {
555 ret = -ENOENT;

--- 2124 unchanged lines hidden (view full) ---

2680 struct btrfs_backref_node *cur)
2681{
2682 struct btrfs_fs_info *fs_info = cache->fs_info;
2683 struct btrfs_backref_node *upper;
2684 struct btrfs_backref_node *lower;
2685 struct btrfs_backref_edge *edge;
2686 struct extent_buffer *eb;
2687 struct btrfs_root *root;
2693 struct btrfs_key root_key;
2694 struct rb_node *rb_node;
2695 int level;
2696 bool need_check = true;
2697 int ret;
2698
2688 struct rb_node *rb_node;
2689 int level;
2690 bool need_check = true;
2691 int ret;
2692
2699 root_key.objectid = ref_key->offset;
2700 root_key.type = BTRFS_ROOT_ITEM_KEY;
2701 root_key.offset = (u64)-1;
2702 root = btrfs_get_fs_root(fs_info, &root_key, false);
2693 root = btrfs_get_fs_root(fs_info, ref_key->offset, false);
2703 if (IS_ERR(root))
2704 return PTR_ERR(root);
2705 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
2706 cur->cowonly = 1;
2707
2708 if (btrfs_root_level(&root->root_item) == cur->level) {
2709 /* Tree root */
2710 ASSERT(btrfs_root_bytenr(&root->root_item) == cur->bytenr);

--- 421 unchanged lines hidden ---
2694 if (IS_ERR(root))
2695 return PTR_ERR(root);
2696 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
2697 cur->cowonly = 1;
2698
2699 if (btrfs_root_level(&root->root_item) == cur->level) {
2700 /* Tree root */
2701 ASSERT(btrfs_root_bytenr(&root->root_item) == cur->bytenr);

--- 421 unchanged lines hidden ---