Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252285
b: refs/heads/master
c: f38b6e7
h: refs/heads/master
i:
  252283: 0ce4119
v: v3
  • Loading branch information
Li Zefan committed Apr 25, 2011
1 parent c58ea9f commit 0e7358c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 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: 92c423118105e1c8c1587367a26eeb3277bda89a
refs/heads/master: f38b6e754d8cc4605ac21d9c1094d569d88b163b
20 changes: 8 additions & 12 deletions trunk/fs/btrfs/free-space-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,15 +1134,13 @@ static void bitmap_clear_bits(struct btrfs_block_group_cache *block_group,
struct btrfs_free_space *info, u64 offset,
u64 bytes)
{
unsigned long start, end;
unsigned long i;
unsigned long start, count;

start = offset_to_bit(info->offset, block_group->sectorsize, offset);
end = start + bytes_to_bits(bytes, block_group->sectorsize);
BUG_ON(end > BITS_PER_BITMAP);
count = bytes_to_bits(bytes, block_group->sectorsize);
BUG_ON(start + count > BITS_PER_BITMAP);

for (i = start; i < end; i++)
clear_bit(i, info->bitmap);
bitmap_clear(info->bitmap, start, count);

info->bytes -= bytes;
block_group->free_space -= bytes;
Expand All @@ -1152,15 +1150,13 @@ static void bitmap_set_bits(struct btrfs_block_group_cache *block_group,
struct btrfs_free_space *info, u64 offset,
u64 bytes)
{
unsigned long start, end;
unsigned long i;
unsigned long start, count;

start = offset_to_bit(info->offset, block_group->sectorsize, offset);
end = start + bytes_to_bits(bytes, block_group->sectorsize);
BUG_ON(end > BITS_PER_BITMAP);
count = bytes_to_bits(bytes, block_group->sectorsize);
BUG_ON(start + count > BITS_PER_BITMAP);

for (i = start; i < end; i++)
set_bit(i, info->bitmap);
bitmap_set(info->bitmap, start, count);

info->bytes += bytes;
block_group->free_space += bytes;
Expand Down

0 comments on commit 0e7358c

Please sign in to comment.