@@ -299,7 +299,7 @@ static int update_backref_cache(struct btrfs_trans_handle *trans,
299299 return 1 ;
300300}
301301
302- static bool reloc_root_is_dead (struct btrfs_root * root )
302+ static bool reloc_root_is_dead (const struct btrfs_root * root )
303303{
304304 /*
305305 * Pair with set_bit/clear_bit in clean_dirty_subvols and
@@ -320,7 +320,7 @@ static bool reloc_root_is_dead(struct btrfs_root *root)
320320 * from no reloc root. But btrfs_should_ignore_reloc_root() below is a
321321 * special case.
322322 */
323- static bool have_reloc_root (struct btrfs_root * root )
323+ static bool have_reloc_root (const struct btrfs_root * root )
324324{
325325 if (reloc_root_is_dead (root ))
326326 return false;
@@ -329,7 +329,7 @@ static bool have_reloc_root(struct btrfs_root *root)
329329 return true;
330330}
331331
332- bool btrfs_should_ignore_reloc_root (struct btrfs_root * root )
332+ bool btrfs_should_ignore_reloc_root (const struct btrfs_root * root )
333333{
334334 struct btrfs_root * reloc_root ;
335335
@@ -546,7 +546,7 @@ static noinline_for_stack struct btrfs_backref_node *build_backref_tree(
546546 */
547547static int clone_backref_node (struct btrfs_trans_handle * trans ,
548548 struct reloc_control * rc ,
549- struct btrfs_root * src ,
549+ const struct btrfs_root * src ,
550550 struct btrfs_root * dest )
551551{
552552 struct btrfs_root * reloc_root = src -> reloc_root ;
@@ -1186,9 +1186,9 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
11861186 return ret ;
11871187}
11881188
1189- static noinline_for_stack
1190- int memcmp_node_keys ( struct extent_buffer * eb , int slot ,
1191- struct btrfs_path * path , int level )
1189+ static noinline_for_stack int memcmp_node_keys ( const struct extent_buffer * eb ,
1190+ int slot , const struct btrfs_path * path ,
1191+ int level )
11921192{
11931193 struct btrfs_disk_key key1 ;
11941194 struct btrfs_disk_key key2 ;
@@ -1517,8 +1517,8 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
15171517 * [min_key, max_key)
15181518 */
15191519static int invalidate_extent_cache (struct btrfs_root * root ,
1520- struct btrfs_key * min_key ,
1521- struct btrfs_key * max_key )
1520+ const struct btrfs_key * min_key ,
1521+ const struct btrfs_key * max_key )
15221522{
15231523 struct btrfs_fs_info * fs_info = root -> fs_info ;
15241524 struct inode * inode = NULL ;
@@ -2829,7 +2829,7 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
28292829
28302830static noinline_for_stack int prealloc_file_extent_cluster (
28312831 struct btrfs_inode * inode ,
2832- struct file_extent_cluster * cluster )
2832+ const struct file_extent_cluster * cluster )
28332833{
28342834 u64 alloc_hint = 0 ;
28352835 u64 start ;
@@ -2964,15 +2964,15 @@ static noinline_for_stack int setup_relocation_extent_mapping(struct inode *inod
29642964/*
29652965 * Allow error injection to test balance/relocation cancellation
29662966 */
2967- noinline int btrfs_should_cancel_balance (struct btrfs_fs_info * fs_info )
2967+ noinline int btrfs_should_cancel_balance (const struct btrfs_fs_info * fs_info )
29682968{
29692969 return atomic_read (& fs_info -> balance_cancel_req ) ||
29702970 atomic_read (& fs_info -> reloc_cancel_req ) ||
29712971 fatal_signal_pending (current );
29722972}
29732973ALLOW_ERROR_INJECTION (btrfs_should_cancel_balance , TRUE);
29742974
2975- static u64 get_cluster_boundary_end (struct file_extent_cluster * cluster ,
2975+ static u64 get_cluster_boundary_end (const struct file_extent_cluster * cluster ,
29762976 int cluster_nr )
29772977{
29782978 /* Last extent, use cluster end directly */
@@ -2984,7 +2984,7 @@ static u64 get_cluster_boundary_end(struct file_extent_cluster *cluster,
29842984}
29852985
29862986static int relocate_one_page (struct inode * inode , struct file_ra_state * ra ,
2987- struct file_extent_cluster * cluster ,
2987+ const struct file_extent_cluster * cluster ,
29882988 int * cluster_nr , unsigned long page_index )
29892989{
29902990 struct btrfs_fs_info * fs_info = btrfs_sb (inode -> i_sb );
@@ -3119,7 +3119,7 @@ static int relocate_one_page(struct inode *inode, struct file_ra_state *ra,
31193119}
31203120
31213121static int relocate_file_extent_cluster (struct inode * inode ,
3122- struct file_extent_cluster * cluster )
3122+ const struct file_extent_cluster * cluster )
31233123{
31243124 u64 offset = BTRFS_I (inode )-> index_cnt ;
31253125 unsigned long index ;
@@ -3157,9 +3157,9 @@ static int relocate_file_extent_cluster(struct inode *inode,
31573157 return ret ;
31583158}
31593159
3160- static noinline_for_stack
3161- int relocate_data_extent ( struct inode * inode , struct btrfs_key * extent_key ,
3162- struct file_extent_cluster * cluster )
3160+ static noinline_for_stack int relocate_data_extent ( struct inode * inode ,
3161+ const struct btrfs_key * extent_key ,
3162+ struct file_extent_cluster * cluster )
31633163{
31643164 int ret ;
31653165
@@ -3192,7 +3192,7 @@ int relocate_data_extent(struct inode *inode, struct btrfs_key *extent_key,
31923192 * the major work is getting the generation and level of the block
31933193 */
31943194static int add_tree_block (struct reloc_control * rc ,
3195- struct btrfs_key * extent_key ,
3195+ const struct btrfs_key * extent_key ,
31963196 struct btrfs_path * path ,
31973197 struct rb_root * blocks )
31983198{
@@ -3443,11 +3443,10 @@ static int delete_v1_space_cache(struct extent_buffer *leaf,
34433443/*
34443444 * helper to find all tree blocks that reference a given data extent
34453445 */
3446- static noinline_for_stack
3447- int add_data_references (struct reloc_control * rc ,
3448- struct btrfs_key * extent_key ,
3449- struct btrfs_path * path ,
3450- struct rb_root * blocks )
3446+ static noinline_for_stack int add_data_references (struct reloc_control * rc ,
3447+ const struct btrfs_key * extent_key ,
3448+ struct btrfs_path * path ,
3449+ struct rb_root * blocks )
34513450{
34523451 struct btrfs_backref_walk_ctx ctx = { 0 };
34533452 struct ulist_iterator leaf_uiter ;
@@ -3873,9 +3872,9 @@ static void delete_orphan_inode(struct btrfs_trans_handle *trans,
38733872 * helper to create inode for data relocation.
38743873 * the inode is in data relocation tree and its link count is 0
38753874 */
3876- static noinline_for_stack
3877- struct inode * create_reloc_inode ( struct btrfs_fs_info * fs_info ,
3878- struct btrfs_block_group * group )
3875+ static noinline_for_stack struct inode * create_reloc_inode (
3876+ struct btrfs_fs_info * fs_info ,
3877+ const struct btrfs_block_group * group )
38793878{
38803879 struct inode * inode = NULL ;
38813880 struct btrfs_trans_handle * trans ;
@@ -4421,7 +4420,8 @@ int btrfs_reloc_clone_csums(struct btrfs_ordered_extent *ordered)
44214420}
44224421
44234422int btrfs_reloc_cow_block (struct btrfs_trans_handle * trans ,
4424- struct btrfs_root * root , struct extent_buffer * buf ,
4423+ struct btrfs_root * root ,
4424+ const struct extent_buffer * buf ,
44254425 struct extent_buffer * cow )
44264426{
44274427 struct btrfs_fs_info * fs_info = root -> fs_info ;
@@ -4560,7 +4560,7 @@ int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans,
45604560 *
45614561 * Return U64_MAX if no running relocation.
45624562 */
4563- u64 btrfs_get_reloc_bg_bytenr (struct btrfs_fs_info * fs_info )
4563+ u64 btrfs_get_reloc_bg_bytenr (const struct btrfs_fs_info * fs_info )
45644564{
45654565 u64 logical = U64_MAX ;
45664566
0 commit comments