diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2011-03-14 01:40:51 -0400 |
---|---|---|
committer | Li Zefan <lizf@cn.fujitsu.com> | 2011-04-25 04:46:01 -0400 |
commit | f38b6e754d8cc4605ac21d9c1094d569d88b163b (patch) | |
tree | 7aec7cc9a9d68f1e7ce97771500c63151a1b2319 /fs/btrfs/free-space-cache.c | |
parent | 92c423118105e1c8c1587367a26eeb3277bda89a (diff) |
Btrfs: Use bitmap_set/clear()
No functional change.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 3af64c6ea9df..0e23bbabbba2 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -1134,15 +1134,13 @@ static void bitmap_clear_bits(struct btrfs_block_group_cache *block_group, | |||
1134 | struct btrfs_free_space *info, u64 offset, | 1134 | struct btrfs_free_space *info, u64 offset, |
1135 | u64 bytes) | 1135 | u64 bytes) |
1136 | { | 1136 | { |
1137 | unsigned long start, end; | 1137 | unsigned long start, count; |
1138 | unsigned long i; | ||
1139 | 1138 | ||
1140 | start = offset_to_bit(info->offset, block_group->sectorsize, offset); | 1139 | start = offset_to_bit(info->offset, block_group->sectorsize, offset); |
1141 | end = start + bytes_to_bits(bytes, block_group->sectorsize); | 1140 | count = bytes_to_bits(bytes, block_group->sectorsize); |
1142 | BUG_ON(end > BITS_PER_BITMAP); | 1141 | BUG_ON(start + count > BITS_PER_BITMAP); |
1143 | 1142 | ||
1144 | for (i = start; i < end; i++) | 1143 | bitmap_clear(info->bitmap, start, count); |
1145 | clear_bit(i, info->bitmap); | ||
1146 | 1144 | ||
1147 | info->bytes -= bytes; | 1145 | info->bytes -= bytes; |
1148 | block_group->free_space -= bytes; | 1146 | block_group->free_space -= bytes; |
@@ -1152,15 +1150,13 @@ static void bitmap_set_bits(struct btrfs_block_group_cache *block_group, | |||
1152 | struct btrfs_free_space *info, u64 offset, | 1150 | struct btrfs_free_space *info, u64 offset, |
1153 | u64 bytes) | 1151 | u64 bytes) |
1154 | { | 1152 | { |
1155 | unsigned long start, end; | 1153 | unsigned long start, count; |
1156 | unsigned long i; | ||
1157 | 1154 | ||
1158 | start = offset_to_bit(info->offset, block_group->sectorsize, offset); | 1155 | start = offset_to_bit(info->offset, block_group->sectorsize, offset); |
1159 | end = start + bytes_to_bits(bytes, block_group->sectorsize); | 1156 | count = bytes_to_bits(bytes, block_group->sectorsize); |
1160 | BUG_ON(end > BITS_PER_BITMAP); | 1157 | BUG_ON(start + count > BITS_PER_BITMAP); |
1161 | 1158 | ||
1162 | for (i = start; i < end; i++) | 1159 | bitmap_set(info->bitmap, start, count); |
1163 | set_bit(i, info->bitmap); | ||
1164 | 1160 | ||
1165 | info->bytes += bytes; | 1161 | info->bytes += bytes; |
1166 | block_group->free_space += bytes; | 1162 | block_group->free_space += bytes; |