@@ -2290,7 +2290,7 @@ static bool use_bitmap(struct btrfs_free_space_ctl *ctl,
* of cache left then go ahead an dadd them, no sense in adding
* the overhead of a bitmap if we don't have to.
*/
- if (info->bytes <= fs_info->sectorsize * 8) {
+ if (info->bytes <= fs_info->blocksize * 8) {
if (ctl->free_extents * 3 <= ctl->extents_thresh)
return false;
} else {
@@ -2959,7 +2959,7 @@ void btrfs_init_free_space_ctl(struct btrfs_block_group *block_group,
struct btrfs_fs_info *fs_info = block_group->fs_info;
spin_lock_init(&ctl->tree_lock);
- ctl->unit = fs_info->sectorsize;
+ ctl->unit = fs_info->blocksize;
ctl->start = block_group->start;
ctl->block_group = block_group;
ctl->op = &free_space_op;
@@ -3583,10 +3583,10 @@ int btrfs_find_space_cluster(struct btrfs_block_group *block_group,
min_bytes = cont1_bytes;
} else if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) {
cont1_bytes = bytes;
- min_bytes = fs_info->sectorsize;
+ min_bytes = fs_info->blocksize;
} else {
cont1_bytes = max(bytes, (bytes + empty_size) >> 2);
- min_bytes = fs_info->sectorsize;
+ min_bytes = fs_info->blocksize;
}
spin_lock(&ctl->tree_lock);
@@ -49,7 +49,7 @@ void set_free_space_tree_thresholds(struct btrfs_block_group *cache)
* We convert to bitmaps when the disk space required for using extents
* exceeds that required for using bitmaps.
*/
- bitmap_range = cache->fs_info->sectorsize * BTRFS_FREE_SPACE_BITMAP_BITS;
+ bitmap_range = cache->fs_info->blocksize * BTRFS_FREE_SPACE_BITMAP_BITS;
num_bitmaps = div_u64(cache->length + bitmap_range - 1, bitmap_range);
bitmap_size = sizeof(struct btrfs_item) + BTRFS_FREE_SPACE_BITMAP_SIZE;
total_bitmap_size = num_bitmaps * bitmap_size;
@@ -158,7 +158,7 @@ static int btrfs_search_prev_slot(struct btrfs_trans_handle *trans,
static inline u32 free_space_bitmap_size(const struct btrfs_fs_info *fs_info,
u64 size)
{
- return DIV_ROUND_UP(size >> fs_info->sectorsize_bits, BITS_PER_BYTE);
+ return DIV_ROUND_UP(size >> fs_info->blocksize_bits, BITS_PER_BYTE);
}
static unsigned long *alloc_bitmap(u32 bitmap_size)
@@ -258,9 +258,9 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
ASSERT(found_key.objectid + found_key.offset <= end);
first = div_u64(found_key.objectid - start,
- fs_info->sectorsize);
+ fs_info->blocksize);
last = div_u64(found_key.objectid + found_key.offset - start,
- fs_info->sectorsize);
+ fs_info->blocksize);
le_bitmap_set(bitmap, first, last - first);
extent_count++;
@@ -301,7 +301,7 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
}
bitmap_cursor = (char *)bitmap;
- bitmap_range = fs_info->sectorsize * BTRFS_FREE_SPACE_BITMAP_BITS;
+ bitmap_range = fs_info->blocksize * BTRFS_FREE_SPACE_BITMAP_BITS;
i = start;
while (i < end) {
unsigned long ptr;
@@ -397,7 +397,7 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
ASSERT(found_key.objectid + found_key.offset <= end);
bitmap_pos = div_u64(found_key.objectid - start,
- fs_info->sectorsize *
+ fs_info->blocksize *
BITS_PER_BYTE);
bitmap_cursor = ((char *)bitmap) + bitmap_pos;
data_size = free_space_bitmap_size(fs_info,
@@ -433,16 +433,16 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
btrfs_mark_buffer_dirty(trans, leaf);
btrfs_release_path(path);
- nrbits = block_group->length >> block_group->fs_info->sectorsize_bits;
+ nrbits = block_group->length >> block_group->fs_info->blocksize_bits;
start_bit = find_next_bit_le(bitmap, nrbits, 0);
while (start_bit < nrbits) {
end_bit = find_next_zero_bit_le(bitmap, nrbits, start_bit);
ASSERT(start_bit < end_bit);
- key.objectid = start + start_bit * block_group->fs_info->sectorsize;
+ key.objectid = start + start_bit * block_group->fs_info->blocksize;
key.type = BTRFS_FREE_SPACE_EXTENT_KEY;
- key.offset = (end_bit - start_bit) * block_group->fs_info->sectorsize;
+ key.offset = (end_bit - start_bit) * block_group->fs_info->blocksize;
ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
if (ret)
@@ -529,7 +529,7 @@ int free_space_test_bit(struct btrfs_block_group *block_group,
ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
i = div_u64(offset - found_start,
- block_group->fs_info->sectorsize);
+ block_group->fs_info->blocksize);
return !!extent_buffer_test_bit(leaf, ptr, i);
}
@@ -558,8 +558,8 @@ static void free_space_set_bits(struct btrfs_trans_handle *trans,
end = found_end;
ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
- first = (*start - found_start) >> fs_info->sectorsize_bits;
- last = (end - found_start) >> fs_info->sectorsize_bits;
+ first = (*start - found_start) >> fs_info->blocksize_bits;
+ last = (end - found_start) >> fs_info->blocksize_bits;
if (bit)
extent_buffer_bitmap_set(leaf, ptr, first, last - first);
else
@@ -619,7 +619,7 @@ static int modify_free_space_bitmap(struct btrfs_trans_handle *trans,
* that block is within the block group.
*/
if (start > block_group->start) {
- u64 prev_block = start - block_group->fs_info->sectorsize;
+ u64 prev_block = start - block_group->fs_info->blocksize;
key.objectid = prev_block;
key.type = (u8)-1;
@@ -1544,7 +1544,7 @@ static int load_free_space_bitmaps(struct btrfs_caching_control *caching_ctl,
extent_count++;
}
prev_bit = bit;
- offset += fs_info->sectorsize;
+ offset += fs_info->blocksize;
}
}
if (prev_bit == 1) {
Straightforward rename from "sector" to "block". Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/free-space-cache.c | 8 ++++---- fs/btrfs/free-space-tree.c | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-)