Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232980
b: refs/heads/master
c: edf6e2d
h: refs/heads/master
v: v3
  • Loading branch information
Li Zefan committed Jan 26, 2011
1 parent a8fbbdb commit c3d1980
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8eb2d829ffea3677c21bd038f19e5d8ca6b43e36
refs/heads/master: edf6e2d1ddbac7f326b34a27adbca71ece53ccce
37 changes: 16 additions & 21 deletions trunk/fs/btrfs/free-space-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,16 @@ static void add_new_bitmap(struct btrfs_block_group_cache *block_group,
recalculate_thresholds(block_group);
}

static void free_bitmap(struct btrfs_block_group_cache *block_group,
struct btrfs_free_space *bitmap_info)
{
unlink_free_space(block_group, bitmap_info);
kfree(bitmap_info->bitmap);
kfree(bitmap_info);
block_group->total_bitmaps--;
recalculate_thresholds(block_group);
}

static noinline int remove_from_bitmap(struct btrfs_block_group_cache *block_group,
struct btrfs_free_space *bitmap_info,
u64 *offset, u64 *bytes)
Expand Down Expand Up @@ -1215,13 +1225,8 @@ static noinline int remove_from_bitmap(struct btrfs_block_group_cache *block_gro

if (*bytes) {
struct rb_node *next = rb_next(&bitmap_info->offset_index);
if (!bitmap_info->bytes) {
unlink_free_space(block_group, bitmap_info);
kfree(bitmap_info->bitmap);
kfree(bitmap_info);
block_group->total_bitmaps--;
recalculate_thresholds(block_group);
}
if (!bitmap_info->bytes)
free_bitmap(block_group, bitmap_info);

/*
* no entry after this bitmap, but we still have bytes to
Expand Down Expand Up @@ -1254,13 +1259,8 @@ static noinline int remove_from_bitmap(struct btrfs_block_group_cache *block_gro
return -EAGAIN;

goto again;
} else if (!bitmap_info->bytes) {
unlink_free_space(block_group, bitmap_info);
kfree(bitmap_info->bitmap);
kfree(bitmap_info);
block_group->total_bitmaps--;
recalculate_thresholds(block_group);
}
} else if (!bitmap_info->bytes)
free_bitmap(block_group, bitmap_info);

return 0;
}
Expand Down Expand Up @@ -1689,13 +1689,8 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group_cache *block_group,
ret = offset;
if (entry->bitmap) {
bitmap_clear_bits(block_group, entry, offset, bytes);
if (!entry->bytes) {
unlink_free_space(block_group, entry);
kfree(entry->bitmap);
kfree(entry);
block_group->total_bitmaps--;
recalculate_thresholds(block_group);
}
if (!entry->bytes)
free_bitmap(block_group, entry);
} else {
unlink_free_space(block_group, entry);
entry->offset += bytes;
Expand Down

0 comments on commit c3d1980

Please sign in to comment.