diff options
author | Yan <yanzheng@21cn.com> | 2007-11-06 10:25:25 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | c549228ff63498025bf0b065c5a5909a06f21647 (patch) | |
tree | 123c5982f979af1d0fcfafce1d34ba19626302fc /fs/btrfs/extent-tree.c | |
parent | b293f02e1423f2099744f3ade23ddd83b65321fc (diff) |
Btrfs: Properly update free space cache in __free_extent
When pin_down_bytes decides not to pin a block because it was from the
current transaction, make sure the in memory cache of free extents is updated
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e7192ea8f96c..9eb2ee02f643 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -714,7 +714,7 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, | |||
714 | root->fs_info->running_transaction->transid; | 714 | root->fs_info->running_transaction->transid; |
715 | if (btrfs_header_generation(buf) == transid) { | 715 | if (btrfs_header_generation(buf) == transid) { |
716 | free_extent_buffer(buf); | 716 | free_extent_buffer(buf); |
717 | return 0; | 717 | return 1; |
718 | } | 718 | } |
719 | } | 719 | } |
720 | free_extent_buffer(buf); | 720 | free_extent_buffer(buf); |
@@ -774,7 +774,9 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root | |||
774 | 774 | ||
775 | if (pin) { | 775 | if (pin) { |
776 | ret = pin_down_bytes(root, bytenr, num_bytes, 0); | 776 | ret = pin_down_bytes(root, bytenr, num_bytes, 0); |
777 | BUG_ON(ret); | 777 | if (ret > 0) |
778 | mark_free = 1; | ||
779 | BUG_ON(ret < 0); | ||
778 | } | 780 | } |
779 | 781 | ||
780 | /* block accounting for super block */ | 782 | /* block accounting for super block */ |