aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArne Jansen <sensille@gmx.net>2011-09-14 08:01:24 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2011-12-22 10:22:28 -0500
commiteebe063b7f916087cd5c61de57b20a3a30894a96 (patch)
treed49c4a91abd9bef6f2fd546715f719c66ae1fd90 /fs
parent66d7e7f09f77456fe68683247d77721032a00ee5 (diff)
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: Arne Jansen <sensille@gmx.net> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/delayed-ref.c18
-rw-r--r--fs/btrfs/delayed-ref.h12
2 files changed, 12 insertions, 18 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 3a0f0ab804f4..babd37badb43 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -495,13 +495,12 @@ static noinline int add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
495 ref->in_tree = 1; 495 ref->in_tree = 1;
496 496
497 full_ref = btrfs_delayed_node_to_tree_ref(ref); 497 full_ref = btrfs_delayed_node_to_tree_ref(ref);
498 if (parent) { 498 full_ref->parent = parent;
499 full_ref->parent = parent; 499 full_ref->root = ref_root;
500 if (parent)
500 ref->type = BTRFS_SHARED_BLOCK_REF_KEY; 501 ref->type = BTRFS_SHARED_BLOCK_REF_KEY;
501 } else { 502 else
502 full_ref->root = ref_root;
503 ref->type = BTRFS_TREE_BLOCK_REF_KEY; 503 ref->type = BTRFS_TREE_BLOCK_REF_KEY;
504 }
505 full_ref->level = level; 504 full_ref->level = level;
506 505
507 trace_btrfs_delayed_tree_ref(ref, full_ref, action); 506 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 ref->in_tree = 1; 550 ref->in_tree = 1;
552 551
553 full_ref = btrfs_delayed_node_to_data_ref(ref); 552 full_ref = btrfs_delayed_node_to_data_ref(ref);
554 if (parent) { 553 full_ref->parent = parent;
555 full_ref->parent = parent; 554 full_ref->root = ref_root;
555 if (parent)
556 ref->type = BTRFS_SHARED_DATA_REF_KEY; 556 ref->type = BTRFS_SHARED_DATA_REF_KEY;
557 } else { 557 else
558 full_ref->root = ref_root;
559 ref->type = BTRFS_EXTENT_DATA_REF_KEY; 558 ref->type = BTRFS_EXTENT_DATA_REF_KEY;
560 }
561 559
562 full_ref->objectid = owner; 560 full_ref->objectid = owner;
563 full_ref->offset = offset; 561 full_ref->offset = offset;
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index 8316bff18d30..a5fb2bc83732 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -98,19 +98,15 @@ struct btrfs_delayed_ref_head {
98 98
99struct btrfs_delayed_tree_ref { 99struct btrfs_delayed_tree_ref {
100 struct btrfs_delayed_ref_node node; 100 struct btrfs_delayed_ref_node node;
101 union { 101 u64 root;
102 u64 root; 102 u64 parent;
103 u64 parent;
104 };
105 int level; 103 int level;
106}; 104};
107 105
108struct btrfs_delayed_data_ref { 106struct btrfs_delayed_data_ref {
109 struct btrfs_delayed_ref_node node; 107 struct btrfs_delayed_ref_node node;
110 union { 108 u64 root;
111 u64 root; 109 u64 parent;
112 u64 parent;
113 };
114 u64 objectid; 110 u64 objectid;
115 u64 offset; 111 u64 offset;
116}; 112};