btrfs: remove btrfs_crc32c wrapper
authorJosef Bacik <josef@toxicpanda.com>
Fri, 25 Aug 2023 20:19:20 +0000 (16:19 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 12 Oct 2023 14:44:02 +0000 (16:44 +0200)
This simply sends the same arguments into crc32c(), and is just used in
a few places.  Remove this wrapper and directly call crc32c() in these
instances.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/free-space-cache.c
fs/btrfs/send.c

index c80d9879d93135cf1597e3bc0045dacda9535ffa..bffee2ab5783689a0ca8c23855f061255db563e8 100644 (file)
@@ -470,11 +470,6 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
 #define BTRFS_BYTES_TO_BLKS(fs_info, bytes) \
                                ((bytes) >> (fs_info)->sectorsize_bits)
 
-static inline u32 btrfs_crc32c(u32 crc, const void *address, unsigned length)
-{
-       return crc32c(crc, address, length);
-}
-
 static inline u64 btrfs_name_hash(const char *name, int len)
 {
        return crc32c((u32)~1, name, len);
index fc313fce5bbdc7d9e5e2a7994b7e3ba0ab12105a..6bd549cbf1433e696b9a9952505d1d1512d163a3 100644 (file)
@@ -399,11 +399,11 @@ u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset)
        __le64 lenum;
 
        lenum = cpu_to_le64(root_objectid);
-       high_crc = btrfs_crc32c(high_crc, &lenum, sizeof(lenum));
+       high_crc = crc32c(high_crc, &lenum, sizeof(lenum));
        lenum = cpu_to_le64(owner);
-       low_crc = btrfs_crc32c(low_crc, &lenum, sizeof(lenum));
+       low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
        lenum = cpu_to_le64(offset);
-       low_crc = btrfs_crc32c(low_crc, &lenum, sizeof(lenum));
+       low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
 
        return ((u64)high_crc << 31) ^ (u64)low_crc;
 }
index a4e023a9383db8b76dc1abee240fb878720a78f6..f61afe4046f7e33a5ff4809b46be577b812a6f0c 100644 (file)
@@ -545,7 +545,7 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index)
        if (index == 0)
                offset = sizeof(u32) * io_ctl->num_pages;
 
-       crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
+       crc = crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
        btrfs_crc32c_final(crc, (u8 *)&crc);
        io_ctl_unmap_page(io_ctl);
        tmp = page_address(io_ctl->pages[0]);
@@ -567,7 +567,7 @@ static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index)
        val = *tmp;
 
        io_ctl_map_page(io_ctl, 0);
-       crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
+       crc = crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
        btrfs_crc32c_final(crc, (u8 *)&crc);
        if (val != crc) {
                btrfs_err_rl(io_ctl->fs_info,
index 3a566150c531aa4578c25bbca5723d295582ee1a..3b929f0e8f04f44ccb718d5c17d5910e7a8c7c85 100644 (file)
@@ -796,7 +796,7 @@ static int send_cmd(struct send_ctx *sctx)
        put_unaligned_le32(sctx->send_size - sizeof(*hdr), &hdr->len);
        put_unaligned_le32(0, &hdr->crc);
 
-       crc = btrfs_crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size);
+       crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size);
        put_unaligned_le32(crc, &hdr->crc);
 
        ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
@@ -5669,8 +5669,8 @@ static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
        hdr = (struct btrfs_cmd_header *)sctx->send_buf;
        hdr->len = cpu_to_le32(sctx->send_size + disk_num_bytes - sizeof(*hdr));
        hdr->crc = 0;
-       crc = btrfs_crc32c(0, sctx->send_buf, sctx->send_size);
-       crc = btrfs_crc32c(crc, sctx->send_buf + data_offset, disk_num_bytes);
+       crc = crc32c(0, sctx->send_buf, sctx->send_size);
+       crc = crc32c(crc, sctx->send_buf + data_offset, disk_num_bytes);
        hdr->crc = cpu_to_le32(crc);
 
        ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,