diff options
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index b0d637787264..5b1f90f06e03 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -496,7 +496,10 @@ next_slot: | |||
496 | sizeof(old)); | 496 | sizeof(old)); |
497 | if (disk_bytenr != 0) { | 497 | if (disk_bytenr != 0) { |
498 | ret = btrfs_inc_extent_ref(trans, root, | 498 | ret = btrfs_inc_extent_ref(trans, root, |
499 | disk_bytenr, disk_num_bytes); | 499 | disk_bytenr, disk_num_bytes, |
500 | root->root_key.objectid, | ||
501 | trans->transid, | ||
502 | key.objectid, end); | ||
500 | BUG_ON(ret); | 503 | BUG_ON(ret); |
501 | } | 504 | } |
502 | } | 505 | } |
@@ -541,6 +544,14 @@ next_slot: | |||
541 | u64 disk_bytenr = 0; | 544 | u64 disk_bytenr = 0; |
542 | u64 disk_num_bytes = 0; | 545 | u64 disk_num_bytes = 0; |
543 | u64 extent_num_bytes = 0; | 546 | u64 extent_num_bytes = 0; |
547 | u64 root_gen; | ||
548 | |||
549 | if (leaf != root->node) { | ||
550 | root_gen = | ||
551 | btrfs_header_generation(path->nodes[1]); | ||
552 | } else { | ||
553 | root_gen = btrfs_header_generation(leaf); | ||
554 | } | ||
544 | if (found_extent) { | 555 | if (found_extent) { |
545 | disk_bytenr = | 556 | disk_bytenr = |
546 | btrfs_file_extent_disk_bytenr(leaf, | 557 | btrfs_file_extent_disk_bytenr(leaf, |
@@ -562,8 +573,11 @@ next_slot: | |||
562 | if (found_extent && disk_bytenr != 0) { | 573 | if (found_extent && disk_bytenr != 0) { |
563 | inode->i_blocks -= extent_num_bytes >> 9; | 574 | inode->i_blocks -= extent_num_bytes >> 9; |
564 | ret = btrfs_free_extent(trans, root, | 575 | ret = btrfs_free_extent(trans, root, |
565 | disk_bytenr, | 576 | disk_bytenr, |
566 | disk_num_bytes, 0); | 577 | disk_num_bytes, |
578 | root->root_key.objectid, | ||
579 | root_gen, inode->i_ino, | ||
580 | key.offset, 0); | ||
567 | } | 581 | } |
568 | 582 | ||
569 | BUG_ON(ret); | 583 | BUG_ON(ret); |