diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/backref.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index a3219523ebc9..04edf69be875 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -461,6 +461,7 @@ static int __merge_refs(struct list_head *head, int mode) | |||
461 | pos2 = n2, n2 = pos2->next) { | 461 | pos2 = n2, n2 = pos2->next) { |
462 | struct __prelim_ref *ref2; | 462 | struct __prelim_ref *ref2; |
463 | struct __prelim_ref *xchg; | 463 | struct __prelim_ref *xchg; |
464 | struct extent_inode_elem *eie; | ||
464 | 465 | ||
465 | ref2 = list_entry(pos2, struct __prelim_ref, list); | 466 | ref2 = list_entry(pos2, struct __prelim_ref, list); |
466 | 467 | ||
@@ -472,12 +473,20 @@ static int __merge_refs(struct list_head *head, int mode) | |||
472 | ref1 = ref2; | 473 | ref1 = ref2; |
473 | ref2 = xchg; | 474 | ref2 = xchg; |
474 | } | 475 | } |
475 | ref1->count += ref2->count; | ||
476 | } else { | 476 | } else { |
477 | if (ref1->parent != ref2->parent) | 477 | if (ref1->parent != ref2->parent) |
478 | continue; | 478 | continue; |
479 | ref1->count += ref2->count; | ||
480 | } | 479 | } |
480 | |||
481 | eie = ref1->inode_list; | ||
482 | while (eie && eie->next) | ||
483 | eie = eie->next; | ||
484 | if (eie) | ||
485 | eie->next = ref2->inode_list; | ||
486 | else | ||
487 | ref1->inode_list = ref2->inode_list; | ||
488 | ref1->count += ref2->count; | ||
489 | |||
481 | list_del(&ref2->list); | 490 | list_del(&ref2->list); |
482 | kfree(ref2); | 491 | kfree(ref2); |
483 | } | 492 | } |