Commit eebe063b authored by Arne Jansen's avatar Arne Jansen Committed by Jan Schmidt

Btrfs: always save ref_root in delayed refs

For consistent backref walking and (later) qgroup calculation the
information to which root a delayed ref belongs is useful even for shared
refs.
Signed-off-by: default avatarArne Jansen <sensille@gmx.net>
Signed-off-by: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
parent 66d7e7f0
...@@ -495,13 +495,12 @@ static noinline int add_delayed_tree_ref(struct btrfs_fs_info *fs_info, ...@@ -495,13 +495,12 @@ static noinline int add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
ref->in_tree = 1; ref->in_tree = 1;
full_ref = btrfs_delayed_node_to_tree_ref(ref); full_ref = btrfs_delayed_node_to_tree_ref(ref);
if (parent) { full_ref->parent = parent;
full_ref->parent = parent; full_ref->root = ref_root;
if (parent)
ref->type = BTRFS_SHARED_BLOCK_REF_KEY; ref->type = BTRFS_SHARED_BLOCK_REF_KEY;
} else { else
full_ref->root = ref_root;
ref->type = BTRFS_TREE_BLOCK_REF_KEY; ref->type = BTRFS_TREE_BLOCK_REF_KEY;
}
full_ref->level = level; full_ref->level = level;
trace_btrfs_delayed_tree_ref(ref, full_ref, action); trace_btrfs_delayed_tree_ref(ref, full_ref, action);
...@@ -551,13 +550,12 @@ static noinline int add_delayed_data_ref(struct btrfs_fs_info *fs_info, ...@@ -551,13 +550,12 @@ static noinline int add_delayed_data_ref(struct btrfs_fs_info *fs_info,
ref->in_tree = 1; ref->in_tree = 1;
full_ref = btrfs_delayed_node_to_data_ref(ref); full_ref = btrfs_delayed_node_to_data_ref(ref);
if (parent) { full_ref->parent = parent;
full_ref->parent = parent; full_ref->root = ref_root;
if (parent)
ref->type = BTRFS_SHARED_DATA_REF_KEY; ref->type = BTRFS_SHARED_DATA_REF_KEY;
} else { else
full_ref->root = ref_root;
ref->type = BTRFS_EXTENT_DATA_REF_KEY; ref->type = BTRFS_EXTENT_DATA_REF_KEY;
}
full_ref->objectid = owner; full_ref->objectid = owner;
full_ref->offset = offset; full_ref->offset = offset;
......
...@@ -98,19 +98,15 @@ struct btrfs_delayed_ref_head { ...@@ -98,19 +98,15 @@ struct btrfs_delayed_ref_head {
struct btrfs_delayed_tree_ref { struct btrfs_delayed_tree_ref {
struct btrfs_delayed_ref_node node; struct btrfs_delayed_ref_node node;
union { u64 root;
u64 root; u64 parent;
u64 parent;
};
int level; int level;
}; };
struct btrfs_delayed_data_ref { struct btrfs_delayed_data_ref {
struct btrfs_delayed_ref_node node; struct btrfs_delayed_ref_node node;
union { u64 root;
u64 root; u64 parent;
u64 parent;
};
u64 objectid; u64 objectid;
u64 offset; u64 offset;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment