提交 0b947aff 编写于 作者: F Filipe David Borba Manana 提交者: Chris Mason

Btrfs: use btrfs_crc32c everywhere instead of libcrc32c

After the commit titled "Btrfs: fix btrfs boot when compiled as built-in",
LIBCRC32C requirement was removed from btrfs' Kconfig. This made it not
possible to build a kernel with btrfs enabled (either as module or built-in)
if libcrc32c is not enabled as well. So just replace all uses of libcrc32c
with the equivalent function in btrfs hash.h - btrfs_crc32c.
Signed-off-by: NFilipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 8101c8db
...@@ -92,11 +92,11 @@ ...@@ -92,11 +92,11 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/crc32c.h>
#include <linux/genhd.h> #include <linux/genhd.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include "ctree.h" #include "ctree.h"
#include "disk-io.h" #include "disk-io.h"
#include "hash.h"
#include "transaction.h" #include "transaction.h"
#include "extent_io.h" #include "extent_io.h"
#include "volumes.h" #include "volumes.h"
...@@ -1823,7 +1823,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state, ...@@ -1823,7 +1823,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state,
size_t sublen = i ? PAGE_CACHE_SIZE : size_t sublen = i ? PAGE_CACHE_SIZE :
(PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE); (PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE);
crc = crc32c(crc, data, sublen); crc = btrfs_crc32c(crc, data, sublen);
} }
btrfs_csum_final(crc, csum); btrfs_csum_final(crc, csum);
if (memcmp(csum, h->csum, state->csum_size)) if (memcmp(csum, h->csum, state->csum_size))
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/crc32c.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/migrate.h> #include <linux/migrate.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "ctree.h" #include "ctree.h"
#include "disk-io.h" #include "disk-io.h"
#include "hash.h"
#include "transaction.h" #include "transaction.h"
#include "btrfs_inode.h" #include "btrfs_inode.h"
#include "volumes.h" #include "volumes.h"
...@@ -244,7 +244,7 @@ static struct extent_map *btree_get_extent(struct inode *inode, ...@@ -244,7 +244,7 @@ static struct extent_map *btree_get_extent(struct inode *inode,
u32 btrfs_csum_data(char *data, u32 seed, size_t len) u32 btrfs_csum_data(char *data, u32 seed, size_t len)
{ {
return crc32c(seed, data, len); return btrfs_crc32c(seed, data, len);
} }
void btrfs_csum_final(u32 crc, char *result) void btrfs_csum_final(u32 crc, char *result)
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/posix_acl_xattr.h> #include <linux/posix_acl_xattr.h>
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/crc32c.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/string.h> #include <linux/string.h>
#include "send.h" #include "send.h"
#include "backref.h" #include "backref.h"
#include "hash.h"
#include "locking.h" #include "locking.h"
#include "disk-io.h" #include "disk-io.h"
#include "btrfs_inode.h" #include "btrfs_inode.h"
...@@ -620,7 +620,7 @@ static int send_cmd(struct send_ctx *sctx) ...@@ -620,7 +620,7 @@ static int send_cmd(struct send_ctx *sctx)
hdr->len = cpu_to_le32(sctx->send_size - sizeof(*hdr)); hdr->len = cpu_to_le32(sctx->send_size - sizeof(*hdr));
hdr->crc = 0; hdr->crc = 0;
crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size); crc = btrfs_crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size);
hdr->crc = cpu_to_le32(crc); hdr->crc = cpu_to_le32(crc);
ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size, ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册