diff --git a/check/main.c b/check/main.c index 788a6f0e..49bdbfec 100644 --- a/check/main.c +++ b/check/main.c @@ -40,7 +40,6 @@ #include "common/rbtree-utils.h" #include "backref.h" #include "kernel-shared/ulist.h" -#include "hash.h" #include "common/help.h" #include "check/common.h" #include "check/mode-common.h" diff --git a/check/mode-common.c b/check/mode-common.c index 9e81082b..8fe1ea8e 100644 --- a/check/mode-common.c +++ b/check/mode-common.c @@ -16,7 +16,6 @@ #include #include "ctree.h" -#include "hash.h" #include "common/internal.h" #include "common/messages.h" #include "transaction.h" diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 630fabf6..0011284f 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -21,7 +21,6 @@ #include "common/messages.h" #include "disk-io.h" #include "backref.h" -#include "hash.h" #include "common/internal.h" #include "common/utils.h" #include "volumes.h" diff --git a/ctree.h b/ctree.h index b44fdd5a..36f62732 100644 --- a/ctree.h +++ b/ctree.h @@ -29,6 +29,7 @@ #include "extent_io.h" #include "ioctl.h" #include "kernel-lib/sizes.h" +#include "crypto/crc32c.h" #else #include #include @@ -37,6 +38,7 @@ #include #include #include +#include "btrfs/crc32c.h" #endif /* BTRFS_FLAT_INCLUDES */ struct btrfs_root; @@ -2510,6 +2512,20 @@ static inline int __btrfs_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag) ((unsigned long)(btrfs_leaf_data(leaf) + \ btrfs_item_offset_nr(leaf, slot))) +static inline u64 btrfs_name_hash(const char *name, int len) +{ + return crc32c((u32)~1, name, len); +} + +/* + * Figure the key offset of an extended inode ref + */ +static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name, + int len) +{ + return (u64)btrfs_crc32c(parent_objectid, name, len); +} + /* extent-tree.c */ int btrfs_reserve_extent(struct btrfs_trans_handle *trans, struct btrfs_root *root, diff --git a/dir-item.c b/dir-item.c index fa69dd1d..c8a5a354 100644 --- a/dir-item.c +++ b/dir-item.c @@ -19,7 +19,6 @@ #include #include "ctree.h" #include "disk-io.h" -#include "hash.h" #include "transaction.h" static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle diff --git a/hash.h b/hash.h deleted file mode 100644 index 51e84204..00000000 --- a/hash.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2007 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_HASH_H__ -#define __BTRFS_HASH_H__ - -#include "crypto/crc32c.h" - -static inline u64 btrfs_name_hash(const char *name, int len) -{ - return crc32c((u32)~1, name, len); -} - -/* - * Figure the key offset of an extended inode ref - */ -static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name, - int len) -{ - return (u64)btrfs_crc32c(parent_objectid, name, len); -} - -#endif diff --git a/inode-item.c b/inode-item.c index 1cc10667..aef1a235 100644 --- a/inode-item.c +++ b/inode-item.c @@ -19,7 +19,6 @@ #include "ctree.h" #include "disk-io.h" #include "transaction.h" -#include "hash.h" static int find_name_in_backref(struct btrfs_path *path, const char * name, int name_len, struct btrfs_inode_ref **ref_ret)