Skip to content

Commit 6f5b0b1

Browse files
adam900710kdave
authored andcommitted
btrfs-progs: remove the unused fs_info parameter for btrfs_csum_data()
The parameter @fs_info is not utilized at all, and there are already several call sites passing NULL as @fs_info. And there is no counter-part in kernel (we use crypto_shash_* interface instead), there is no need to keep the parameter list the same. So just remove the unused parameter. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 4300a9e commit 6f5b0b1

File tree

10 files changed

+18
-23
lines changed

10 files changed

+18
-23
lines changed

check/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5831,7 +5831,7 @@ static int check_extent_csums(struct btrfs_root *root, u64 bytenr,
58315831
while (data_checked < read_len) {
58325832
tmp = offset + data_checked;
58335833

5834-
btrfs_csum_data(gfs_info, csum_type, data + tmp,
5834+
btrfs_csum_data(csum_type, data + tmp,
58355835
result, gfs_info->sectorsize);
58365836

58375837
csum_offset = leaf_offset +

cmds/rescue-chunk-recover.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ static int check_one_csum(int fd, u64 start, u32 len, u32 tree_csum,
18961896
}
18971897
ret = 0;
18981898
put_unaligned_le32(tree_csum, expected_csum);
1899-
btrfs_csum_data(NULL, csum_type, (u8 *)data, result, len);
1899+
btrfs_csum_data(csum_type, (u8 *)data, result, len);
19001900
if (memcmp(result, expected_csum, csum_size) != 0)
19011901
ret = 1;
19021902
out:

cmds/rescue-fix-data-checksum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static int verify_one_data_block(struct btrfs_fs_info *fs_info,
136136
break;
137137
}
138138
/* Verify the data checksum. */
139-
btrfs_csum_data(fs_info, fs_info->csum_type, buf, csum, blocksize);
139+
btrfs_csum_data(fs_info->csum_type, buf, csum, blocksize);
140140
read_extent_buffer(leaf, csum_expected, leaf_offset, csum_size);
141141
if (memcmp(csum_expected, csum, csum_size) != 0) {
142142
ret = add_corrupted_block(fs_info, logical, mirror, num_mirrors);
@@ -365,7 +365,7 @@ static int update_csum_item(struct btrfs_fs_info *fs_info, u64 logical,
365365
btrfs_abort_transaction(trans, ret);
366366
goto out;
367367
}
368-
btrfs_csum_data(fs_info, fs_info->csum_type, buf, csum, fs_info->sectorsize);
368+
btrfs_csum_data(fs_info->csum_type, buf, csum, fs_info->sectorsize);
369369
write_extent_buffer(path.nodes[0], csum, (unsigned long)citem, fs_info->csum_size);
370370
btrfs_release_path(&path);
371371
ret = btrfs_commit_transaction(trans, csum_root);

convert/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static inline int write_temp_super(int fd, struct btrfs_super_block *sb,
8080
u16 csum_type = btrfs_super_csum_type(sb);
8181
int ret;
8282

83-
btrfs_csum_data(NULL, csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
83+
btrfs_csum_data(csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
8484
result, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
8585
memcpy(&sb->csum[0], result, BTRFS_CSUM_SIZE);
8686
ret = pwrite(fd, sb, BTRFS_SUPER_INFO_SIZE, sb_bytenr);

convert/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ static int migrate_super_block(int fd, u64 old_bytenr)
10601060
BUG_ON(btrfs_super_bytenr(&super) != old_bytenr);
10611061
btrfs_set_super_bytenr(&super, BTRFS_SUPER_INFO_OFFSET);
10621062

1063-
btrfs_csum_data(NULL, btrfs_super_csum_type(&super),
1063+
btrfs_csum_data(btrfs_super_csum_type(&super),
10641064
(u8 *)&super + BTRFS_CSUM_SIZE, result,
10651065
BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
10661066
memcpy(&super.csum[0], result, BTRFS_CSUM_SIZE);

kernel-shared/disk-io.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ static void print_tree_block_error(struct btrfs_fs_info *fs_info,
162162
}
163163
}
164164

165-
int btrfs_csum_data(struct btrfs_fs_info *fs_info, u16 csum_type, const u8 *data,
166-
u8 *out, size_t len)
165+
int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len)
167166
{
168167
memset(out, 0, BTRFS_CSUM_SIZE);
169168

@@ -191,8 +190,7 @@ static int __csum_tree_block_size(struct extent_buffer *buf, u16 csum_size,
191190
u32 len;
192191

193192
len = buf->len - BTRFS_CSUM_SIZE;
194-
btrfs_csum_data(buf->fs_info, csum_type, (u8 *)buf->data + BTRFS_CSUM_SIZE,
195-
result, len);
193+
btrfs_csum_data(csum_type, (u8 *)buf->data + BTRFS_CSUM_SIZE, result, len);
196194

197195
if (verify) {
198196
if (buf->fs_info && buf->fs_info->skip_csum_check) {
@@ -1770,7 +1768,7 @@ int btrfs_check_super(struct btrfs_super_block *sb, unsigned sbflags)
17701768
}
17711769
csum_size = btrfs_super_csum_size(sb);
17721770

1773-
btrfs_csum_data(NULL, csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
1771+
btrfs_csum_data(csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
17741772
result, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
17751773

17761774
if (memcmp(result, sb->csum, csum_size)) {
@@ -2028,7 +2026,7 @@ static int write_dev_supers(struct btrfs_fs_info *fs_info,
20282026
}
20292027
if (fs_info->super_bytenr != BTRFS_SUPER_INFO_OFFSET) {
20302028
btrfs_set_super_bytenr(sb, fs_info->super_bytenr);
2031-
btrfs_csum_data(fs_info, csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
2029+
btrfs_csum_data(csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
20322030
result, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
20332031
memcpy(&sb->csum[0], result, BTRFS_CSUM_SIZE);
20342032

@@ -2061,7 +2059,7 @@ static int write_dev_supers(struct btrfs_fs_info *fs_info,
20612059

20622060
btrfs_set_super_bytenr(sb, bytenr);
20632061

2064-
btrfs_csum_data(fs_info, csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
2062+
btrfs_csum_data(csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
20652063
result, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
20662064
memcpy(&sb->csum[0], result, BTRFS_CSUM_SIZE);
20672065

kernel-shared/disk-io.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf);
223223
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
224224
int atomic);
225225
int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
226-
int btrfs_csum_data(struct btrfs_fs_info *fs_info, u16 csum_type, const u8 *data,
227-
u8 *out, size_t len);
226+
int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len);
228227

229228
int btrfs_open_device(struct btrfs_device *dev);
230229
int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize,

kernel-shared/file-item.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, u64 logical,
298298
item = (struct btrfs_csum_item *)((unsigned char *)item +
299299
csum_offset * csum_size);
300300
found:
301-
btrfs_csum_data(root->fs_info, csum_type, (u8 *)data, csum_result,
302-
sectorsize);
301+
btrfs_csum_data(csum_type, (u8 *)data, csum_result, sectorsize);
303302
write_extent_buffer(leaf, csum_result, (unsigned long)item,
304303
csum_size);
305304
btrfs_mark_buffer_dirty(path->nodes[0]);

kernel-shared/print-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ static void print_header_info(struct extent_buffer *eb, unsigned int mode)
13921392
printf("%02hhx", (int)(eb->data[i]));
13931393
printf("\n");
13941394
memset(csum, 0, sizeof(csum));
1395-
btrfs_csum_data(fs_info, btrfs_super_csum_type(fs_info->super_copy),
1395+
btrfs_csum_data(btrfs_super_csum_type(fs_info->super_copy),
13961396
(u8 *)eb->data + BTRFS_CSUM_SIZE,
13971397
csum, fs_info->nodesize - BTRFS_CSUM_SIZE);
13981398
printf("checksum calced ");
@@ -1902,7 +1902,7 @@ static int check_csum_sblock(void *sb, int csum_size, u16 csum_type)
19021902
{
19031903
u8 result[BTRFS_CSUM_SIZE];
19041904

1905-
btrfs_csum_data(NULL, csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
1905+
btrfs_csum_data(csum_type, (u8 *)sb + BTRFS_CSUM_SIZE,
19061906
result, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE);
19071907

19081908
return !memcmp(sb, result, csum_size);

tune/change-csum.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ static int read_verify_one_data_sector(struct btrfs_fs_info *fs_info,
158158
error("failed to read logical %llu: %m", logical);
159159
continue;
160160
}
161-
btrfs_csum_data(fs_info, fs_info->csum_type, data_buf, csum_has,
162-
sectorsize);
161+
btrfs_csum_data(fs_info->csum_type, data_buf, csum_has, sectorsize);
163162
if (memcmp(csum_has, old_csums, fs_info->csum_size) == 0) {
164163
found_good = true;
165164
break;
@@ -577,9 +576,9 @@ static int rewrite_tree_block_csum(struct btrfs_fs_info *fs_info, u64 logical,
577576
}
578577

579578
/* Verify the csum first. */
580-
btrfs_csum_data(fs_info, fs_info->csum_type, (u8 *)eb->data + BTRFS_CSUM_SIZE,
579+
btrfs_csum_data(fs_info->csum_type, (u8 *)eb->data + BTRFS_CSUM_SIZE,
581580
result_old, fs_info->nodesize - BTRFS_CSUM_SIZE);
582-
btrfs_csum_data(fs_info, new_csum_type, (u8 *)eb->data + BTRFS_CSUM_SIZE,
581+
btrfs_csum_data(new_csum_type, (u8 *)eb->data + BTRFS_CSUM_SIZE,
583582
result_new, fs_info->nodesize - BTRFS_CSUM_SIZE);
584583

585584
/* Matches old csum, rewrite. */

0 commit comments

Comments
 (0)