diff options
author | 2015-04-01 14:39:06 +0800 | |
---|---|---|
committer | 2015-06-10 09:24:59 -0700 | |
commit | 00db646d3fb3f5f62c2327abcf3630f4cc1075ba (patch) | |
tree | 6dcc37bf71b946cd6322028f67bf315e83fbd4b7 /fs/btrfs/backref.c | |
parent | btrfs: Fix lockdep warning of wr_ctx->wr_lock in scrub_free_wr_ctx() (diff) | |
download | linux-00db646d3fb3f5f62c2327abcf3630f4cc1075ba.tar.gz linux-00db646d3fb3f5f62c2327abcf3630f4cc1075ba.tar.bz2 linux-00db646d3fb3f5f62c2327abcf3630f4cc1075ba.zip |
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>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r-- | fs/btrfs/backref.c | 6 |
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, } /* - * merge two lists of backrefs and adjust counts accordingly + * merge backrefs and adjust counts accordingly * * mode = 1: merge identical keys, if key is set * 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) ref2 = list_entry(pos2, struct __prelim_ref, list); + if (!ref_for_same_block(ref1, ref2)) + continue; if (mode == 1) { - if (!ref_for_same_block(ref1, ref2)) - continue; if (!ref1->parent && ref2->parent) { xchg = ref1; ref1 = ref2; |