btrfs-progs: move btrfs_extref_hash() to hash.h

Move btrfs_extref_hash() from inode-item.c to hash.h,
so that the function can be called elsewhere.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
This commit is contained in:
Lu Fengqi 2016-07-15 11:00:28 +08:00 committed by David Sterba
parent 876db7f50c
commit 36d02f3eb8
2 changed files with 11 additions and 7 deletions

10
hash.h
View File

@ -25,4 +25,14 @@ 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

View File

@ -19,7 +19,7 @@
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
#include "crc32c.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)
@ -184,12 +184,6 @@ out:
return ret_inode_ref;
}
static inline u64 btrfs_extref_hash(u64 parent_ino, const char *name,
int namelen)
{
return (u64)btrfs_crc32c(parent_ino, name, namelen);
}
static int btrfs_find_name_in_ext_backref(struct btrfs_path *path,
u64 parent_ino, const char *name, int namelen,
struct btrfs_inode_extref **extref_ret)