mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
btrfs: constify arguments of some functions
There are several functions that take pointer arguments but don't need to modify the objects they point to, so add the const qualifiers. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
1fce8eec9f
commit
1899d9b09d
+3
-3
@@ -728,7 +728,7 @@ void btrfs_global_root_delete(struct btrfs_root *root)
|
||||
}
|
||||
|
||||
struct btrfs_root *btrfs_global_root(struct btrfs_fs_info *fs_info,
|
||||
struct btrfs_key *key)
|
||||
const struct btrfs_key *key)
|
||||
{
|
||||
struct rb_node *node;
|
||||
struct btrfs_root *root = NULL;
|
||||
@@ -765,7 +765,7 @@ static u64 btrfs_global_root_id(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||
|
||||
struct btrfs_root *btrfs_csum_root(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||
{
|
||||
struct btrfs_key key = {
|
||||
const struct btrfs_key key = {
|
||||
.objectid = BTRFS_CSUM_TREE_OBJECTID,
|
||||
.type = BTRFS_ROOT_ITEM_KEY,
|
||||
.offset = btrfs_global_root_id(fs_info, bytenr),
|
||||
@@ -776,7 +776,7 @@ struct btrfs_root *btrfs_csum_root(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||
|
||||
struct btrfs_root *btrfs_extent_root(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||
{
|
||||
struct btrfs_key key = {
|
||||
const struct btrfs_key key = {
|
||||
.objectid = BTRFS_EXTENT_TREE_OBJECTID,
|
||||
.type = BTRFS_ROOT_ITEM_KEY,
|
||||
.offset = btrfs_global_root_id(fs_info, bytenr),
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ struct btrfs_root *btrfs_get_fs_root_commit_root(struct btrfs_fs_info *fs_info,
|
||||
int btrfs_global_root_insert(struct btrfs_root *root);
|
||||
void btrfs_global_root_delete(struct btrfs_root *root);
|
||||
struct btrfs_root *btrfs_global_root(struct btrfs_fs_info *fs_info,
|
||||
struct btrfs_key *key);
|
||||
const struct btrfs_key *key);
|
||||
struct btrfs_root *btrfs_csum_root(struct btrfs_fs_info *fs_info, u64 bytenr);
|
||||
struct btrfs_root *btrfs_extent_root(struct btrfs_fs_info *fs_info, u64 bytenr);
|
||||
|
||||
|
||||
+2
-2
@@ -966,13 +966,13 @@ struct btrfs_fs_info {
|
||||
#define inode_to_fs_info(_inode) (BTRFS_I(_Generic((_inode), \
|
||||
struct inode *: (_inode)))->root->fs_info)
|
||||
|
||||
static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
|
||||
static inline gfp_t btrfs_alloc_write_mask(const struct address_space *mapping)
|
||||
{
|
||||
return mapping_gfp_constraint(mapping, ~__GFP_FS);
|
||||
}
|
||||
|
||||
/* Return the minimal folio size of the fs. */
|
||||
static inline unsigned int btrfs_min_folio_size(struct btrfs_fs_info *fs_info)
|
||||
static inline unsigned int btrfs_min_folio_size(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
return 1U << (PAGE_SHIFT + fs_info->block_min_order);
|
||||
}
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@
|
||||
name = (1U << __ ## name ## _BIT), \
|
||||
__ ## name ## _SEQ = __ ## name ## _BIT
|
||||
|
||||
static inline phys_addr_t bio_iter_phys(struct bio *bio, struct bvec_iter *iter)
|
||||
static inline phys_addr_t bio_iter_phys(const struct bio *bio,
|
||||
const struct bvec_iter *iter)
|
||||
{
|
||||
struct bio_vec bv = bio_iter_iovec(bio, *iter);
|
||||
|
||||
|
||||
@@ -412,10 +412,10 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
|
||||
up_write(&space_info->groups_sem);
|
||||
}
|
||||
|
||||
struct btrfs_space_info *btrfs_find_space_info(struct btrfs_fs_info *info,
|
||||
struct btrfs_space_info *btrfs_find_space_info(const struct btrfs_fs_info *info,
|
||||
u64 flags)
|
||||
{
|
||||
struct list_head *head = &info->space_info;
|
||||
const struct list_head *head = &info->space_info;
|
||||
struct btrfs_space_info *found;
|
||||
|
||||
flags &= BTRFS_BLOCK_GROUP_TYPE_MASK;
|
||||
@@ -427,7 +427,7 @@ struct btrfs_space_info *btrfs_find_space_info(struct btrfs_fs_info *info,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static u64 calc_effective_data_chunk_size(struct btrfs_fs_info *fs_info)
|
||||
static u64 calc_effective_data_chunk_size(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
struct btrfs_space_info *data_sinfo;
|
||||
u64 data_chunk_size;
|
||||
|
||||
@@ -292,7 +292,7 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info,
|
||||
struct btrfs_block_group *block_group);
|
||||
void btrfs_update_space_info_chunk_size(struct btrfs_space_info *space_info,
|
||||
u64 chunk_size);
|
||||
struct btrfs_space_info *btrfs_find_space_info(struct btrfs_fs_info *info,
|
||||
struct btrfs_space_info *btrfs_find_space_info(const struct btrfs_fs_info *info,
|
||||
u64 flags);
|
||||
void btrfs_clear_space_info_full(struct btrfs_fs_info *info);
|
||||
void btrfs_dump_space_info(struct btrfs_space_info *info, u64 bytes,
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
|
||||
u64 subvol_objectid);
|
||||
void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info);
|
||||
|
||||
static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
|
||||
static inline struct btrfs_fs_info *btrfs_sb(const struct super_block *sb)
|
||||
{
|
||||
return sb->s_fs_info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user