btrfs-progs: rename btrfs_super_block::sectorsize to blocksize

This on-disk format rename is to keep the terminology aligned to other
filesystems.

Signed-off-by: Qu Wenruo <wqu@suse.com>
This commit is contained in:
Qu Wenruo 2024-12-16 15:16:16 +10:30
parent 6582516156
commit 587074e503
8 changed files with 20 additions and 20 deletions

View File

@ -1471,7 +1471,7 @@ open_ctree_with_broken_chunk(struct recover_control *rc)
}
UASSERT(!memcmp(disk_super->fsid, rc->fs_devices->fsid, BTRFS_FSID_SIZE));
fs_info->blocksize = btrfs_super_sectorsize(disk_super);
fs_info->blocksize = btrfs_super_blocksize(disk_super);
fs_info->nodesize = btrfs_super_nodesize(disk_super);
fs_info->stripesize = btrfs_super_stripesize(disk_super);
@ -1535,7 +1535,7 @@ static int recover_prepare(struct recover_control *rc, const char *path)
goto out_close_fd;
}
rc->blocksize = btrfs_super_sectorsize(&sb);
rc->blocksize = btrfs_super_blocksize(&sb);
rc->nodesize = btrfs_super_nodesize(&sb);
rc->generation = btrfs_super_generation(&sb);
rc->chunk_root_generation = btrfs_super_chunk_root_generation(&sb);

View File

@ -143,7 +143,7 @@ static int setup_temp_super(int fd, struct btrfs_mkfs_config *cfg,
* and csum tree.
*/
btrfs_set_super_bytes_used(&super, 6 * cfg->nodesize);
btrfs_set_super_sectorsize(&super, cfg->blocksize);
btrfs_set_super_blocksize(&super, cfg->blocksize);
super.__unused_leafsize = cpu_to_le32(cfg->nodesize);
btrfs_set_super_nodesize(&super, cfg->nodesize);
btrfs_set_super_stripesize(&super, cfg->stripesize);

View File

@ -365,7 +365,7 @@ static void update_super_old(u8 *buffer)
struct btrfs_super_block *super = (struct btrfs_super_block *)buffer;
struct btrfs_chunk *chunk;
struct btrfs_disk_key *key;
u32 sectorsize = btrfs_super_sectorsize(super);
u32 blocksize = btrfs_super_blocksize(super);
u64 flags = btrfs_super_flags(super);
if (current_version->extra_sb_flags)
@ -384,9 +384,9 @@ static void update_super_old(u8 *buffer)
btrfs_set_stack_chunk_owner(chunk, BTRFS_EXTENT_TREE_OBJECTID);
btrfs_set_stack_chunk_stripe_len(chunk, BTRFS_STRIPE_LEN);
btrfs_set_stack_chunk_type(chunk, BTRFS_BLOCK_GROUP_SYSTEM);
btrfs_set_stack_chunk_io_align(chunk, sectorsize);
btrfs_set_stack_chunk_io_width(chunk, sectorsize);
btrfs_set_stack_chunk_sector_size(chunk, sectorsize);
btrfs_set_stack_chunk_io_align(chunk, blocksize);
btrfs_set_stack_chunk_io_width(chunk, blocksize);
btrfs_set_stack_chunk_sector_size(chunk, blocksize);
btrfs_set_stack_chunk_num_stripes(chunk, 1);
btrfs_set_stack_chunk_sub_stripes(chunk, 0);
chunk->stripe.devid = super->dev_item.devid;

View File

@ -946,8 +946,8 @@ BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block,
total_bytes, 64);
BTRFS_SETGET_STACK_FUNCS(super_bytes_used, struct btrfs_super_block,
bytes_used, 64);
BTRFS_SETGET_STACK_FUNCS(super_sectorsize, struct btrfs_super_block,
sectorsize, 32);
BTRFS_SETGET_STACK_FUNCS(super_blocksize, struct btrfs_super_block,
blocksize, 32);
BTRFS_SETGET_STACK_FUNCS(super_nodesize, struct btrfs_super_block,
nodesize, 32);
BTRFS_SETGET_STACK_FUNCS(super_stripesize, struct btrfs_super_block,

View File

@ -1587,7 +1587,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_args *oca
ASSERT(!memcmp(disk_super->metadata_uuid,
fs_devices->metadata_uuid, BTRFS_FSID_SIZE));
fs_info->blocksize = btrfs_super_sectorsize(disk_super);
fs_info->blocksize = btrfs_super_blocksize(disk_super);
fs_info->nodesize = btrfs_super_nodesize(disk_super);
fs_info->stripesize = btrfs_super_stripesize(disk_super);
fs_info->csum_type = btrfs_super_csum_type(disk_super);
@ -1816,13 +1816,13 @@ int btrfs_check_super(struct btrfs_super_block *sb, unsigned sbflags)
error("nodesize unaligned: %u", btrfs_super_nodesize(sb));
goto error_out;
}
if (btrfs_super_sectorsize(sb) < 4096) {
if (btrfs_super_blocksize(sb) < 4096) {
error("blocksize too small: %u < 4096",
btrfs_super_sectorsize(sb));
btrfs_super_blocksize(sb));
goto error_out;
}
if (!IS_ALIGNED(btrfs_super_sectorsize(sb), 4096)) {
error("blocksize unaligned: %u", btrfs_super_sectorsize(sb));
if (!IS_ALIGNED(btrfs_super_blocksize(sb), 4096)) {
error("blocksize unaligned: %u", btrfs_super_blocksize(sb));
goto error_out;
}
if (btrfs_super_total_bytes(sb) == 0) {
@ -1834,7 +1834,7 @@ int btrfs_check_super(struct btrfs_super_block *sb, unsigned sbflags)
goto error_out;
}
if ((btrfs_super_stripesize(sb) != 4096)
&& (btrfs_super_stripesize(sb) != btrfs_super_sectorsize(sb))) {
&& (btrfs_super_stripesize(sb) != btrfs_super_blocksize(sb))) {
error("invalid stripesize %u", btrfs_super_stripesize(sb));
goto error_out;
}

View File

@ -2259,8 +2259,8 @@ void btrfs_print_superblock(struct btrfs_super_block *sb, int full)
(unsigned long long)btrfs_super_total_bytes(sb));
printf("bytes_used\t\t%llu\n",
(unsigned long long)btrfs_super_bytes_used(sb));
printf("sectorsize\t\t%llu\n",
(unsigned long long)btrfs_super_sectorsize(sb));
printf("blocksize\t\t%llu\n",
(unsigned long long)btrfs_super_blocksize(sb));
printf("nodesize\t\t%llu\n",
(unsigned long long)btrfs_super_nodesize(sb));
printf("leafsize (deprecated)\t%u\n",

View File

@ -256,7 +256,7 @@
* When a block group becomes very fragmented, we convert it to use bitmaps
* instead of extents. A free space bitmap is keyed on
* (start, FREE_SPACE_BITMAP, length); the corresponding item is a bitmap with
* (length / sectorsize) bits.
* (length / blocksize) bits.
*/
#define BTRFS_FREE_SPACE_BITMAP_KEY 200
@ -672,7 +672,7 @@ struct btrfs_super_block {
__le64 bytes_used;
__le64 root_dir_objectid;
__le64 num_devices;
__le32 sectorsize;
__le32 blocksize;
__le32 nodesize;
__le32 __unused_leafsize;
__le32 stripesize;

View File

@ -458,7 +458,7 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
btrfs_set_super_chunk_root(&super, cfg->blocks[MKFS_CHUNK_TREE]);
btrfs_set_super_total_bytes(&super, num_bytes);
btrfs_set_super_bytes_used(&super, total_used);
btrfs_set_super_sectorsize(&super, cfg->blocksize);
btrfs_set_super_blocksize(&super, cfg->blocksize);
super.__unused_leafsize = cpu_to_le32(cfg->nodesize);
btrfs_set_super_nodesize(&super, cfg->nodesize);
btrfs_set_super_stripesize(&super, cfg->stripesize);