]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: rename btrfs_csum_file_blocks() to btrfs_insert_data_csums()
authorQu Wenruo <wqu@suse.com>
Tue, 10 Feb 2026 03:24:31 +0000 (13:54 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:55:56 +0000 (18:55 +0200)
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>
fs/btrfs/file-item.c
fs/btrfs/file-item.h
fs/btrfs/inode.c
fs/btrfs/tree-log.c

index ed8ecf44fbd0d7b3c9fc8ea567fbee15e73a0c9a..d72249390030f490002c78512a8bd386e3a282ce 100644 (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;
index 5645c5e3abdb795c2f76bb50a691d5a18898609a..6c678787c7701dcad1edf3b269111074f4b4feff 100644 (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,
index 1f38dcc635e34bb999e9e8887637c7ece4f852b4..47318fce7a9edd8aa4cc1d860c161126f21972c4 100644 (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;
index 84ca9837fb662a670c0fa9f664ca8da3ccb979bb..340f572c357d04f2d2992922173f63b7ecf639a2 100644 (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);