btrfs: rename btrfs_csum_file_blocks() to btrfs_insert_data_csums()

The function btrfs_csum_file_blocks() is a little confusing, unlike
btrfs_csum_one_bio(), it is not calculating the checksum of some file
blocks.

Instead it's just inserting the already calculated checksums into a given
root (can be a csum root or a log tree).

So rename it to btrfs_insert_data_csums() to reflect its behavior better.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo
2026-02-10 13:54:31 +10:30
committed by David Sterba
parent 00c865b60b
commit b943097758
4 changed files with 10 additions and 10 deletions

View File

@@ -1097,9 +1097,9 @@ static int find_next_csum_offset(struct btrfs_root *root,
return 0;
}
int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_ordered_sum *sums)
int btrfs_insert_data_csums(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_ordered_sum *sums)
{
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_key file_key;

View File

@@ -61,9 +61,9 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path, u64 objectid,
u64 bytenr, int mod);
int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_ordered_sum *sums);
int btrfs_insert_data_csums(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_ordered_sum *sums);
int btrfs_csum_one_bio(struct btrfs_bio *bbio, bool async);
int btrfs_alloc_dummy_sum(struct btrfs_bio *bbio);
int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,

View File

@@ -2770,7 +2770,7 @@ static int add_pending_csums(struct btrfs_trans_handle *trans,
}
}
trans->adding_csums = true;
ret = btrfs_csum_file_blocks(trans, csum_root, sum);
ret = btrfs_insert_data_csums(trans, csum_root, sum);
trans->adding_csums = false;
if (ret)
return ret;

View File

@@ -1003,7 +1003,7 @@ static noinline int replay_one_extent(struct walk_control *wc)
btrfs_root_id(root));
}
if (!ret) {
ret = btrfs_csum_file_blocks(trans, csum_root, sums);
ret = btrfs_insert_data_csums(trans, csum_root, sums);
if (ret)
btrfs_abort_log_replay(wc, ret,
"failed to add csums for range [%llu, %llu) inode %llu root %llu",
@@ -4740,7 +4740,7 @@ static int log_csums(struct btrfs_trans_handle *trans,
* worry about logging checksum items with overlapping ranges.
*/
if (inode->last_reflink_trans < trans->transid)
return btrfs_csum_file_blocks(trans, log_root, sums);
return btrfs_insert_data_csums(trans, log_root, sums);
/*
* Serialize logging for checksums. This is to avoid racing with the
@@ -4763,7 +4763,7 @@ static int log_csums(struct btrfs_trans_handle *trans,
*/
ret = btrfs_del_csums(trans, log_root, sums->logical, sums->len);
if (!ret)
ret = btrfs_csum_file_blocks(trans, log_root, sums);
ret = btrfs_insert_data_csums(trans, log_root, sums);
btrfs_unlock_extent(&log_root->log_csum_range, sums->logical, lock_end,
&cached_state);