mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 07:44:21 +08:00
btrfs: constify pointer parameters where applicable
We can add const to many parameters, this is for clarity and minor addition to safety. There are some minor effects, in the assembly code and .ko measured on release config. This patch does not cover all possible conversions. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c27b1dbb71
commit
2917f74102
@ -413,12 +413,12 @@ static inline void btrfs_i_size_write(struct btrfs_inode *inode, u64 size)
|
|||||||
inode->disk_i_size = size;
|
inode->disk_i_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
|
static inline bool btrfs_is_free_space_inode(const struct btrfs_inode *inode)
|
||||||
{
|
{
|
||||||
return test_bit(BTRFS_INODE_FREE_SPACE_INODE, &inode->runtime_flags);
|
return test_bit(BTRFS_INODE_FREE_SPACE_INODE, &inode->runtime_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_data_inode(struct inode *inode)
|
static inline bool is_data_inode(const struct inode *inode)
|
||||||
{
|
{
|
||||||
return btrfs_ino(BTRFS_I(inode)) != BTRFS_BTREE_INODE_OBJECTID;
|
return btrfs_ino(BTRFS_I(inode)) != BTRFS_BTREE_INODE_OBJECTID;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
* making error handling and cleanup easier.
|
* making error handling and cleanup easier.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes)
|
int btrfs_alloc_data_chunk_ondemand(const struct btrfs_inode *inode, u64 bytes)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root = inode->root;
|
struct btrfs_root *root = inode->root;
|
||||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||||
|
@ -9,7 +9,7 @@ struct extent_changeset;
|
|||||||
struct btrfs_inode;
|
struct btrfs_inode;
|
||||||
struct btrfs_fs_info;
|
struct btrfs_fs_info;
|
||||||
|
|
||||||
int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes);
|
int btrfs_alloc_data_chunk_ondemand(const struct btrfs_inode *inode, u64 bytes);
|
||||||
int btrfs_check_data_free_space(struct btrfs_inode *inode,
|
int btrfs_check_data_free_space(struct btrfs_inode *inode,
|
||||||
struct extent_changeset **reserved, u64 start, u64 len,
|
struct extent_changeset **reserved, u64 start, u64 len,
|
||||||
bool noflush);
|
bool noflush);
|
||||||
|
@ -1469,7 +1469,7 @@ static void btrfs_release_dir_index_item_space(struct btrfs_trans_handle *trans)
|
|||||||
int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
|
int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
|
||||||
const char *name, int name_len,
|
const char *name, int name_len,
|
||||||
struct btrfs_inode *dir,
|
struct btrfs_inode *dir,
|
||||||
struct btrfs_disk_key *disk_key, u8 flags,
|
const struct btrfs_disk_key *disk_key, u8 flags,
|
||||||
u64 index)
|
u64 index)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = trans->fs_info;
|
struct btrfs_fs_info *fs_info = trans->fs_info;
|
||||||
@ -1755,7 +1755,7 @@ void btrfs_readdir_put_delayed_items(struct inode *inode,
|
|||||||
downgrade_write(&inode->i_rwsem);
|
downgrade_write(&inode->i_rwsem);
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_should_delete_dir_index(struct list_head *del_list,
|
int btrfs_should_delete_dir_index(const struct list_head *del_list,
|
||||||
u64 index)
|
u64 index)
|
||||||
{
|
{
|
||||||
struct btrfs_delayed_item *curr;
|
struct btrfs_delayed_item *curr;
|
||||||
@ -1776,7 +1776,7 @@ int btrfs_should_delete_dir_index(struct list_head *del_list,
|
|||||||
* Read dir info stored in the delayed tree.
|
* Read dir info stored in the delayed tree.
|
||||||
*/
|
*/
|
||||||
int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
|
int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
|
||||||
struct list_head *ins_list)
|
const struct list_head *ins_list)
|
||||||
{
|
{
|
||||||
struct btrfs_dir_item *di;
|
struct btrfs_dir_item *di;
|
||||||
struct btrfs_delayed_item *curr, *next;
|
struct btrfs_delayed_item *curr, *next;
|
||||||
|
@ -110,7 +110,7 @@ void btrfs_init_delayed_root(struct btrfs_delayed_root *delayed_root);
|
|||||||
int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
|
int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
|
||||||
const char *name, int name_len,
|
const char *name, int name_len,
|
||||||
struct btrfs_inode *dir,
|
struct btrfs_inode *dir,
|
||||||
struct btrfs_disk_key *disk_key, u8 flags,
|
const struct btrfs_disk_key *disk_key, u8 flags,
|
||||||
u64 index);
|
u64 index);
|
||||||
|
|
||||||
int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
|
int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
|
||||||
@ -150,10 +150,10 @@ bool btrfs_readdir_get_delayed_items(struct inode *inode,
|
|||||||
void btrfs_readdir_put_delayed_items(struct inode *inode,
|
void btrfs_readdir_put_delayed_items(struct inode *inode,
|
||||||
struct list_head *ins_list,
|
struct list_head *ins_list,
|
||||||
struct list_head *del_list);
|
struct list_head *del_list);
|
||||||
int btrfs_should_delete_dir_index(struct list_head *del_list,
|
int btrfs_should_delete_dir_index(const struct list_head *del_list,
|
||||||
u64 index);
|
u64 index);
|
||||||
int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
|
int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
|
||||||
struct list_head *ins_list);
|
const struct list_head *ins_list);
|
||||||
|
|
||||||
/* Used during directory logging. */
|
/* Used during directory logging. */
|
||||||
void btrfs_log_get_delayed_items(struct btrfs_inode *inode,
|
void btrfs_log_get_delayed_items(struct btrfs_inode *inode,
|
||||||
|
@ -22,7 +22,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
|
|||||||
*trans,
|
*trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
struct btrfs_path *path,
|
struct btrfs_path *path,
|
||||||
struct btrfs_key *cpu_key,
|
const struct btrfs_key *cpu_key,
|
||||||
u32 data_size,
|
u32 data_size,
|
||||||
const char *name,
|
const char *name,
|
||||||
int name_len)
|
int name_len)
|
||||||
@ -108,7 +108,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
|
|||||||
*/
|
*/
|
||||||
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
|
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
|
||||||
const struct fscrypt_str *name, struct btrfs_inode *dir,
|
const struct fscrypt_str *name, struct btrfs_inode *dir,
|
||||||
struct btrfs_key *location, u8 type, u64 index)
|
const struct btrfs_key *location, u8 type, u64 index)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int ret2 = 0;
|
int ret2 = 0;
|
||||||
@ -379,7 +379,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
|
|||||||
* for a specific name.
|
* for a specific name.
|
||||||
*/
|
*/
|
||||||
struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
|
struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_path *path,
|
const struct btrfs_path *path,
|
||||||
const char *name, int name_len)
|
const char *name, int name_len)
|
||||||
{
|
{
|
||||||
struct btrfs_dir_item *dir_item;
|
struct btrfs_dir_item *dir_item;
|
||||||
@ -417,7 +417,7 @@ struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
|
|||||||
int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
|
int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
struct btrfs_path *path,
|
struct btrfs_path *path,
|
||||||
struct btrfs_dir_item *di)
|
const struct btrfs_dir_item *di)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct extent_buffer *leaf;
|
struct extent_buffer *leaf;
|
||||||
|
@ -17,7 +17,7 @@ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
|
|||||||
const struct fscrypt_str *name);
|
const struct fscrypt_str *name);
|
||||||
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
|
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
|
||||||
const struct fscrypt_str *name, struct btrfs_inode *dir,
|
const struct fscrypt_str *name, struct btrfs_inode *dir,
|
||||||
struct btrfs_key *location, u8 type, u64 index);
|
const struct btrfs_key *location, u8 type, u64 index);
|
||||||
struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
|
struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
struct btrfs_path *path, u64 dir,
|
struct btrfs_path *path, u64 dir,
|
||||||
@ -33,7 +33,7 @@ struct btrfs_dir_item *btrfs_search_dir_index_item(struct btrfs_root *root,
|
|||||||
int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
|
int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
struct btrfs_path *path,
|
struct btrfs_path *path,
|
||||||
struct btrfs_dir_item *di);
|
const struct btrfs_dir_item *di);
|
||||||
int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
|
int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
struct btrfs_path *path, u64 objectid,
|
struct btrfs_path *path, u64 objectid,
|
||||||
@ -45,7 +45,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
|
|||||||
const char *name, u16 name_len,
|
const char *name, u16 name_len,
|
||||||
int mod);
|
int mod);
|
||||||
struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
|
struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_path *path,
|
const struct btrfs_path *path,
|
||||||
const char *name,
|
const char *name,
|
||||||
int name_len);
|
int name_len);
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ static int btrfs_repair_eb_io_failure(const struct extent_buffer *eb,
|
|||||||
* structure for details.
|
* structure for details.
|
||||||
*/
|
*/
|
||||||
int btrfs_read_extent_buffer(struct extent_buffer *eb,
|
int btrfs_read_extent_buffer(struct extent_buffer *eb,
|
||||||
struct btrfs_tree_parent_check *check)
|
const struct btrfs_tree_parent_check *check)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = eb->fs_info;
|
struct btrfs_fs_info *fs_info = eb->fs_info;
|
||||||
int failed = 0;
|
int failed = 0;
|
||||||
@ -358,7 +358,7 @@ static bool check_tree_block_fsid(struct extent_buffer *eb)
|
|||||||
|
|
||||||
/* Do basic extent buffer checks at read time */
|
/* Do basic extent buffer checks at read time */
|
||||||
int btrfs_validate_extent_buffer(struct extent_buffer *eb,
|
int btrfs_validate_extent_buffer(struct extent_buffer *eb,
|
||||||
struct btrfs_tree_parent_check *check)
|
const struct btrfs_tree_parent_check *check)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = eb->fs_info;
|
struct btrfs_fs_info *fs_info = eb->fs_info;
|
||||||
u64 found_start;
|
u64 found_start;
|
||||||
@ -425,7 +425,7 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (check->has_first_key) {
|
if (check->has_first_key) {
|
||||||
struct btrfs_key *expect_key = &check->first_key;
|
const struct btrfs_key *expect_key = &check->first_key;
|
||||||
struct btrfs_key found_key;
|
struct btrfs_key found_key;
|
||||||
|
|
||||||
if (found_level)
|
if (found_level)
|
||||||
@ -1025,7 +1025,7 @@ int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
|
static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
|
||||||
struct btrfs_path *path,
|
struct btrfs_path *path,
|
||||||
struct btrfs_key *key)
|
const struct btrfs_key *key)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root;
|
struct btrfs_root *root;
|
||||||
struct btrfs_tree_parent_check check = { 0 };
|
struct btrfs_tree_parent_check check = { 0 };
|
||||||
@ -1087,7 +1087,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
|
struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
|
||||||
struct btrfs_key *key)
|
const struct btrfs_key *key)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root;
|
struct btrfs_root *root;
|
||||||
struct btrfs_path *path;
|
struct btrfs_path *path;
|
||||||
@ -1222,7 +1222,7 @@ int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btrfs_check_leaked_roots(struct btrfs_fs_info *fs_info)
|
void btrfs_check_leaked_roots(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_BTRFS_DEBUG
|
#ifdef CONFIG_BTRFS_DEBUG
|
||||||
struct btrfs_root *root;
|
struct btrfs_root *root;
|
||||||
@ -2339,8 +2339,8 @@ out:
|
|||||||
* 1, 2 2nd and 3rd backup copy
|
* 1, 2 2nd and 3rd backup copy
|
||||||
* -1 skip bytenr check
|
* -1 skip bytenr check
|
||||||
*/
|
*/
|
||||||
int btrfs_validate_super(struct btrfs_fs_info *fs_info,
|
int btrfs_validate_super(const struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_super_block *sb, int mirror_num)
|
const struct btrfs_super_block *sb, int mirror_num)
|
||||||
{
|
{
|
||||||
u64 nodesize = btrfs_super_nodesize(sb);
|
u64 nodesize = btrfs_super_nodesize(sb);
|
||||||
u64 sectorsize = btrfs_super_sectorsize(sb);
|
u64 sectorsize = btrfs_super_sectorsize(sb);
|
||||||
@ -3192,7 +3192,7 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices,
|
int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices,
|
||||||
char *options)
|
const char *options)
|
||||||
{
|
{
|
||||||
u32 sectorsize;
|
u32 sectorsize;
|
||||||
u32 nodesize;
|
u32 nodesize;
|
||||||
|
@ -41,7 +41,7 @@ static inline u64 btrfs_sb_offset(int mirror)
|
|||||||
return BTRFS_SUPER_INFO_OFFSET;
|
return BTRFS_SUPER_INFO_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btrfs_check_leaked_roots(struct btrfs_fs_info *fs_info);
|
void btrfs_check_leaked_roots(const struct btrfs_fs_info *fs_info);
|
||||||
void btrfs_init_fs_info(struct btrfs_fs_info *fs_info);
|
void btrfs_init_fs_info(struct btrfs_fs_info *fs_info);
|
||||||
struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
|
struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
|
||||||
struct btrfs_tree_parent_check *check);
|
struct btrfs_tree_parent_check *check);
|
||||||
@ -52,12 +52,11 @@ struct extent_buffer *btrfs_find_create_tree_block(
|
|||||||
int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info);
|
int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info);
|
||||||
int btrfs_check_super_csum(struct btrfs_fs_info *fs_info,
|
int btrfs_check_super_csum(struct btrfs_fs_info *fs_info,
|
||||||
const struct btrfs_super_block *disk_sb);
|
const struct btrfs_super_block *disk_sb);
|
||||||
int __cold open_ctree(struct super_block *sb,
|
int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices,
|
||||||
struct btrfs_fs_devices *fs_devices,
|
const char *options);
|
||||||
char *options);
|
|
||||||
void __cold close_ctree(struct btrfs_fs_info *fs_info);
|
void __cold close_ctree(struct btrfs_fs_info *fs_info);
|
||||||
int btrfs_validate_super(struct btrfs_fs_info *fs_info,
|
int btrfs_validate_super(const struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_super_block *sb, int mirror_num);
|
const struct btrfs_super_block *sb, int mirror_num);
|
||||||
int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount);
|
int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount);
|
||||||
int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors);
|
int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors);
|
||||||
struct btrfs_super_block *btrfs_read_dev_super(struct block_device *bdev);
|
struct btrfs_super_block *btrfs_read_dev_super(struct block_device *bdev);
|
||||||
@ -65,7 +64,7 @@ struct btrfs_super_block *btrfs_read_dev_one_super(struct block_device *bdev,
|
|||||||
int copy_num, bool drop_cache);
|
int copy_num, bool drop_cache);
|
||||||
int btrfs_commit_super(struct btrfs_fs_info *fs_info);
|
int btrfs_commit_super(struct btrfs_fs_info *fs_info);
|
||||||
struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
|
struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
|
||||||
struct btrfs_key *key);
|
const struct btrfs_key *key);
|
||||||
int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
|
int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_root *root);
|
struct btrfs_root *root);
|
||||||
void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info);
|
void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info);
|
||||||
@ -90,7 +89,7 @@ void btrfs_btree_balance_dirty_nodelay(struct btrfs_fs_info *fs_info);
|
|||||||
void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
|
void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_root *root);
|
struct btrfs_root *root);
|
||||||
int btrfs_validate_extent_buffer(struct extent_buffer *eb,
|
int btrfs_validate_extent_buffer(struct extent_buffer *eb,
|
||||||
struct btrfs_tree_parent_check *check);
|
const struct btrfs_tree_parent_check *check);
|
||||||
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
||||||
struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info);
|
struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info);
|
||||||
#endif
|
#endif
|
||||||
@ -117,7 +116,7 @@ void btrfs_mark_buffer_dirty(struct btrfs_trans_handle *trans,
|
|||||||
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
|
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
|
||||||
int atomic);
|
int atomic);
|
||||||
int btrfs_read_extent_buffer(struct extent_buffer *buf,
|
int btrfs_read_extent_buffer(struct extent_buffer *buf,
|
||||||
struct btrfs_tree_parent_check *check);
|
const struct btrfs_tree_parent_check *check);
|
||||||
|
|
||||||
blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio);
|
blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio);
|
||||||
int btrfs_alloc_log_tree_node(struct btrfs_trans_handle *trans,
|
int btrfs_alloc_log_tree_node(struct btrfs_trans_handle *trans,
|
||||||
|
@ -180,7 +180,7 @@ void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void process_one_page(struct btrfs_fs_info *fs_info,
|
static void process_one_page(struct btrfs_fs_info *fs_info,
|
||||||
struct page *page, struct page *locked_page,
|
struct page *page, const struct page *locked_page,
|
||||||
unsigned long page_ops, u64 start, u64 end)
|
unsigned long page_ops, u64 start, u64 end)
|
||||||
{
|
{
|
||||||
struct folio *folio = page_folio(page);
|
struct folio *folio = page_folio(page);
|
||||||
@ -203,7 +203,7 @@ static void process_one_page(struct btrfs_fs_info *fs_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void __process_pages_contig(struct address_space *mapping,
|
static void __process_pages_contig(struct address_space *mapping,
|
||||||
struct page *locked_page, u64 start, u64 end,
|
const struct page *locked_page, u64 start, u64 end,
|
||||||
unsigned long page_ops)
|
unsigned long page_ops)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = inode_to_fs_info(mapping->host);
|
struct btrfs_fs_info *fs_info = inode_to_fs_info(mapping->host);
|
||||||
@ -230,8 +230,8 @@ static void __process_pages_contig(struct address_space *mapping,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static noinline void __unlock_for_delalloc(struct inode *inode,
|
static noinline void __unlock_for_delalloc(const struct inode *inode,
|
||||||
struct page *locked_page,
|
const struct page *locked_page,
|
||||||
u64 start, u64 end)
|
u64 start, u64 end)
|
||||||
{
|
{
|
||||||
unsigned long index = start >> PAGE_SHIFT;
|
unsigned long index = start >> PAGE_SHIFT;
|
||||||
@ -246,7 +246,7 @@ static noinline void __unlock_for_delalloc(struct inode *inode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static noinline int lock_delalloc_pages(struct inode *inode,
|
static noinline int lock_delalloc_pages(struct inode *inode,
|
||||||
struct page *locked_page,
|
const struct page *locked_page,
|
||||||
u64 start,
|
u64 start,
|
||||||
u64 end)
|
u64 end)
|
||||||
{
|
{
|
||||||
@ -411,7 +411,7 @@ out_failed:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
|
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
|
||||||
struct page *locked_page,
|
const struct page *locked_page,
|
||||||
struct extent_state **cached,
|
struct extent_state **cached,
|
||||||
u32 clear_bits, unsigned long page_ops)
|
u32 clear_bits, unsigned long page_ops)
|
||||||
{
|
{
|
||||||
@ -1382,7 +1382,7 @@ out:
|
|||||||
* Return the next dirty range in [@start, @end).
|
* Return the next dirty range in [@start, @end).
|
||||||
* If no dirty range is found, @start will be page_offset(page) + PAGE_SIZE.
|
* If no dirty range is found, @start will be page_offset(page) + PAGE_SIZE.
|
||||||
*/
|
*/
|
||||||
static void find_next_dirty_byte(struct btrfs_fs_info *fs_info,
|
static void find_next_dirty_byte(const struct btrfs_fs_info *fs_info,
|
||||||
struct page *page, u64 *start, u64 *end)
|
struct page *page, u64 *start, u64 *end)
|
||||||
{
|
{
|
||||||
struct folio *folio = page_folio(page);
|
struct folio *folio = page_folio(page);
|
||||||
@ -1743,7 +1743,7 @@ static void set_btree_ioerr(struct extent_buffer *eb)
|
|||||||
* context.
|
* context.
|
||||||
*/
|
*/
|
||||||
static struct extent_buffer *find_extent_buffer_nolock(
|
static struct extent_buffer *find_extent_buffer_nolock(
|
||||||
struct btrfs_fs_info *fs_info, u64 start)
|
const struct btrfs_fs_info *fs_info, u64 start)
|
||||||
{
|
{
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
|
|
||||||
@ -2312,7 +2312,7 @@ retry:
|
|||||||
* already been ran (aka, ordered extent inserted) and all pages are still
|
* already been ran (aka, ordered extent inserted) and all pages are still
|
||||||
* locked.
|
* locked.
|
||||||
*/
|
*/
|
||||||
void extent_write_locked_range(struct inode *inode, struct page *locked_page,
|
void extent_write_locked_range(struct inode *inode, const struct page *locked_page,
|
||||||
u64 start, u64 end, struct writeback_control *wbc,
|
u64 start, u64 end, struct writeback_control *wbc,
|
||||||
bool pages_dirty)
|
bool pages_dirty)
|
||||||
{
|
{
|
||||||
@ -2597,7 +2597,7 @@ static bool folio_range_has_eb(struct btrfs_fs_info *fs_info, struct folio *foli
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void detach_extent_buffer_folio(struct extent_buffer *eb, struct folio *folio)
|
static void detach_extent_buffer_folio(const struct extent_buffer *eb, struct folio *folio)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = eb->fs_info;
|
struct btrfs_fs_info *fs_info = eb->fs_info;
|
||||||
const bool mapped = !test_bit(EXTENT_BUFFER_UNMAPPED, &eb->bflags);
|
const bool mapped = !test_bit(EXTENT_BUFFER_UNMAPPED, &eb->bflags);
|
||||||
@ -2658,7 +2658,7 @@ static void detach_extent_buffer_folio(struct extent_buffer *eb, struct folio *f
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Release all pages attached to the extent buffer */
|
/* Release all pages attached to the extent buffer */
|
||||||
static void btrfs_release_extent_buffer_pages(struct extent_buffer *eb)
|
static void btrfs_release_extent_buffer_pages(const struct extent_buffer *eb)
|
||||||
{
|
{
|
||||||
ASSERT(!extent_buffer_under_io(eb));
|
ASSERT(!extent_buffer_under_io(eb));
|
||||||
|
|
||||||
@ -3575,7 +3575,7 @@ static void end_bbio_meta_read(struct btrfs_bio *bbio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
|
int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
|
||||||
struct btrfs_tree_parent_check *check)
|
const struct btrfs_tree_parent_check *check)
|
||||||
{
|
{
|
||||||
struct btrfs_bio *bbio;
|
struct btrfs_bio *bbio;
|
||||||
bool ret;
|
bool ret;
|
||||||
@ -4188,7 +4188,7 @@ void memmove_extent_buffer(const struct extent_buffer *dst,
|
|||||||
|
|
||||||
#define GANG_LOOKUP_SIZE 16
|
#define GANG_LOOKUP_SIZE 16
|
||||||
static struct extent_buffer *get_next_extent_buffer(
|
static struct extent_buffer *get_next_extent_buffer(
|
||||||
struct btrfs_fs_info *fs_info, struct page *page, u64 bytenr)
|
const struct btrfs_fs_info *fs_info, struct page *page, u64 bytenr)
|
||||||
{
|
{
|
||||||
struct extent_buffer *gang[GANG_LOOKUP_SIZE];
|
struct extent_buffer *gang[GANG_LOOKUP_SIZE];
|
||||||
struct extent_buffer *found = NULL;
|
struct extent_buffer *found = NULL;
|
||||||
|
@ -235,7 +235,7 @@ bool try_release_extent_mapping(struct page *page, gfp_t mask);
|
|||||||
int try_release_extent_buffer(struct page *page);
|
int try_release_extent_buffer(struct page *page);
|
||||||
|
|
||||||
int btrfs_read_folio(struct file *file, struct folio *folio);
|
int btrfs_read_folio(struct file *file, struct folio *folio);
|
||||||
void extent_write_locked_range(struct inode *inode, struct page *locked_page,
|
void extent_write_locked_range(struct inode *inode, const struct page *locked_page,
|
||||||
u64 start, u64 end, struct writeback_control *wbc,
|
u64 start, u64 end, struct writeback_control *wbc,
|
||||||
bool pages_dirty);
|
bool pages_dirty);
|
||||||
int btrfs_writepages(struct address_space *mapping, struct writeback_control *wbc);
|
int btrfs_writepages(struct address_space *mapping, struct writeback_control *wbc);
|
||||||
@ -261,7 +261,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb);
|
|||||||
#define WAIT_COMPLETE 1
|
#define WAIT_COMPLETE 1
|
||||||
#define WAIT_PAGE_LOCK 2
|
#define WAIT_PAGE_LOCK 2
|
||||||
int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
|
int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
|
||||||
struct btrfs_tree_parent_check *parent_check);
|
const struct btrfs_tree_parent_check *parent_check);
|
||||||
void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
|
void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
|
||||||
void btrfs_readahead_tree_block(struct btrfs_fs_info *fs_info,
|
void btrfs_readahead_tree_block(struct btrfs_fs_info *fs_info,
|
||||||
u64 bytenr, u64 owner_root, u64 gen, int level);
|
u64 bytenr, u64 owner_root, u64 gen, int level);
|
||||||
@ -350,7 +350,7 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb);
|
|||||||
void clear_extent_buffer_uptodate(struct extent_buffer *eb);
|
void clear_extent_buffer_uptodate(struct extent_buffer *eb);
|
||||||
void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
|
void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
|
||||||
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
|
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
|
||||||
struct page *locked_page,
|
const struct page *locked_page,
|
||||||
struct extent_state **cached,
|
struct extent_state **cached,
|
||||||
u32 bits_to_clear, unsigned long page_ops);
|
u32 bits_to_clear, unsigned long page_ops);
|
||||||
int extent_invalidate_folio(struct extent_io_tree *tree,
|
int extent_invalidate_folio(struct extent_io_tree *tree,
|
||||||
|
@ -956,7 +956,7 @@ static inline bool btrfs_is_zoned(const struct btrfs_fs_info *fs_info)
|
|||||||
/*
|
/*
|
||||||
* Count how many fs_info->max_extent_size cover the @size
|
* Count how many fs_info->max_extent_size cover the @size
|
||||||
*/
|
*/
|
||||||
static inline u32 count_max_extents(struct btrfs_fs_info *fs_info, u64 size)
|
static inline u32 count_max_extents(const struct btrfs_fs_info *fs_info, u64 size)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
||||||
if (!fs_info)
|
if (!fs_info)
|
||||||
@ -1017,7 +1017,7 @@ void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag,
|
|||||||
#define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
|
#define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
|
||||||
BTRFS_MOUNT_##opt)
|
BTRFS_MOUNT_##opt)
|
||||||
|
|
||||||
static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
|
static inline int btrfs_fs_closing(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
/* Do it this way so we only ever do one test_bit in the normal case. */
|
/* Do it this way so we only ever do one test_bit in the normal case. */
|
||||||
if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) {
|
if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) {
|
||||||
@ -1036,7 +1036,7 @@ static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
|
|||||||
* since setting and checking for SB_RDONLY in the superblock's flags is not
|
* since setting and checking for SB_RDONLY in the superblock's flags is not
|
||||||
* atomic.
|
* atomic.
|
||||||
*/
|
*/
|
||||||
static inline int btrfs_need_cleaner_sleep(struct btrfs_fs_info *fs_info)
|
static inline int btrfs_need_cleaner_sleep(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
return test_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state) ||
|
return test_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state) ||
|
||||||
btrfs_fs_closing(fs_info);
|
btrfs_fs_closing(fs_info);
|
||||||
@ -1057,7 +1057,7 @@ static inline void btrfs_wake_unfinished_drop(struct btrfs_fs_info *fs_info)
|
|||||||
|
|
||||||
#define EXPORT_FOR_TESTS
|
#define EXPORT_FOR_TESTS
|
||||||
|
|
||||||
static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
|
static inline int btrfs_is_testing(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);
|
return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);
|
||||||
}
|
}
|
||||||
@ -1068,7 +1068,7 @@ void btrfs_test_destroy_inode(struct inode *inode);
|
|||||||
|
|
||||||
#define EXPORT_FOR_TESTS static
|
#define EXPORT_FOR_TESTS static
|
||||||
|
|
||||||
static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
|
static inline int btrfs_is_testing(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ static noinline int btrfs_ioctl_fitrim(struct btrfs_fs_info *fs_info,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __pure btrfs_is_empty_uuid(u8 *uuid)
|
int __pure btrfs_is_empty_uuid(const u8 *uuid)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
|
|||||||
struct dentry *dentry, struct fileattr *fa);
|
struct dentry *dentry, struct fileattr *fa);
|
||||||
int btrfs_ioctl_get_supported_features(void __user *arg);
|
int btrfs_ioctl_get_supported_features(void __user *arg);
|
||||||
void btrfs_sync_inode_flags_to_i_flags(struct inode *inode);
|
void btrfs_sync_inode_flags_to_i_flags(struct inode *inode);
|
||||||
int __pure btrfs_is_empty_uuid(u8 *uuid);
|
int __pure btrfs_is_empty_uuid(const u8 *uuid);
|
||||||
void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
|
void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_ioctl_balance_args *bargs);
|
struct btrfs_ioctl_balance_args *bargs);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ struct rb_simple_node {
|
|||||||
u64 bytenr;
|
u64 bytenr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct rb_node *rb_simple_search(struct rb_root *root, u64 bytenr)
|
static inline struct rb_node *rb_simple_search(const struct rb_root *root, u64 bytenr)
|
||||||
{
|
{
|
||||||
struct rb_node *node = root->rb_node;
|
struct rb_node *node = root->rb_node;
|
||||||
struct rb_simple_node *entry;
|
struct rb_simple_node *entry;
|
||||||
@ -93,7 +93,7 @@ static inline struct rb_node *rb_simple_search(struct rb_root *root, u64 bytenr)
|
|||||||
* Return the rb_node that start at or after @bytenr. If there is no entry at
|
* Return the rb_node that start at or after @bytenr. If there is no entry at
|
||||||
* or after @bytner return NULL.
|
* or after @bytner return NULL.
|
||||||
*/
|
*/
|
||||||
static inline struct rb_node *rb_simple_search_first(struct rb_root *root,
|
static inline struct rb_node *rb_simple_search_first(const struct rb_root *root,
|
||||||
u64 bytenr)
|
u64 bytenr)
|
||||||
{
|
{
|
||||||
struct rb_node *node = root->rb_node, *ret = NULL;
|
struct rb_node *node = root->rb_node, *ret = NULL;
|
||||||
|
@ -27,7 +27,7 @@ struct prop_handler {
|
|||||||
int (*validate)(const struct btrfs_inode *inode, const char *value,
|
int (*validate)(const struct btrfs_inode *inode, const char *value,
|
||||||
size_t len);
|
size_t len);
|
||||||
int (*apply)(struct inode *inode, const char *value, size_t len);
|
int (*apply)(struct inode *inode, const char *value, size_t len);
|
||||||
const char *(*extract)(struct inode *inode);
|
const char *(*extract)(const struct inode *inode);
|
||||||
bool (*ignore)(const struct btrfs_inode *inode);
|
bool (*ignore)(const struct btrfs_inode *inode);
|
||||||
int inheritable;
|
int inheritable;
|
||||||
};
|
};
|
||||||
@ -359,7 +359,7 @@ static bool prop_compression_ignore(const struct btrfs_inode *inode)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *prop_compression_extract(struct inode *inode)
|
static const char *prop_compression_extract(const struct inode *inode)
|
||||||
{
|
{
|
||||||
switch (BTRFS_I(inode)->prop_compress) {
|
switch (BTRFS_I(inode)->prop_compress) {
|
||||||
case BTRFS_COMPRESS_ZLIB:
|
case BTRFS_COMPRESS_ZLIB:
|
||||||
@ -385,7 +385,7 @@ static struct prop_handler prop_handlers[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
|
int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
|
||||||
struct inode *inode, struct inode *parent)
|
struct inode *inode, const struct inode *parent)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||||
|
@ -26,6 +26,6 @@ int btrfs_load_inode_props(struct inode *inode, struct btrfs_path *path);
|
|||||||
|
|
||||||
int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
|
int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
|
||||||
struct inode *inode,
|
struct inode *inode,
|
||||||
struct inode *dir);
|
const struct inode *dir);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "root-tree.h"
|
#include "root-tree.h"
|
||||||
#include "tree-checker.h"
|
#include "tree-checker.h"
|
||||||
|
|
||||||
enum btrfs_qgroup_mode btrfs_qgroup_mode(struct btrfs_fs_info *fs_info)
|
enum btrfs_qgroup_mode btrfs_qgroup_mode(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
|
if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
|
||||||
return BTRFS_QGROUP_MODE_DISABLED;
|
return BTRFS_QGROUP_MODE_DISABLED;
|
||||||
@ -39,12 +39,12 @@ enum btrfs_qgroup_mode btrfs_qgroup_mode(struct btrfs_fs_info *fs_info)
|
|||||||
return BTRFS_QGROUP_MODE_FULL;
|
return BTRFS_QGROUP_MODE_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool btrfs_qgroup_enabled(struct btrfs_fs_info *fs_info)
|
bool btrfs_qgroup_enabled(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
return btrfs_qgroup_mode(fs_info) != BTRFS_QGROUP_MODE_DISABLED;
|
return btrfs_qgroup_mode(fs_info) != BTRFS_QGROUP_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool btrfs_qgroup_full_accounting(struct btrfs_fs_info *fs_info)
|
bool btrfs_qgroup_full_accounting(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
return btrfs_qgroup_mode(fs_info) == BTRFS_QGROUP_MODE_FULL;
|
return btrfs_qgroup_mode(fs_info) == BTRFS_QGROUP_MODE_FULL;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ static void qgroup_rsv_release(struct btrfs_fs_info *fs_info,
|
|||||||
|
|
||||||
static void qgroup_rsv_add_by_qgroup(struct btrfs_fs_info *fs_info,
|
static void qgroup_rsv_add_by_qgroup(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_qgroup *dest,
|
struct btrfs_qgroup *dest,
|
||||||
struct btrfs_qgroup *src)
|
const struct btrfs_qgroup *src)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ static void qgroup_rsv_add_by_qgroup(struct btrfs_fs_info *fs_info,
|
|||||||
|
|
||||||
static void qgroup_rsv_release_by_qgroup(struct btrfs_fs_info *fs_info,
|
static void qgroup_rsv_release_by_qgroup(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_qgroup *dest,
|
struct btrfs_qgroup *dest,
|
||||||
struct btrfs_qgroup *src)
|
const struct btrfs_qgroup *src)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -141,14 +141,14 @@ static void btrfs_qgroup_update_new_refcnt(struct btrfs_qgroup *qg, u64 seq,
|
|||||||
qg->new_refcnt += mod;
|
qg->new_refcnt += mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u64 btrfs_qgroup_get_old_refcnt(struct btrfs_qgroup *qg, u64 seq)
|
static inline u64 btrfs_qgroup_get_old_refcnt(const struct btrfs_qgroup *qg, u64 seq)
|
||||||
{
|
{
|
||||||
if (qg->old_refcnt < seq)
|
if (qg->old_refcnt < seq)
|
||||||
return 0;
|
return 0;
|
||||||
return qg->old_refcnt - seq;
|
return qg->old_refcnt - seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u64 btrfs_qgroup_get_new_refcnt(struct btrfs_qgroup *qg, u64 seq)
|
static inline u64 btrfs_qgroup_get_new_refcnt(const struct btrfs_qgroup *qg, u64 seq)
|
||||||
{
|
{
|
||||||
if (qg->new_refcnt < seq)
|
if (qg->new_refcnt < seq)
|
||||||
return 0;
|
return 0;
|
||||||
@ -171,7 +171,7 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid,
|
|||||||
static void qgroup_rescan_zero_tracking(struct btrfs_fs_info *fs_info);
|
static void qgroup_rescan_zero_tracking(struct btrfs_fs_info *fs_info);
|
||||||
|
|
||||||
/* must be called with qgroup_ioctl_lock held */
|
/* must be called with qgroup_ioctl_lock held */
|
||||||
static struct btrfs_qgroup *find_qgroup_rb(struct btrfs_fs_info *fs_info,
|
static struct btrfs_qgroup *find_qgroup_rb(const struct btrfs_fs_info *fs_info,
|
||||||
u64 qgroupid)
|
u64 qgroupid)
|
||||||
{
|
{
|
||||||
struct rb_node *n = fs_info->qgroup_tree.rb_node;
|
struct rb_node *n = fs_info->qgroup_tree.rb_node;
|
||||||
@ -346,7 +346,7 @@ static int del_relation_rb(struct btrfs_fs_info *fs_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
||||||
int btrfs_verify_qgroup_counts(struct btrfs_fs_info *fs_info, u64 qgroupid,
|
int btrfs_verify_qgroup_counts(const struct btrfs_fs_info *fs_info, u64 qgroupid,
|
||||||
u64 rfer, u64 excl)
|
u64 rfer, u64 excl)
|
||||||
{
|
{
|
||||||
struct btrfs_qgroup *qgroup;
|
struct btrfs_qgroup *qgroup;
|
||||||
@ -608,7 +608,7 @@ out:
|
|||||||
* Return false if no reserved space is left.
|
* Return false if no reserved space is left.
|
||||||
* Return true if some reserved space is leaked.
|
* Return true if some reserved space is leaked.
|
||||||
*/
|
*/
|
||||||
bool btrfs_check_quota_leak(struct btrfs_fs_info *fs_info)
|
bool btrfs_check_quota_leak(const struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
struct rb_node *node;
|
struct rb_node *node;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
@ -4903,7 +4903,7 @@ void btrfs_free_squota_rsv(struct btrfs_fs_info *fs_info, u64 root, u64 rsv_byte
|
|||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
|
int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_squota_delta *delta)
|
const struct btrfs_squota_delta *delta)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct btrfs_qgroup *qgroup;
|
struct btrfs_qgroup *qgroup;
|
||||||
|
@ -311,9 +311,9 @@ enum btrfs_qgroup_mode {
|
|||||||
BTRFS_QGROUP_MODE_SIMPLE
|
BTRFS_QGROUP_MODE_SIMPLE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum btrfs_qgroup_mode btrfs_qgroup_mode(struct btrfs_fs_info *fs_info);
|
enum btrfs_qgroup_mode btrfs_qgroup_mode(const struct btrfs_fs_info *fs_info);
|
||||||
bool btrfs_qgroup_enabled(struct btrfs_fs_info *fs_info);
|
bool btrfs_qgroup_enabled(const struct btrfs_fs_info *fs_info);
|
||||||
bool btrfs_qgroup_full_accounting(struct btrfs_fs_info *fs_info);
|
bool btrfs_qgroup_full_accounting(const struct btrfs_fs_info *fs_info);
|
||||||
int btrfs_quota_enable(struct btrfs_fs_info *fs_info,
|
int btrfs_quota_enable(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_ioctl_quota_ctl_args *quota_ctl_args);
|
struct btrfs_ioctl_quota_ctl_args *quota_ctl_args);
|
||||||
int btrfs_quota_disable(struct btrfs_fs_info *fs_info);
|
int btrfs_quota_disable(struct btrfs_fs_info *fs_info);
|
||||||
@ -361,7 +361,7 @@ void btrfs_qgroup_free_refroot(struct btrfs_fs_info *fs_info,
|
|||||||
enum btrfs_qgroup_rsv_type type);
|
enum btrfs_qgroup_rsv_type type);
|
||||||
|
|
||||||
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
||||||
int btrfs_verify_qgroup_counts(struct btrfs_fs_info *fs_info, u64 qgroupid,
|
int btrfs_verify_qgroup_counts(const struct btrfs_fs_info *fs_info, u64 qgroupid,
|
||||||
u64 rfer, u64 excl);
|
u64 rfer, u64 excl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -431,9 +431,9 @@ int btrfs_qgroup_add_swapped_blocks(struct btrfs_trans_handle *trans,
|
|||||||
int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,
|
int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, struct extent_buffer *eb);
|
struct btrfs_root *root, struct extent_buffer *eb);
|
||||||
void btrfs_qgroup_destroy_extent_records(struct btrfs_transaction *trans);
|
void btrfs_qgroup_destroy_extent_records(struct btrfs_transaction *trans);
|
||||||
bool btrfs_check_quota_leak(struct btrfs_fs_info *fs_info);
|
bool btrfs_check_quota_leak(const struct btrfs_fs_info *fs_info);
|
||||||
void btrfs_free_squota_rsv(struct btrfs_fs_info *fs_info, u64 root, u64 rsv_bytes);
|
void btrfs_free_squota_rsv(struct btrfs_fs_info *fs_info, u64 root, u64 rsv_bytes);
|
||||||
int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
|
int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_squota_delta *delta);
|
const struct btrfs_squota_delta *delta);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8066,7 +8066,7 @@ static void dedupe_in_progress_warn(const struct btrfs_root *root)
|
|||||||
btrfs_root_id(root), root->dedupe_in_progress);
|
btrfs_root_id(root), root->dedupe_in_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg)
|
long btrfs_ioctl_send(struct inode *inode, const struct btrfs_ioctl_send_args *arg)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct btrfs_root *send_root = BTRFS_I(inode)->root;
|
struct btrfs_root *send_root = BTRFS_I(inode)->root;
|
||||||
|
@ -182,6 +182,6 @@ enum {
|
|||||||
__BTRFS_SEND_A_MAX = 35,
|
__BTRFS_SEND_A_MAX = 35,
|
||||||
};
|
};
|
||||||
|
|
||||||
long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg);
|
long btrfs_ioctl_send(struct inode *inode, const struct btrfs_ioctl_send_args *arg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -629,7 +629,7 @@ static void btrfs_clear_oneshot_options(struct btrfs_fs_info *fs_info)
|
|||||||
btrfs_clear_opt(fs_info->mount_opt, NOSPACECACHE);
|
btrfs_clear_opt(fs_info->mount_opt, NOSPACECACHE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool check_ro_option(struct btrfs_fs_info *fs_info,
|
static bool check_ro_option(const struct btrfs_fs_info *fs_info,
|
||||||
unsigned long mount_opt, unsigned long opt,
|
unsigned long mount_opt, unsigned long opt,
|
||||||
const char *opt_name)
|
const char *opt_name)
|
||||||
{
|
{
|
||||||
@ -641,7 +641,7 @@ static bool check_ro_option(struct btrfs_fs_info *fs_info,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool btrfs_check_options(struct btrfs_fs_info *info, unsigned long *mount_opt,
|
bool btrfs_check_options(const struct btrfs_fs_info *info, unsigned long *mount_opt,
|
||||||
unsigned long flags)
|
unsigned long flags)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
struct super_block;
|
struct super_block;
|
||||||
struct btrfs_fs_info;
|
struct btrfs_fs_info;
|
||||||
|
|
||||||
bool btrfs_check_options(struct btrfs_fs_info *info, unsigned long *mount_opt,
|
bool btrfs_check_options(const struct btrfs_fs_info *info, unsigned long *mount_opt,
|
||||||
unsigned long flags);
|
unsigned long flags);
|
||||||
int btrfs_sync_fs(struct super_block *sb, int wait);
|
int btrfs_sync_fs(struct super_block *sb, int wait);
|
||||||
char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
|
char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "accessors.h"
|
#include "accessors.h"
|
||||||
#include "uuid-tree.h"
|
#include "uuid-tree.h"
|
||||||
|
|
||||||
static void btrfs_uuid_to_key(u8 *uuid, u8 type, struct btrfs_key *key)
|
static void btrfs_uuid_to_key(const u8 *uuid, u8 type, struct btrfs_key *key)
|
||||||
{
|
{
|
||||||
key->type = type;
|
key->type = type;
|
||||||
key->objectid = get_unaligned_le64(uuid);
|
key->objectid = get_unaligned_le64(uuid);
|
||||||
@ -21,7 +21,7 @@ static void btrfs_uuid_to_key(u8 *uuid, u8 type, struct btrfs_key *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return -ENOENT for !found, < 0 for errors, or 0 if an item was found */
|
/* return -ENOENT for !found, < 0 for errors, or 0 if an item was found */
|
||||||
static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, u8 *uuid,
|
static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, const u8 *uuid,
|
||||||
u8 type, u64 subid)
|
u8 type, u64 subid)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -81,7 +81,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
|
int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, const u8 *uuid, u8 type,
|
||||||
u64 subid_cpu)
|
u64 subid_cpu)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = trans->fs_info;
|
struct btrfs_fs_info *fs_info = trans->fs_info;
|
||||||
@ -145,7 +145,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
|
int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, const u8 *uuid, u8 type,
|
||||||
u64 subid)
|
u64 subid)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = trans->fs_info;
|
struct btrfs_fs_info *fs_info = trans->fs_info;
|
||||||
@ -256,7 +256,7 @@ out:
|
|||||||
* < 0 if an error occurred
|
* < 0 if an error occurred
|
||||||
*/
|
*/
|
||||||
static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
|
static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
|
||||||
u8 *uuid, u8 type, u64 subvolid)
|
const u8 *uuid, u8 type, u64 subvolid)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct btrfs_root *subvol_root;
|
struct btrfs_root *subvol_root;
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
struct btrfs_trans_handle;
|
struct btrfs_trans_handle;
|
||||||
struct btrfs_fs_info;
|
struct btrfs_fs_info;
|
||||||
|
|
||||||
int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
|
int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, const u8 *uuid, u8 type,
|
||||||
u64 subid);
|
u64 subid);
|
||||||
int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
|
int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, const u8 *uuid, u8 type,
|
||||||
u64 subid);
|
u64 subid);
|
||||||
int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info);
|
int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info);
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ error_free_page:
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb)
|
const u8 *btrfs_sb_fsid_ptr(const struct btrfs_super_block *sb)
|
||||||
{
|
{
|
||||||
bool has_metadata_uuid = (btrfs_super_incompat_flags(sb) &
|
bool has_metadata_uuid = (btrfs_super_incompat_flags(sb) &
|
||||||
BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
|
BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
|
||||||
|
@ -834,6 +834,6 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info);
|
|||||||
bool btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical);
|
bool btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical);
|
||||||
|
|
||||||
bool btrfs_pinned_by_swapfile(struct btrfs_fs_info *fs_info, void *ptr);
|
bool btrfs_pinned_by_swapfile(struct btrfs_fs_info *fs_info, void *ptr);
|
||||||
u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb);
|
const u8 *btrfs_sb_fsid_ptr(const struct btrfs_super_block *sb);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "accessors.h"
|
#include "accessors.h"
|
||||||
#include "dir-item.h"
|
#include "dir-item.h"
|
||||||
|
|
||||||
int btrfs_getxattr(struct inode *inode, const char *name,
|
int btrfs_getxattr(const struct inode *inode, const char *name,
|
||||||
void *buffer, size_t size)
|
void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct btrfs_dir_item *di;
|
struct btrfs_dir_item *di;
|
||||||
|
@ -14,7 +14,7 @@ struct btrfs_trans_handle;
|
|||||||
|
|
||||||
extern const struct xattr_handler * const btrfs_xattr_handlers[];
|
extern const struct xattr_handler * const btrfs_xattr_handlers[];
|
||||||
|
|
||||||
int btrfs_getxattr(struct inode *inode, const char *name,
|
int btrfs_getxattr(const struct inode *inode, const char *name,
|
||||||
void *buffer, size_t size);
|
void *buffer, size_t size);
|
||||||
int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
|
int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
|
||||||
const char *name, const void *value, size_t size, int flags);
|
const char *name, const void *value, size_t size, int flags);
|
||||||
|
@ -767,7 +767,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info, unsigned long *mount_opt)
|
int btrfs_check_mountopts_zoned(const struct btrfs_fs_info *info, unsigned long *mount_opt)
|
||||||
{
|
{
|
||||||
if (!btrfs_is_zoned(info))
|
if (!btrfs_is_zoned(info))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -58,7 +58,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache);
|
|||||||
void btrfs_destroy_dev_zone_info(struct btrfs_device *device);
|
void btrfs_destroy_dev_zone_info(struct btrfs_device *device);
|
||||||
struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev);
|
struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev);
|
||||||
int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info);
|
int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info);
|
||||||
int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info, unsigned long *mount_opt);
|
int btrfs_check_mountopts_zoned(const struct btrfs_fs_info *info, unsigned long *mount_opt);
|
||||||
int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
|
int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
|
||||||
u64 *bytenr_ret);
|
u64 *bytenr_ret);
|
||||||
int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw,
|
int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw,
|
||||||
@ -129,7 +129,7 @@ static inline int btrfs_check_zoned_mode(const struct btrfs_fs_info *fs_info)
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info,
|
static inline int btrfs_check_mountopts_zoned(const struct btrfs_fs_info *info,
|
||||||
unsigned long *mount_opt)
|
unsigned long *mount_opt)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user