mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 09:41:03 +02:00
btrfs: use correct type for sectorsize/nodesize/blocksize
The nodesize and sectorsize are all u32 values, there is no need to use u64 for local usage. Furthermore some call sites also use "blocksize" or "bs" for sectorsize, also change them to use the minimal type u32 instead. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
bd3dddec1b
commit
f1df52e323
|
|
@ -2395,8 +2395,8 @@ static int validate_sys_chunk_array(const struct btrfs_fs_info *fs_info,
|
|||
int btrfs_validate_super(const struct btrfs_fs_info *fs_info,
|
||||
const struct btrfs_super_block *sb, int mirror_num)
|
||||
{
|
||||
u64 nodesize = btrfs_super_nodesize(sb);
|
||||
u64 sectorsize = btrfs_super_sectorsize(sb);
|
||||
const u32 nodesize = btrfs_super_nodesize(sb);
|
||||
const u32 sectorsize = btrfs_super_sectorsize(sb);
|
||||
int ret = 0;
|
||||
const bool ignore_flags = btrfs_test_opt(fs_info, IGNORESUPERFLAGS);
|
||||
|
||||
|
|
@ -2438,24 +2438,24 @@ int btrfs_validate_super(const struct btrfs_fs_info *fs_info,
|
|||
*/
|
||||
if (unlikely(!is_power_of_2(sectorsize) || sectorsize < BTRFS_MIN_BLOCKSIZE ||
|
||||
sectorsize > BTRFS_MAX_METADATA_BLOCKSIZE)) {
|
||||
btrfs_err(fs_info, "invalid sectorsize %llu", sectorsize);
|
||||
btrfs_err(fs_info, "invalid sectorsize %u", sectorsize);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
if (unlikely(!btrfs_supported_blocksize(sectorsize))) {
|
||||
btrfs_err(fs_info,
|
||||
"sectorsize %llu not yet supported for page size %lu",
|
||||
"sectorsize %u not yet supported for page size %lu",
|
||||
sectorsize, PAGE_SIZE);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
if (unlikely(!is_power_of_2(nodesize) || nodesize < sectorsize ||
|
||||
nodesize > BTRFS_MAX_METADATA_BLOCKSIZE)) {
|
||||
btrfs_err(fs_info, "invalid nodesize %llu", nodesize);
|
||||
btrfs_err(fs_info, "invalid nodesize %u", nodesize);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
if (unlikely(nodesize != le32_to_cpu(sb->__unused_leafsize))) {
|
||||
btrfs_err(fs_info, "invalid leafsize %u, should be %llu",
|
||||
btrfs_err(fs_info, "invalid leafsize %u, should be %u",
|
||||
le32_to_cpu(sb->__unused_leafsize), nodesize);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ static int extent_fiemap(struct btrfs_inode *inode,
|
|||
u64 prev_extent_end;
|
||||
u64 range_start;
|
||||
u64 range_end;
|
||||
const u64 sectorsize = inode->root->fs_info->sectorsize;
|
||||
const u32 sectorsize = inode->root->fs_info->sectorsize;
|
||||
bool stopped = false;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -2888,7 +2888,7 @@ enum {
|
|||
static int btrfs_zero_range_check_range_boundary(struct btrfs_inode *inode,
|
||||
u64 offset)
|
||||
{
|
||||
const u64 sectorsize = inode->root->fs_info->sectorsize;
|
||||
const u32 sectorsize = inode->root->fs_info->sectorsize;
|
||||
struct extent_map *em;
|
||||
int ret;
|
||||
|
||||
|
|
@ -2918,7 +2918,7 @@ static int btrfs_zero_range(struct inode *inode,
|
|||
struct extent_changeset *data_reserved = NULL;
|
||||
int ret;
|
||||
u64 alloc_hint = 0;
|
||||
const u64 sectorsize = fs_info->sectorsize;
|
||||
const u32 sectorsize = fs_info->sectorsize;
|
||||
const u64 orig_start = offset;
|
||||
const u64 orig_end = offset + len - 1;
|
||||
u64 alloc_start = round_down(offset, sectorsize);
|
||||
|
|
|
|||
|
|
@ -860,7 +860,7 @@ static void compress_file_range(struct btrfs_work *work)
|
|||
struct btrfs_inode *inode = async_chunk->inode;
|
||||
struct btrfs_fs_info *fs_info = inode->root->fs_info;
|
||||
struct compressed_bio *cb = NULL;
|
||||
u64 blocksize = fs_info->sectorsize;
|
||||
const u32 blocksize = fs_info->sectorsize;
|
||||
u64 start = async_chunk->start;
|
||||
u64 end = async_chunk->end;
|
||||
u64 actual_end;
|
||||
|
|
@ -3039,7 +3039,7 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
|
|||
u64 qgroup_reserved)
|
||||
{
|
||||
struct btrfs_root *root = inode->root;
|
||||
const u64 sectorsize = root->fs_info->sectorsize;
|
||||
const u32 sectorsize = root->fs_info->sectorsize;
|
||||
BTRFS_PATH_AUTO_FREE(path);
|
||||
struct extent_buffer *leaf;
|
||||
struct btrfs_key ins;
|
||||
|
|
|
|||
|
|
@ -691,7 +691,7 @@ static int btrfs_extent_same_range(struct btrfs_inode *src, u64 loff, u64 len,
|
|||
const u64 end = dst_loff + len - 1;
|
||||
struct extent_state *cached_state = NULL;
|
||||
struct btrfs_fs_info *fs_info = src->root->fs_info;
|
||||
const u64 bs = fs_info->sectorsize;
|
||||
const u32 bs = fs_info->sectorsize;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
|
|
@ -762,7 +762,7 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
|
|||
struct btrfs_fs_info *fs_info = inode_to_fs_info(inode);
|
||||
int ret;
|
||||
u64 len = olen;
|
||||
u64 bs = fs_info->sectorsize;
|
||||
const u32 bs = fs_info->sectorsize;
|
||||
u64 end;
|
||||
|
||||
/*
|
||||
|
|
@ -841,7 +841,7 @@ static int btrfs_remap_file_range_prep(struct file *file_in, loff_t pos_in,
|
|||
{
|
||||
struct btrfs_inode *inode_in = BTRFS_I(file_inode(file_in));
|
||||
struct btrfs_inode *inode_out = BTRFS_I(file_inode(file_out));
|
||||
u64 bs = inode_out->root->fs_info->sectorsize;
|
||||
const u32 bs = inode_out->root->fs_info->sectorsize;
|
||||
u64 wb_len;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -6032,7 +6032,7 @@ static int send_write_or_clone(struct send_ctx *sctx,
|
|||
int ret = 0;
|
||||
u64 offset = key->offset;
|
||||
u64 end;
|
||||
u64 bs = sctx->send_root->fs_info->sectorsize;
|
||||
const u32 bs = sctx->send_root->fs_info->sectorsize;
|
||||
struct btrfs_file_extent_item *ei;
|
||||
u64 disk_byte;
|
||||
u64 data_offset;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user