Btrfs: Use bitmap_set/clear()
No functional change. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
This commit is contained in:
parent
92c4231181
commit
f38b6e754d
@ -1134,15 +1134,13 @@ static void bitmap_clear_bits(struct btrfs_block_group_cache *block_group,
|
|||||||
struct btrfs_free_space *info, u64 offset,
|
struct btrfs_free_space *info, u64 offset,
|
||||||
u64 bytes)
|
u64 bytes)
|
||||||
{
|
{
|
||||||
unsigned long start, end;
|
unsigned long start, count;
|
||||||
unsigned long i;
|
|
||||||
|
|
||||||
start = offset_to_bit(info->offset, block_group->sectorsize, offset);
|
start = offset_to_bit(info->offset, block_group->sectorsize, offset);
|
||||||
end = start + bytes_to_bits(bytes, block_group->sectorsize);
|
count = bytes_to_bits(bytes, block_group->sectorsize);
|
||||||
BUG_ON(end > BITS_PER_BITMAP);
|
BUG_ON(start + count > BITS_PER_BITMAP);
|
||||||
|
|
||||||
for (i = start; i < end; i++)
|
bitmap_clear(info->bitmap, start, count);
|
||||||
clear_bit(i, info->bitmap);
|
|
||||||
|
|
||||||
info->bytes -= bytes;
|
info->bytes -= bytes;
|
||||||
block_group->free_space -= bytes;
|
block_group->free_space -= bytes;
|
||||||
@ -1152,15 +1150,13 @@ static void bitmap_set_bits(struct btrfs_block_group_cache *block_group,
|
|||||||
struct btrfs_free_space *info, u64 offset,
|
struct btrfs_free_space *info, u64 offset,
|
||||||
u64 bytes)
|
u64 bytes)
|
||||||
{
|
{
|
||||||
unsigned long start, end;
|
unsigned long start, count;
|
||||||
unsigned long i;
|
|
||||||
|
|
||||||
start = offset_to_bit(info->offset, block_group->sectorsize, offset);
|
start = offset_to_bit(info->offset, block_group->sectorsize, offset);
|
||||||
end = start + bytes_to_bits(bytes, block_group->sectorsize);
|
count = bytes_to_bits(bytes, block_group->sectorsize);
|
||||||
BUG_ON(end > BITS_PER_BITMAP);
|
BUG_ON(start + count > BITS_PER_BITMAP);
|
||||||
|
|
||||||
for (i = start; i < end; i++)
|
bitmap_set(info->bitmap, start, count);
|
||||||
set_bit(i, info->bitmap);
|
|
||||||
|
|
||||||
info->bytes += bytes;
|
info->bytes += bytes;
|
||||||
block_group->free_space += bytes;
|
block_group->free_space += bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user