mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-12-01 08:04:28 +08:00
btrfs-progs: inline btrfs_name_hash and btrfs_extref_hash
This is the opposite of what we do in the kernel, however in the kernel we put the helpers in dir-item.h and inode-item.h respectively. Those do not exist in btrfs-progs right now, so instead of doing all that work right now simply inline them in ctree.h to make it easier to sync ctree.c from the kernel. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f4e16e0238
commit
692b68110e
@ -24,7 +24,6 @@
|
|||||||
#include "kernel-shared/print-tree.h"
|
#include "kernel-shared/print-tree.h"
|
||||||
#include "kernel-shared/tree-checker.h"
|
#include "kernel-shared/tree-checker.h"
|
||||||
#include "kernel-shared/volumes.h"
|
#include "kernel-shared/volumes.h"
|
||||||
#include "crypto/crc32c.h"
|
|
||||||
#include "common/internal.h"
|
#include "common/internal.h"
|
||||||
#include "common/messages.h"
|
#include "common/messages.h"
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
@ -188,19 +187,6 @@ u16 btrfs_csum_type_size(u16 csum_type)
|
|||||||
return btrfs_csums[csum_type].size;
|
return btrfs_csums[csum_type].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 btrfs_name_hash(const char *name, int len)
|
|
||||||
{
|
|
||||||
return crc32c((u32)~1, name, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Figure the key offset of an extended inode ref
|
|
||||||
*/
|
|
||||||
u64 btrfs_extref_hash(u64 parent_objectid, const char *name, int len)
|
|
||||||
{
|
|
||||||
return (u64)crc32c(parent_objectid, name, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct btrfs_path *btrfs_alloc_path(void)
|
struct btrfs_path *btrfs_alloc_path(void)
|
||||||
{
|
{
|
||||||
might_sleep();
|
might_sleep();
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "kernel-lib/rbtree.h"
|
#include "kernel-lib/rbtree.h"
|
||||||
#include "kerncompat.h"
|
#include "kerncompat.h"
|
||||||
#include "common/extent-cache.h"
|
#include "common/extent-cache.h"
|
||||||
|
#include "crypto/crc32c.h"
|
||||||
#include "kernel-shared/uapi/btrfs.h"
|
#include "kernel-shared/uapi/btrfs.h"
|
||||||
#include "kernel-shared/uapi/btrfs_tree.h"
|
#include "kernel-shared/uapi/btrfs_tree.h"
|
||||||
#include "kernel-shared/extent_io.h"
|
#include "kernel-shared/extent_io.h"
|
||||||
@ -875,8 +876,19 @@ static inline int __btrfs_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag)
|
|||||||
return !!(btrfs_super_compat_ro_flags(disk_super) & flag);
|
return !!(btrfs_super_compat_ro_flags(disk_super) & flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 btrfs_name_hash(const char *name, int len);
|
static inline u64 btrfs_name_hash(const char *name, int len)
|
||||||
u64 btrfs_extref_hash(u64 parent_objectid, 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)crc32c(parent_objectid, name, len);
|
||||||
|
}
|
||||||
|
|
||||||
/* extent-tree.c */
|
/* extent-tree.c */
|
||||||
int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
|
int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
|
||||||
|
Loading…
Reference in New Issue
Block a user