From 587074e50389e226cfb8821b4b7e2d2774f0ec6f Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Mon, 16 Dec 2024 15:16:16 +1030 Subject: [PATCH] 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 --- cmds/rescue-chunk-recover.c | 4 ++-- convert/common.c | 2 +- image/image-restore.c | 8 ++++---- kernel-shared/accessors.h | 4 ++-- kernel-shared/disk-io.c | 12 ++++++------ kernel-shared/print-tree.c | 4 ++-- kernel-shared/uapi/btrfs_tree.h | 4 ++-- mkfs/common.c | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cmds/rescue-chunk-recover.c b/cmds/rescue-chunk-recover.c index 8bbf5b6d..d767915c 100644 --- a/cmds/rescue-chunk-recover.c +++ b/cmds/rescue-chunk-recover.c @@ -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); diff --git a/convert/common.c b/convert/common.c index e7bd0309..da939a79 100644 --- a/convert/common.c +++ b/convert/common.c @@ -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); diff --git a/image/image-restore.c b/image/image-restore.c index 667b9811..9ab709b8 100644 --- a/image/image-restore.c +++ b/image/image-restore.c @@ -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; diff --git a/kernel-shared/accessors.h b/kernel-shared/accessors.h index c88041c7..94c09b1c 100644 --- a/kernel-shared/accessors.h +++ b/kernel-shared/accessors.h @@ -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, diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c index c6189697..d42ebc51 100644 --- a/kernel-shared/disk-io.c +++ b/kernel-shared/disk-io.c @@ -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; } diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c index 09130e97..c1b107d2 100644 --- a/kernel-shared/print-tree.c +++ b/kernel-shared/print-tree.c @@ -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", diff --git a/kernel-shared/uapi/btrfs_tree.h b/kernel-shared/uapi/btrfs_tree.h index 5720a03c..a0388473 100644 --- a/kernel-shared/uapi/btrfs_tree.h +++ b/kernel-shared/uapi/btrfs_tree.h @@ -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; diff --git a/mkfs/common.c b/mkfs/common.c index 10da578d..ddcb69ca 100644 --- a/mkfs/common.c +++ b/mkfs/common.c @@ -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);