mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-07 01:31:17 +00:00
btrfs-progs: move name hashing functions to ctree.h and delete hash.h
The two functions are trivial and kernel has them in ctree.h, so do the same and remove hash.h. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
35ba1f5fb6
commit
2efe160bc7
@ -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"
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <time.h>
|
||||
#include "ctree.h"
|
||||
#include "hash.h"
|
||||
#include "common/internal.h"
|
||||
#include "common/messages.h"
|
||||
#include "transaction.h"
|
||||
|
@ -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"
|
||||
|
16
ctree.h
16
ctree.h
@ -29,6 +29,7 @@
|
||||
#include "extent_io.h"
|
||||
#include "ioctl.h"
|
||||
#include "kernel-lib/sizes.h"
|
||||
#include "crypto/crc32c.h"
|
||||
#else
|
||||
#include <btrfs/list.h>
|
||||
#include <btrfs/kerncompat.h>
|
||||
@ -37,6 +38,7 @@
|
||||
#include <btrfs/extent_io.h>
|
||||
#include <btrfs/ioctl.h>
|
||||
#include <btrfs/sizes.h>
|
||||
#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,
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <linux/limits.h>
|
||||
#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
|
||||
|
38
hash.h
38
hash.h
@ -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
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user