aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-04-01 02:39:06 -0400
committerChris Mason <clm@fb.com>2015-06-10 12:24:59 -0400
commit00db646d3fb3f5f62c2327abcf3630f4cc1075ba (patch)
tree6dcc37bf71b946cd6322028f67bf315e83fbd4b7
parent20b2e3029eef277cd93a46a991004260057e1a9e (diff)
btrfs: backref: Don't merge refs which are not for same block.
Old __merge_refs() in backref.c will even merge refs whose root_id are different, which makes qgroup gives wrong result. Fix it by checking ref_for_same_block() before any mode specific works. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/backref.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 679dc97354be..a3316f1707e6 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -509,7 +509,7 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
509} 509}
510 510
511/* 511/*
512 * merge two lists of backrefs and adjust counts accordingly 512 * merge backrefs and adjust counts accordingly
513 * 513 *
514 * mode = 1: merge identical keys, if key is set 514 * mode = 1: merge identical keys, if key is set
515 * FIXME: if we add more keys in __add_prelim_ref, we can merge more here. 515 * FIXME: if we add more keys in __add_prelim_ref, we can merge more here.
@@ -537,9 +537,9 @@ static void __merge_refs(struct list_head *head, int mode)
537 537
538 ref2 = list_entry(pos2, struct __prelim_ref, list); 538 ref2 = list_entry(pos2, struct __prelim_ref, list);
539 539
540 if (!ref_for_same_block(ref1, ref2))
541 continue;
540 if (mode == 1) { 542 if (mode == 1) {
541 if (!ref_for_same_block(ref1, ref2))
542 continue;
543 if (!ref1->parent && ref2->parent) { 543 if (!ref1->parent && ref2->parent) {
544 xchg = ref1; 544 xchg = ref1;
545 ref1 = ref2; 545 ref1 = ref2;