diff options
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
-rw-r--r-- | fs/btrfs/delayed-ref.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 759fa247ced8..cbf7dc8ae3ec 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c | |||
@@ -450,8 +450,12 @@ static noinline int __btrfs_add_delayed_ref(struct btrfs_trans_handle *trans, | |||
450 | * the head node stores the sum of all the mods, so dropping a ref | 450 | * the head node stores the sum of all the mods, so dropping a ref |
451 | * should drop the sum in the head node by one. | 451 | * should drop the sum in the head node by one. |
452 | */ | 452 | */ |
453 | if (parent == (u64)-1 && action == BTRFS_DROP_DELAYED_REF) | 453 | if (parent == (u64)-1) { |
454 | count_mod = -1; | 454 | if (action == BTRFS_DROP_DELAYED_REF) |
455 | count_mod = -1; | ||
456 | else if (action == BTRFS_UPDATE_DELAYED_HEAD) | ||
457 | count_mod = 0; | ||
458 | } | ||
455 | 459 | ||
456 | /* | 460 | /* |
457 | * BTRFS_ADD_DELAYED_EXTENT means that we need to update | 461 | * BTRFS_ADD_DELAYED_EXTENT means that we need to update |
@@ -647,7 +651,7 @@ int btrfs_update_delayed_ref(struct btrfs_trans_handle *trans, | |||
647 | */ | 651 | */ |
648 | ret = __btrfs_add_delayed_ref(trans, &head_ref->node, bytenr, num_bytes, | 652 | ret = __btrfs_add_delayed_ref(trans, &head_ref->node, bytenr, num_bytes, |
649 | (u64)-1, 0, 0, 0, | 653 | (u64)-1, 0, 0, 0, |
650 | BTRFS_ADD_DELAYED_REF, 0); | 654 | BTRFS_UPDATE_DELAYED_HEAD, 0); |
651 | BUG_ON(ret); | 655 | BUG_ON(ret); |
652 | 656 | ||
653 | ret = __btrfs_add_delayed_ref(trans, &ref->node, bytenr, num_bytes, | 657 | ret = __btrfs_add_delayed_ref(trans, &ref->node, bytenr, num_bytes, |