提交 163e783e 编写于 作者: D David Woodhouse 提交者: Chris Mason

Btrfs: remove crc32c.h and use libcrc32c directly.

There's no need to preserve this abstraction; it used to let us use
hardware crc32c support directly, but libcrc32c is already doing that for us
through the crypto API -- so we're already using the Intel crc32c
acceleration where appropriate.
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 6cbff00f
/*
* Copyright (C) 2008 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License v2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*/
#ifndef __BTRFS_CRC32C__
#define __BTRFS_CRC32C__
#include <linux/crc32c.h>
/*
* this file used to do more for selecting the HW version of crc32c,
* perhaps it will one day again soon.
*/
#define btrfs_crc32c(seed, data, length) crc32c(seed, data, length)
#endif
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#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 "compat.h" #include "compat.h"
#include "crc32c.h"
#include "ctree.h" #include "ctree.h"
#include "disk-io.h" #include "disk-io.h"
#include "transaction.h" #include "transaction.h"
...@@ -171,7 +171,7 @@ static struct extent_map *btree_get_extent(struct inode *inode, ...@@ -171,7 +171,7 @@ static struct extent_map *btree_get_extent(struct inode *inode,
u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len) u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
{ {
return btrfs_crc32c(seed, data, len); return crc32c(seed, data, len);
} }
void btrfs_csum_final(u32 crc, char *result) void btrfs_csum_final(u32 crc, char *result)
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include "compat.h" #include "compat.h"
#include "hash.h" #include "hash.h"
#include "crc32c.h"
#include "ctree.h" #include "ctree.h"
#include "disk-io.h" #include "disk-io.h"
#include "print-tree.h" #include "print-tree.h"
...@@ -625,11 +624,11 @@ static u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset) ...@@ -625,11 +624,11 @@ static u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset)
__le64 lenum; __le64 lenum;
lenum = cpu_to_le64(root_objectid); 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); 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); 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; return ((u64)high_crc << 31) ^ (u64)low_crc;
} }
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
#ifndef __HASH__ #ifndef __HASH__
#define __HASH__ #define __HASH__
#include "crc32c.h" #include <linux/crc32c.h>
static inline u64 btrfs_name_hash(const char *name, int len) static inline u64 btrfs_name_hash(const char *name, int len)
{ {
return btrfs_crc32c((u32)~1, name, len); return crc32c((u32)~1, name, len);
} }
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册