Commit b0496686 authored by Liu Bo's avatar Liu Bo Committed by Josef Bacik

Btrfs: cleanup unused arguments of btrfs_csum_data

Argument 'root' is no more used in btrfs_csum_data().
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 08748810
...@@ -106,7 +106,6 @@ static int check_compressed_csum(struct inode *inode, ...@@ -106,7 +106,6 @@ static int check_compressed_csum(struct inode *inode,
u64 disk_start) u64 disk_start)
{ {
int ret; int ret;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct page *page; struct page *page;
unsigned long i; unsigned long i;
char *kaddr; char *kaddr;
...@@ -121,7 +120,7 @@ static int check_compressed_csum(struct inode *inode, ...@@ -121,7 +120,7 @@ static int check_compressed_csum(struct inode *inode,
csum = ~(u32)0; csum = ~(u32)0;
kaddr = kmap_atomic(page); kaddr = kmap_atomic(page);
csum = btrfs_csum_data(root, kaddr, csum, PAGE_CACHE_SIZE); csum = btrfs_csum_data(kaddr, csum, PAGE_CACHE_SIZE);
btrfs_csum_final(csum, (char *)&csum); btrfs_csum_final(csum, (char *)&csum);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
......
...@@ -238,7 +238,7 @@ static struct extent_map *btree_get_extent(struct inode *inode, ...@@ -238,7 +238,7 @@ static struct extent_map *btree_get_extent(struct inode *inode,
return em; return em;
} }
u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len) u32 btrfs_csum_data(char *data, u32 seed, size_t len)
{ {
return crc32c(seed, data, len); return crc32c(seed, data, len);
} }
...@@ -274,7 +274,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, ...@@ -274,7 +274,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
if (err) if (err)
return 1; return 1;
cur_len = min(len, map_len - (offset - map_start)); cur_len = min(len, map_len - (offset - map_start));
crc = btrfs_csum_data(root, kaddr + offset - map_start, crc = btrfs_csum_data(kaddr + offset - map_start,
crc, cur_len); crc, cur_len);
len -= cur_len; len -= cur_len;
offset += cur_len; offset += cur_len;
...@@ -2919,7 +2919,7 @@ static int write_dev_supers(struct btrfs_device *device, ...@@ -2919,7 +2919,7 @@ static int write_dev_supers(struct btrfs_device *device,
btrfs_set_super_bytenr(sb, bytenr); btrfs_set_super_bytenr(sb, bytenr);
crc = ~(u32)0; crc = ~(u32)0;
crc = btrfs_csum_data(NULL, (char *)sb + crc = btrfs_csum_data((char *)sb +
BTRFS_CSUM_SIZE, crc, BTRFS_CSUM_SIZE, crc,
BTRFS_SUPER_INFO_SIZE - BTRFS_SUPER_INFO_SIZE -
BTRFS_CSUM_SIZE); BTRFS_CSUM_SIZE);
......
...@@ -77,7 +77,7 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, ...@@ -77,7 +77,7 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
int atomic); int atomic);
int btrfs_set_buffer_uptodate(struct extent_buffer *buf); int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); u32 btrfs_csum_data(char *data, u32 seed, size_t len);
void btrfs_csum_final(u32 crc, char *result); void btrfs_csum_final(u32 crc, char *result);
int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
int metadata); int metadata);
......
...@@ -484,8 +484,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, ...@@ -484,8 +484,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
data = kmap_atomic(bvec->bv_page); data = kmap_atomic(bvec->bv_page);
sector_sum->sum = ~(u32)0; sector_sum->sum = ~(u32)0;
sector_sum->sum = btrfs_csum_data(root, sector_sum->sum = btrfs_csum_data(data + bvec->bv_offset,
data + bvec->bv_offset,
sector_sum->sum, sector_sum->sum,
bvec->bv_len); bvec->bv_len);
kunmap_atomic(data); kunmap_atomic(data);
......
...@@ -431,7 +431,7 @@ static void io_ctl_set_crc(struct io_ctl *io_ctl, int index) ...@@ -431,7 +431,7 @@ static void io_ctl_set_crc(struct io_ctl *io_ctl, int index)
if (index == 0) if (index == 0)
offset = sizeof(u32) * io_ctl->num_pages; offset = sizeof(u32) * io_ctl->num_pages;
crc = btrfs_csum_data(io_ctl->root, io_ctl->orig + offset, crc, crc = btrfs_csum_data(io_ctl->orig + offset, crc,
PAGE_CACHE_SIZE - offset); PAGE_CACHE_SIZE - offset);
btrfs_csum_final(crc, (char *)&crc); btrfs_csum_final(crc, (char *)&crc);
io_ctl_unmap_page(io_ctl); io_ctl_unmap_page(io_ctl);
...@@ -461,7 +461,7 @@ static int io_ctl_check_crc(struct io_ctl *io_ctl, int index) ...@@ -461,7 +461,7 @@ static int io_ctl_check_crc(struct io_ctl *io_ctl, int index)
kunmap(io_ctl->pages[0]); kunmap(io_ctl->pages[0]);
io_ctl_map_page(io_ctl, 0); io_ctl_map_page(io_ctl, 0);
crc = btrfs_csum_data(io_ctl->root, io_ctl->orig + offset, crc, crc = btrfs_csum_data(io_ctl->orig + offset, crc,
PAGE_CACHE_SIZE - offset); PAGE_CACHE_SIZE - offset);
btrfs_csum_final(crc, (char *)&crc); btrfs_csum_final(crc, (char *)&crc);
if (val != crc) { if (val != crc) {
......
...@@ -2819,7 +2819,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end, ...@@ -2819,7 +2819,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
if (ret) if (ret)
goto zeroit; goto zeroit;
csum = btrfs_csum_data(root, kaddr + offset, csum, end - start + 1); csum = btrfs_csum_data(kaddr + offset, csum, end - start + 1);
btrfs_csum_final(csum, (char *)&csum); btrfs_csum_final(csum, (char *)&csum);
if (csum != private) if (csum != private)
goto zeroit; goto zeroit;
...@@ -6919,7 +6919,6 @@ static void btrfs_endio_direct_read(struct bio *bio, int err) ...@@ -6919,7 +6919,6 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1; struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1;
struct bio_vec *bvec = bio->bi_io_vec; struct bio_vec *bvec = bio->bi_io_vec;
struct inode *inode = dip->inode; struct inode *inode = dip->inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
u64 start; u64 start;
start = dip->logical_offset; start = dip->logical_offset;
...@@ -6936,7 +6935,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err) ...@@ -6936,7 +6935,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
goto failed; goto failed;
local_irq_save(flags); local_irq_save(flags);
kaddr = kmap_atomic(page); kaddr = kmap_atomic(page);
csum = btrfs_csum_data(root, kaddr + bvec->bv_offset, csum = btrfs_csum_data(kaddr + bvec->bv_offset,
csum, bvec->bv_len); csum, bvec->bv_len);
btrfs_csum_final(csum, (char *)&csum); btrfs_csum_final(csum, (char *)&csum);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
......
...@@ -1336,7 +1336,6 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info, ...@@ -1336,7 +1336,6 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info,
int page_num; int page_num;
u8 calculated_csum[BTRFS_CSUM_SIZE]; u8 calculated_csum[BTRFS_CSUM_SIZE];
u32 crc = ~(u32)0; u32 crc = ~(u32)0;
struct btrfs_root *root = fs_info->extent_root;
void *mapped_buffer; void *mapped_buffer;
WARN_ON(!sblock->pagev[0]->page); WARN_ON(!sblock->pagev[0]->page);
...@@ -1365,12 +1364,11 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info, ...@@ -1365,12 +1364,11 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info,
for (page_num = 0;;) { for (page_num = 0;;) {
if (page_num == 0 && is_metadata) if (page_num == 0 && is_metadata)
crc = btrfs_csum_data(root, crc = btrfs_csum_data(
((u8 *)mapped_buffer) + BTRFS_CSUM_SIZE, ((u8 *)mapped_buffer) + BTRFS_CSUM_SIZE,
crc, PAGE_SIZE - BTRFS_CSUM_SIZE); crc, PAGE_SIZE - BTRFS_CSUM_SIZE);
else else
crc = btrfs_csum_data(root, mapped_buffer, crc, crc = btrfs_csum_data(mapped_buffer, crc, PAGE_SIZE);
PAGE_SIZE);
kunmap_atomic(mapped_buffer); kunmap_atomic(mapped_buffer);
page_num++; page_num++;
...@@ -1657,7 +1655,6 @@ static int scrub_checksum_data(struct scrub_block *sblock) ...@@ -1657,7 +1655,6 @@ static int scrub_checksum_data(struct scrub_block *sblock)
void *buffer; void *buffer;
u32 crc = ~(u32)0; u32 crc = ~(u32)0;
int fail = 0; int fail = 0;
struct btrfs_root *root = sctx->dev_root;
u64 len; u64 len;
int index; int index;
...@@ -1674,7 +1671,7 @@ static int scrub_checksum_data(struct scrub_block *sblock) ...@@ -1674,7 +1671,7 @@ static int scrub_checksum_data(struct scrub_block *sblock)
for (;;) { for (;;) {
u64 l = min_t(u64, len, PAGE_SIZE); u64 l = min_t(u64, len, PAGE_SIZE);
crc = btrfs_csum_data(root, buffer, crc, l); crc = btrfs_csum_data(buffer, crc, l);
kunmap_atomic(buffer); kunmap_atomic(buffer);
len -= l; len -= l;
if (len == 0) if (len == 0)
...@@ -1744,7 +1741,7 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock) ...@@ -1744,7 +1741,7 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
for (;;) { for (;;) {
u64 l = min_t(u64, len, mapped_size); u64 l = min_t(u64, len, mapped_size);
crc = btrfs_csum_data(root, p, crc, l); crc = btrfs_csum_data(p, crc, l);
kunmap_atomic(mapped_buffer); kunmap_atomic(mapped_buffer);
len -= l; len -= l;
if (len == 0) if (len == 0)
...@@ -1805,7 +1802,7 @@ static int scrub_checksum_super(struct scrub_block *sblock) ...@@ -1805,7 +1802,7 @@ static int scrub_checksum_super(struct scrub_block *sblock)
for (;;) { for (;;) {
u64 l = min_t(u64, len, mapped_size); u64 l = min_t(u64, len, mapped_size);
crc = btrfs_csum_data(root, p, crc, l); crc = btrfs_csum_data(p, crc, l);
kunmap_atomic(mapped_buffer); kunmap_atomic(mapped_buffer);
len -= l; len -= l;
if (len == 0) if (len == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment