Skip to content

Commit

Permalink
btrfs-progs: move btrfs_extref_hash() to hash.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lu Fengqi authored and kdave committed Oct 25, 2016
1 parent 876db7f commit 36d02f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 10 additions & 0 deletions hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions inode-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -184,12 +184,6 @@ struct btrfs_inode_ref *btrfs_lookup_inode_ref(struct btrfs_trans_handle *trans,
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)
Expand Down

0 comments on commit 36d02f3

Please sign in to comment.