summaryrefslogtreecommitdiff
path: root/fs/btrfs/dir-item.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2023-08-25 16:19:22 -0400
committerDavid Sterba <dsterba@suse.com>2023-10-12 16:44:02 +0200
commit1b9e6a15bcc9abd5e6d641a29b82aad5d8e801d8 (patch)
treec3d3281cbd3e91a34522f51dc6796852bc7cc2cc /fs/btrfs/dir-item.h
parent98e4f060c4f565a3b62e8cdfe6b89f59167312b6 (diff)
btrfs: move btrfs_name_hash to dir-item.h
This is related to the name hashing for dir items, move it into dir-item.h. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dir-item.h')
-rw-r--r--fs/btrfs/dir-item.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/dir-item.h b/fs/btrfs/dir-item.h
index aab4b7cc7fa0..5db2ea0dfd76 100644
--- a/fs/btrfs/dir-item.h
+++ b/fs/btrfs/dir-item.h
@@ -3,6 +3,8 @@
#ifndef BTRFS_DIR_ITEM_H
#define BTRFS_DIR_ITEM_H
+#include <linux/crc32c.h>
+
int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
const struct fscrypt_str *name);
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
@@ -39,4 +41,9 @@ struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
const char *name,
int name_len);
+static inline u64 btrfs_name_hash(const char *name, int len)
+{
+ return crc32c((u32)~1, name, len);
+}
+
#endif