Skip to content

Commit

Permalink
Btrfs: always save ref_root in delayed refs
Browse files Browse the repository at this point in the history
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: Arne Jansen <sensille@gmx.net>
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
  • Loading branch information
Arne Jansen authored and Jan Schmidt committed Dec 22, 2011
1 parent 66d7e7f commit eebe063
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
18 changes: 8 additions & 10 deletions fs/btrfs/delayed-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,12 @@ static noinline int add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
ref->in_tree = 1;

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;
} else {
full_ref->root = ref_root;
else
ref->type = BTRFS_TREE_BLOCK_REF_KEY;
}
full_ref->level = level;

trace_btrfs_delayed_tree_ref(ref, full_ref, action);
Expand Down Expand Up @@ -551,13 +550,12 @@ static noinline int add_delayed_data_ref(struct btrfs_fs_info *fs_info,
ref->in_tree = 1;

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;
} else {
full_ref->root = ref_root;
else
ref->type = BTRFS_EXTENT_DATA_REF_KEY;
}

full_ref->objectid = owner;
full_ref->offset = offset;
Expand Down
12 changes: 4 additions & 8 deletions fs/btrfs/delayed-ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,15 @@ struct btrfs_delayed_ref_head {

struct btrfs_delayed_tree_ref {
struct btrfs_delayed_ref_node node;
union {
u64 root;
u64 parent;
};
u64 root;
u64 parent;
int level;
};

struct btrfs_delayed_data_ref {
struct btrfs_delayed_ref_node node;
union {
u64 root;
u64 parent;
};
u64 root;
u64 parent;
u64 objectid;
u64 offset;
};
Expand Down

0 comments on commit eebe063

Please sign in to comment.